From 9343707ee283190273d0c4e94f8fdf1b9d264905 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 12 Jun 2013 14:08:46 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5843 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- boards/ST_EVB_SPC560BC/board.c | 4 ++-- boards/ST_EVB_SPC560D/board.c | 7 ++++--- boards/ST_EVB_SPC560P/board.c | 4 ++-- boards/ST_EVB_SPC563M/board.c | 4 ++-- boards/ST_EVB_SPC564A/board.c | 4 ++-- boards/ST_EVB_SPC56EL/board.c | 4 ++-- demos/PPC-SPC560P-GCC/Makefile | 2 +- demos/PPC-SPC564A-GCC/Makefile | 2 +- os/hal/platforms/SPC560Dxx/spc560d_registry.h | 2 +- os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.c | 2 +- os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h | 16 ++++++++++------ os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c | 2 +- os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h | 10 +++++----- testhal/SPC560Pxx/PWM-ICU/Makefile | 2 +- testhal/SPC560Pxx/SPI/mcuconf.h | 2 +- 15 files changed, 36 insertions(+), 31 deletions(-) diff --git a/boards/ST_EVB_SPC560BC/board.c b/boards/ST_EVB_SPC560BC/board.c index dce36133b..5c067606b 100644 --- a/boards/ST_EVB_SPC560BC/board.c +++ b/boards/ST_EVB_SPC560BC/board.c @@ -18,7 +18,7 @@ #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) -/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/ +/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT}, @@ -30,7 +30,7 @@ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_E, PE_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_E, PE_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_E, PE_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, - {0, 0, 0} + {-1, 0, 0} }; /* Initialization array for the PSMI registers.*/ diff --git a/boards/ST_EVB_SPC560D/board.c b/boards/ST_EVB_SPC560D/board.c index dce36133b..fc5f2c6bc 100644 --- a/boards/ST_EVB_SPC560D/board.c +++ b/boards/ST_EVB_SPC560D/board.c @@ -18,7 +18,7 @@ #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) -/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/ +/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT}, @@ -30,13 +30,14 @@ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_E, PE_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_E, PE_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_E, PE_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, - {0, 0, 0} + {-1, 0, 0} }; /* Initialization array for the PSMI registers.*/ static const uint8_t spc_padsels_init[SPC5_SIUL_NUM_PADSELS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 }; /** diff --git a/boards/ST_EVB_SPC560P/board.c b/boards/ST_EVB_SPC560P/board.c index 4b0524f66..5410436bb 100644 --- a/boards/ST_EVB_SPC560P/board.c +++ b/boards/ST_EVB_SPC560P/board.c @@ -18,7 +18,7 @@ #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) -/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/ +/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT}, @@ -30,7 +30,7 @@ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_D, PD_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_D, PD_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_D, PD_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, - {0, 0, 0} + {-1, 0, 0} }; /* Initialization array for the PSMI registers.*/ diff --git a/boards/ST_EVB_SPC563M/board.c b/boards/ST_EVB_SPC563M/board.c index 87115289b..523d1d7e5 100644 --- a/boards/ST_EVB_SPC563M/board.c +++ b/boards/ST_EVB_SPC563M/board.c @@ -18,7 +18,7 @@ #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) -/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/ +/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT5, P5_ESCI_A_TX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, {PCR(PORT5, P5_ESCI_A_RX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, @@ -30,7 +30,7 @@ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT11, P11_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT11, P11_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT11, P11_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, - {0, 0, 0} + {-1, 0, 0} }; /** diff --git a/boards/ST_EVB_SPC564A/board.c b/boards/ST_EVB_SPC564A/board.c index 87115289b..523d1d7e5 100644 --- a/boards/ST_EVB_SPC564A/board.c +++ b/boards/ST_EVB_SPC564A/board.c @@ -18,7 +18,7 @@ #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) -/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/ +/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT5, P5_ESCI_A_TX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, {PCR(PORT5, P5_ESCI_A_RX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, @@ -30,7 +30,7 @@ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT11, P11_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT11, P11_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT11, P11_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, - {0, 0, 0} + {-1, 0, 0} }; /** diff --git a/boards/ST_EVB_SPC56EL/board.c b/boards/ST_EVB_SPC56EL/board.c index 1f510a997..7373f595d 100644 --- a/boards/ST_EVB_SPC56EL/board.c +++ b/boards/ST_EVB_SPC56EL/board.c @@ -18,7 +18,7 @@ #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) -/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/ +/* Initial setup of all defined pads, the list is terminated by a {-1, 0, 0}.*/ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT}, @@ -30,7 +30,7 @@ static const spc_siu_init_t spc_siu_init[] = { {PCR(PORT_D, PD_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_D, PD_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, {PCR(PORT_D, PD_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, - {0, 0, 0} + {-1, 0, 0} }; /* Initialization array for the PSMI registers.*/ diff --git a/demos/PPC-SPC560P-GCC/Makefile b/demos/PPC-SPC560P-GCC/Makefile index 3949db752..6423b2caa 100644 --- a/demos/PPC-SPC560P-GCC/Makefile +++ b/demos/PPC-SPC560P-GCC/Makefile @@ -147,7 +147,7 @@ DLIBS = # # List all user C define here, like -D_DEBUG=1 -UDEFS = +UDEFS = -D_SPC560P50L5_ # Define ASM defines here UADEFS = diff --git a/demos/PPC-SPC564A-GCC/Makefile b/demos/PPC-SPC564A-GCC/Makefile index 93d437847..d79a29ab1 100644 --- a/demos/PPC-SPC564A-GCC/Makefile +++ b/demos/PPC-SPC564A-GCC/Makefile @@ -147,7 +147,7 @@ DLIBS = # # List all user C define here, like -D_DEBUG=1 -UDEFS = +UDEFS = -D_SPC564A70L7_ # Define ASM defines here UADEFS = diff --git a/os/hal/platforms/SPC560Dxx/spc560d_registry.h b/os/hal/platforms/SPC560Dxx/spc560d_registry.h index 294e6d118..108ee04e1 100644 --- a/os/hal/platforms/SPC560Dxx/spc560d_registry.h +++ b/os/hal/platforms/SPC560Dxx/spc560d_registry.h @@ -107,7 +107,7 @@ #define SPC5_SIUL_PCTL 68 #define SPC5_SIUL_NUM_PORTS 8 #define SPC5_SIUL_NUM_PCRS 123 -#define SPC5_SIUL_NUM_PADSELS 32 +#define SPC5_SIUL_NUM_PADSELS 63 #define SPC5_SIUL_SYSTEM_PINS 32,33,121,122 /** @} */ diff --git a/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.c b/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.c index 90c1dc5bf..d8ae4b2d5 100644 --- a/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.c +++ b/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.c @@ -95,7 +95,7 @@ skip: /* Initialize PCR registers for defined pads.*/ i = 0; - while (config->inits[i].pcr_value != 0) { + while (config->inits[i].pcr_index != -1) { SIU.GPDO[config->inits[i].pcr_index].R = config->inits[i].gpdo_value; SIU.PCR[config->inits[i].pcr_index].R = config->inits[i].pcr_value; i++; diff --git a/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h b/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h index dac37c448..5304ac36d 100644 --- a/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h +++ b/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h @@ -104,8 +104,12 @@ /** * @brief Alternate "n" output pad. + * @note Both the IBE and OBE bits are specified in this mask, the OBE + * bit is not required for some PCRs but in that case it is + * ignored. */ -#define PAL_MODE_OUTPUT_ALTERNATE(n) (PAL_SPC5_IBE | PAL_SPC5_PA(n)) +#define PAL_MODE_OUTPUT_ALTERNATE(n) (PAL_SPC5_IBE | PAL_SPC5_OBE | \ + PAL_SPC5_PA(n)) /** @} */ /*===========================================================================*/ @@ -145,7 +149,7 @@ typedef uint32_t ioportid_t; * @brief SIUL register initializer type. */ typedef struct { - uint8_t pcr_index; + int32_t pcr_index; uint8_t gpdo_value; iomode_t pcr_value; } spc_siu_init_t; @@ -264,7 +268,7 @@ typedef struct { * @notapi */ #define pal_lld_writeport(port, bits) \ - (((volatile uint16_t *)SIU.PGPDO)[port] = (bits)) + (((volatile uint16_t *)SIU.PGPDO)[port] = (bits)) /** * @brief Reads a group of bits. @@ -353,7 +357,7 @@ typedef struct { * @notapi */ #define pal_lld_setpad(port, pad) \ - (SIU.GPDO[((port) * 16) + (pad)].R = 1) + (SIU.GPDO[((port) * 16) + (pad)].R = 1) /** * @brief Clears a pad logical state to @p PAL_LOW. @@ -364,7 +368,7 @@ typedef struct { * @notapi */ #define pal_lld_clearpad(port, pad) \ - (SIU.GPDO[((port) * 16) + (pad)].R = 0) + (SIU.GPDO[((port) * 16) + (pad)].R = 0) /** * @brief Toggles a pad logical state. @@ -378,7 +382,7 @@ typedef struct { * @notapi */ #define pal_lld_togglepad(port, pad) \ - (SIU.GPDO[((port) * 16) + (pad)].R = ~SIU.GPDO[((port) * 16) + (pad)].R) + (SIU.GPDO[((port) * 16) + (pad)].R = ~SIU.GPDO[((port) * 16) + (pad)].R) /** * @brief Pad mode setup. diff --git a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c index 24c0908ce..1d77a177a 100644 --- a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c +++ b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c @@ -67,7 +67,7 @@ void _pal_lld_init(const PALConfig *config) { /* Initialize PCR registers for defined pads.*/ i = 0; - while (config->inits[i].pcr_value != 0) { + while (config->inits[i].pcr_index != -1) { SIU.GPDO[config->inits[i].pcr_index].R = config->inits[i].gpdo_value; SIU.PCR[config->inits[i].pcr_index].R = config->inits[i].pcr_value; i++; diff --git a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h index f8648b305..b9c72bf0c 100644 --- a/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h +++ b/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h @@ -146,7 +146,7 @@ typedef uint16_t iomode_t; * @brief SIU/SIUL register initializer type. */ typedef struct { - uint8_t pcr_index; + int32_t pcr_index; uint8_t gpdo_value; iomode_t pcr_value; } spc_siu_init_t; @@ -262,7 +262,7 @@ typedef struct { * @notapi */ #define pal_lld_writeport(port, bits) \ - (((volatile uint16_t *)SIU.PGPDO)[port] = (bits)) + (((volatile uint16_t *)SIU.PGPDO)[port] = (bits)) /** * @brief Reads a group of bits. @@ -353,7 +353,7 @@ typedef struct { * @notapi */ #define pal_lld_setpad(port, pad) \ - (SIU.GPDO[((port) * 16) + (pad)].R = 1) + (SIU.GPDO[((port) * 16) + (pad)].R = 1) /** * @brief Clears a pad logical state to @p PAL_LOW. @@ -364,7 +364,7 @@ typedef struct { * @notapi */ #define pal_lld_clearpad(port, pad) \ - (SIU.GPDO[((port) * 16) + (pad)].R = 0) + (SIU.GPDO[((port) * 16) + (pad)].R = 0) /** * @brief Toggles a pad logical state. @@ -378,7 +378,7 @@ typedef struct { * @notapi */ #define pal_lld_togglepad(port, pad) \ - (SIU.GPDO[((port) * 16) + (pad)].R = ~SIU.GPDO[((port) * 16) + (pad)].R) + (SIU.GPDO[((port) * 16) + (pad)].R = ~SIU.GPDO[((port) * 16) + (pad)].R) /** * @brief Pad mode setup. diff --git a/testhal/SPC560Pxx/PWM-ICU/Makefile b/testhal/SPC560Pxx/PWM-ICU/Makefile index 4d69bc950..1bdaed928 100644 --- a/testhal/SPC560Pxx/PWM-ICU/Makefile +++ b/testhal/SPC560Pxx/PWM-ICU/Makefile @@ -146,7 +146,7 @@ DLIBS = # # List all user C define here, like -D_DEBUG=1 -UDEFS = +UDEFS = -D_SPC560P50L5_ # Define ASM defines here UADEFS = diff --git a/testhal/SPC560Pxx/SPI/mcuconf.h b/testhal/SPC560Pxx/SPI/mcuconf.h index 0d79df73a..940185854 100644 --- a/testhal/SPC560Pxx/SPI/mcuconf.h +++ b/testhal/SPC560Pxx/SPI/mcuconf.h @@ -213,7 +213,7 @@ #define SPC5_SPI_USE_DSPI1 TRUE #define SPC5_SPI_USE_DSPI2 TRUE #define SPC5_SPI_USE_DSPI3 TRUE -#define SPC5_SPI_USE_DSPI4 TRUE +#define SPC5_SPI_USE_DSPI4 FALSE #define SPC5_SPI_DSPI0_MCR (SPC5_MCR_PCSIS0 | \ SPC5_MCR_PCSIS1 | \ SPC5_MCR_PCSIS2 | \