From e4c5ac420566026e6b819bd10956156e453f0842 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 12 Dec 2012 11:29:01 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4906 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h | 16 ++--- os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c | 32 +-------- os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h | 105 ++++++++++++++---------------- 3 files changed, 59 insertions(+), 94 deletions(-) (limited to 'os/hal/platforms/SPC5xx') diff --git a/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h b/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h index 6eb250249..b79a2cef9 100644 --- a/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h +++ b/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h @@ -171,42 +171,42 @@ typedef struct { /** * @brief I/O port A identifier. */ -#define PA 0 +#define PORT_A 0 /** * @brief I/O port B identifier. */ -#define PB 1 +#define PORT_B 1 /** * @brief I/O port C identifier. */ -#define PC 2 +#define PORT_C 2 /** * @brief I/O port D identifier. */ -#define PD 3 +#define PORT_D 3 /** * @brief I/O port E identifier. */ -#define PE 4 +#define PORT_E 4 /** * @brief I/O port F identifier. */ -#define PF 5 +#define PORT_F 5 /** * @brief I/O port G identifier. */ -#define PG 6 +#define PORT_G 6 /** * @brief I/O port H identifier. */ -#define PH 7 +#define PORT_H 7 /*===========================================================================*/ /* Implementation, some of the following macros could be implemented as */ diff --git a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c index 8cd8b2bd3..5619ed4e0 100644 --- a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c +++ b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c @@ -13,8 +13,8 @@ */ /** - * @file SPC5xx/SIUL_v1/pal_lld.c - * @brief SPC5xx SIU/SIUL low level driver code. + * @file SPC5xx/SIU_v1/pal_lld.c + * @brief SPC5xx SIU low level driver code. * * @addtogroup PAL * @{ @@ -63,34 +63,6 @@ static const unsigned system_pins[] = {SPC5_SIU_SYSTEM_PINS}; void _pal_lld_init(const PALConfig *config) { unsigned i; -#if defined(SPC5_SIU_PCTL) - /* SIUL clock gating if present.*/ - halSPCSetPeripheralClockMode(SPC5_SIU_PCTL, - SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2)); -#endif - - /* Initialize PCR registers for undefined pads.*/ - for (i = 0; i < SPC5_SIU_NUM_PCRS; i++) { -#if defined(SPC5_SIU_SYSTEM_PINS) - /* Handling the case where some SIU pins are not meant to be reprogrammed, - for example JTAG pins.*/ - unsigned j; - for (j = 0; j < sizeof system_pins; j++) { - if (i == system_pins[j]) - goto skip; - } - SIU.PCR[i].R = config->default_mode; -skip: - ; -#else - SIU.PCR[i].R = config->default_mode; -#endif - } - - /* Initialize PADSEL registers.*/ - for (i = 0; i < SPC5_SIU_NUM_PADSELS; i++) - SIU.PSMI[i].R = config->padsels[i]; - /* Initialize PCR registers for defined pads.*/ i = 0; while (config->inits[i].pcr_value != 0) { diff --git a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h index 32b54d260..fac86c48f 100644 --- a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h +++ b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h @@ -13,8 +13,8 @@ */ /** - * @file SPC5xx/SIUL_v1/pal_lld.h - * @brief SPC5xx SIU/SIUL low level driver header. + * @file SPC5xx/SIU_v1/pal_lld.h + * @brief SPC5xx SIU low level driver header. * * @addtogroup PAL * @{ @@ -39,17 +39,19 @@ #undef PAL_MODE_OUTPUT_OPENDRAIN /** - * @name SIU/SIUL-specific PAL modes + * @name SIU-specific PAL modes * @{ */ -#define PAL_SPC5_SMC (1U << 14) -#define PAL_SPC5_APC (1U << 13) -#define PAL_SPC5_PA_MASK (3U << 10) +#define PAL_SPC5_PA_MASK (15U << 10) #define PAL_SPC5_PA(n) ((n) << 10) #define PAL_SPC5_OBE (1U << 9) #define PAL_SPC5_IBE (1U << 8) +#define PAL_SPC5_DSC_10PF (0U << 6) +#define PAL_SPC5_DSC_20PF (1U << 6) +#define PAL_SPC5_DSC_30PF (2U << 6) +#define PAL_SPC5_DSC_50PF (3U << 6) #define PAL_SPC5_ODE (1U << 5) -#define PAL_SPC5_SRC (1U << 2) +#define PAL_SPC5_HYS (1U << 4) #define PAL_SPC5_WPE (1U << 1) #define PAL_SPC5_WPS (1U << 0) /** @} */ @@ -84,11 +86,6 @@ */ #define PAL_MODE_INPUT_PULLDOWN (PAL_SPC5_IBE |PAL_SPC5_WPE) -/** - * @brief Analog input mode. - */ -#define PAL_MODE_INPUT_ANALOG PAL_SPC5_APC - /** * @brief Push-pull output pad. */ @@ -127,11 +124,6 @@ */ typedef uint16_t ioportmask_t; -/** - * @brief Digital I/O modes. - */ -typedef uint16_t iomode_t; - /** * @brief Port Identifier. * @details This type can be a scalar or some kind of pointer, do not make @@ -140,6 +132,11 @@ typedef uint16_t iomode_t; */ typedef uint32_t ioportid_t; +/** + * @brief Digital I/O modes. + */ +typedef uint16_t iomode_t; + /** * @brief SIU/SIUL register initializer type. */ @@ -159,9 +156,7 @@ typedef struct { * architecture dependent, fields. */ typedef struct { - iomode_t default_mode; const spc_siu_init_t *inits; - const uint8_t *padsels; } PALConfig; /*===========================================================================*/ @@ -169,44 +164,42 @@ typedef struct { /*===========================================================================*/ /** - * @brief I/O port A identifier. - */ -#define PA 0 - -/** - * @brief I/O port B identifier. - */ -#define PB 1 - -/** - * @brief I/O port C identifier. - */ -#define PC 2 - -/** - * @brief I/O port D identifier. - */ -#define PD 3 - -/** - * @brief I/O port E identifier. - */ -#define PE 4 - -/** - * @brief I/O port F identifier. - */ -#define PF 5 - -/** - * @brief I/O port G identifier. - */ -#define PG 6 - -/** - * @brief I/O port H identifier. + * @name Port identifiers + * @{ */ -#define PH 7 +#define PORT0 0 +#define PORT1 1 +#define PORT2 2 +#define PORT3 3 +#define PORT4 4 +#define PORT5 5 +#define PORT6 6 +#define PORT7 7 +#define PORT8 8 +#define PORT9 9 +#define PORT10 10 +#define PORT11 11 +#define PORT12 12 +#define PORT13 13 +#define PORT14 14 +#define PORT15 15 +#define PORT16 16 +#define PORT17 17 +#define PORT18 18 +#define PORT19 19 +#define PORT20 20 +#define PORT21 21 +#define PORT22 22 +#define PORT23 23 +#define PORT24 24 +#define PORT25 25 +#define PORT26 26 +#define PORT27 27 +#define PORT28 28 +#define PORT29 29 +#define PORT30 30 +#define PORT31 31 +/** @} */ /*===========================================================================*/ /* Implementation, some of the following macros could be implemented as */ -- cgit v1.2.3