aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-12-12 11:29:01 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-12-12 11:29:01 +0000
commite4c5ac420566026e6b819bd10956156e453f0842 (patch)
tree5436be60537918c1c2e4a24f196585cdf3dee129
parent78e38625943412e0849142b757ced4aa99b9d7d9 (diff)
downloadChibiOS-e4c5ac420566026e6b819bd10956156e453f0842.tar.gz
ChibiOS-e4c5ac420566026e6b819bd10956156e453f0842.tar.bz2
ChibiOS-e4c5ac420566026e6b819bd10956156e453f0842.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4906 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--boards/GENERIC_SPC560BC/board.c22
-rw-r--r--boards/GENERIC_SPC560P/board.c22
-rw-r--r--boards/GENERIC_SPC563M/board.c26
-rw-r--r--boards/GENERIC_SPC563M/board.h31
-rw-r--r--demos/PPC-SPC560B-GCC/main.c52
-rw-r--r--demos/PPC-SPC560P-GCC/main.c52
-rw-r--r--demos/PPC-SPC563M-GCC/halconf.h2
-rw-r--r--demos/PPC-SPC563M-GCC/main.c21
-rw-r--r--os/hal/platforms/SPC563Mxx/hal_lld.h4
-rw-r--r--os/hal/platforms/SPC563Mxx/platform.mk4
-rw-r--r--os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.h16
-rw-r--r--os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c32
-rw-r--r--os/hal/platforms/SPC5xx/SIU_v1/pal_lld.h105
13 files changed, 190 insertions, 199 deletions
diff --git a/boards/GENERIC_SPC560BC/board.c b/boards/GENERIC_SPC560BC/board.c
index bfe1d14f1..f7155230f 100644
--- a/boards/GENERIC_SPC560BC/board.c
+++ b/boards/GENERIC_SPC560BC/board.c
@@ -16,18 +16,18 @@
#include "hal.h"
#if HAL_USE_PAL || defined(__DOXYGEN__)
-/* Initial setup of all defined pads, the list is terminated by a {0, 0}.*/
+/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/
static const spc_siu_init_t spc_siu_init[] = {
- {PCR(PB, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
- {PCR(PB, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT},
- {PCR(PE, PE_BUTTON1), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PE, PE_BUTTON2), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PE, PE_BUTTON3), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PE, PE_BUTTON4), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PE, PE_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
- {PCR(PE, PE_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
- {PCR(PE, PE_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
- {PCR(PE, PE_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
+ {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
+ {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT},
+ {PCR(PORT_E, PE_BUTTON1), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_E, PE_BUTTON2), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_E, PE_BUTTON3), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_E, PE_BUTTON4), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_E, PE_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
+ {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}
};
diff --git a/boards/GENERIC_SPC560P/board.c b/boards/GENERIC_SPC560P/board.c
index 2418cb941..e5d7d2a83 100644
--- a/boards/GENERIC_SPC560P/board.c
+++ b/boards/GENERIC_SPC560P/board.c
@@ -16,18 +16,18 @@
#include "hal.h"
#if HAL_USE_PAL || defined(__DOXYGEN__)
-/* Initial setup of all defined pads, the list is terminated by a {0, 0}.*/
+/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/
static const spc_siu_init_t spc_siu_init[] = {
- {PCR(PB, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
- {PCR(PB, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT},
- {PCR(PD, PD_BUTTON1), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PD, PD_BUTTON2), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PD, PD_BUTTON3), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PD, PD_BUTTON4), PAL_LOW, PAL_MODE_INPUT},
- {PCR(PD, PD_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
- {PCR(PD, PD_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
- {PCR(PD, PD_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
- {PCR(PD, PD_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
+ {PCR(PORT_B, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
+ {PCR(PORT_B, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT},
+ {PCR(PORT_D, PD_BUTTON1), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_D, PD_BUTTON2), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_D, PD_BUTTON3), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_D, PD_BUTTON4), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT_D, PD_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
+ {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}
};
diff --git a/boards/GENERIC_SPC563M/board.c b/boards/GENERIC_SPC563M/board.c
index 0edcfcdc2..5914c19e8 100644
--- a/boards/GENERIC_SPC563M/board.c
+++ b/boards/GENERIC_SPC563M/board.c
@@ -21,6 +21,30 @@
#include "ch.h"
#include "hal.h"
+#if HAL_USE_PAL || defined(__DOXYGEN__)
+/* Initial setup of all defined pads, the list is terminated by a {0, 0, 0}.*/
+static const spc_siu_init_t spc_siu_init[] = {
+ {PCR(PORT4, P4_ESCI_A_TX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
+ {PCR(PORT4, P4_ESCI_A_RX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)},
+ {PCR(PORT11, P11_BUTTON1), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT11, P11_BUTTON2), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT11, P11_BUTTON3), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT11, P11_BUTTON4), PAL_LOW, PAL_MODE_INPUT},
+ {PCR(PORT11, P11_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL},
+ {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}
+};
+
+/**
+ * @brief PAL setup.
+ */
+const PALConfig pal_default_config = {
+ spc_siu_init
+};
+#endif
+
/*
* Early initialization code.
* This initialization must be performed just after stack setup and before
@@ -36,6 +60,7 @@ void __early_init(void) {
*/
void boardInit(void) {
+#if 0
/*
* Various initialization (temporary code).
*/
@@ -49,4 +74,5 @@ void boardInit(void) {
SIU.PCR[GPIO_BUTTON4].R = 0x0100; /* IBE. */
SIU.PCR[GPIO_SCI_A_TX].R = 0x0500; /* Primary | IBE. */
SIU.PCR[GPIO_SCI_A_RX].R = 0x0500; /* Primary | IBE. */
+#endif
}
diff --git a/boards/GENERIC_SPC563M/board.h b/boards/GENERIC_SPC563M/board.h
index 6b63c3abf..6c85c76f7 100644
--- a/boards/GENERIC_SPC563M/board.h
+++ b/boards/GENERIC_SPC563M/board.h
@@ -29,30 +29,35 @@
* Board identifiers.
*/
#define BOARD_GENERIC_SPC563M
-#define BOARD_NAME "Generic SPC563M"
+#define BOARD_NAME "Generic SPC563M"
/*
* Board frequencies.
*/
-#if !defined(EXTCLK)
-#define EXTCLK 8000000
+#if !defined(SPC5_XOSC_CLK)
+#define SPC5_XOSC_CLK 8000000
#endif
/*
* I/O definitions.
*/
-#define GPIO_SCI_A_TX 89
-#define GPIO_SCI_A_RX 90
+#define P4_ESCI_A_TX 9
+#define P4_ESCI_A_RX 10
-#define GPIO_BUTTON1 179
-#define GPIO_BUTTON2 181
-#define GPIO_BUTTON3 183
-#define GPIO_BUTTON4 187
+#define P11_BUTTON1 3
+#define P11_BUTTON2 5
+#define P11_BUTTON3 7
+#define P11_BUTTON4 9
-#define GPIO_LED1 188
-#define GPIO_LED2 189
-#define GPIO_LED3 190
-#define GPIO_LED4 191
+#define P11_LED1 12
+#define P11_LED2 13
+#define P11_LED3 14
+#define P11_LED4 15
+
+/*
+ * Support macros.
+ */
+#define PCR(port, pin) (((port) * 16) + (pin))
#if !defined(_FROM_ASM_)
#ifdef __cplusplus
diff --git a/demos/PPC-SPC560B-GCC/main.c b/demos/PPC-SPC560B-GCC/main.c
index db7f03f2b..d77e2ae07 100644
--- a/demos/PPC-SPC560B-GCC/main.c
+++ b/demos/PPC-SPC560B-GCC/main.c
@@ -103,59 +103,59 @@ static msg_t Thread1(void *arg) {
unsigned i;
for (i = 0; i < 4; i++) {
- palClearPad(PE, PE_LED1);
+ palClearPad(PORT_E, PE_LED1);
chThdSleepMilliseconds(100);
- palClearPad(PE, PE_LED2);
+ palClearPad(PORT_E, PE_LED2);
chThdSleepMilliseconds(100);
- palClearPad(PE, PE_LED3);
+ palClearPad(PORT_E, PE_LED3);
chThdSleepMilliseconds(100);
- palClearPad(PE, PE_LED4);
+ palClearPad(PORT_E, PE_LED4);
chThdSleepMilliseconds(100);
- palSetPad(PE, PE_LED1);
+ palSetPad(PORT_E, PE_LED1);
chThdSleepMilliseconds(100);
- palSetPad(PE, PE_LED2);
+ palSetPad(PORT_E, PE_LED2);
chThdSleepMilliseconds(100);
- palSetPad(PE, PE_LED3);
+ palSetPad(PORT_E, PE_LED3);
chThdSleepMilliseconds(100);
- palSetPad(PE, PE_LED4);
+ palSetPad(PORT_E, PE_LED4);
chThdSleepMilliseconds(300);
}
for (i = 0; i < 4; i++) {
- palTogglePort(PE, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
- PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
+ palTogglePort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
+ PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
chThdSleepMilliseconds(500);
- palTogglePort(PE, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
- PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
+ palTogglePort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
+ PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
chThdSleepMilliseconds(500);
}
for (i = 0; i < 4; i++) {
- palTogglePad(PE, PE_LED1);
+ palTogglePad(PORT_E, PE_LED1);
chThdSleepMilliseconds(250);
- palTogglePad(PE, PE_LED1);
- palTogglePad(PE, PE_LED2);
+ palTogglePad(PORT_E, PE_LED1);
+ palTogglePad(PORT_E, PE_LED2);
chThdSleepMilliseconds(250);
- palTogglePad(PE, PE_LED2);
- palTogglePad(PE, PE_LED3);
+ palTogglePad(PORT_E, PE_LED2);
+ palTogglePad(PORT_E, PE_LED3);
chThdSleepMilliseconds(250);
- palTogglePad(PE, PE_LED3);
- palTogglePad(PE, PE_LED4);
+ palTogglePad(PORT_E, PE_LED3);
+ palTogglePad(PORT_E, PE_LED4);
chThdSleepMilliseconds(250);
- palTogglePad(PE, PE_LED4);
+ palTogglePad(PORT_E, PE_LED4);
}
for (i = 0; i < 4; i++) {
- palClearPort(PE, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
- palSetPort(PE, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
+ palClearPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
+ palSetPort(PORT_E, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
chThdSleepMilliseconds(500);
- palClearPort(PE, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
- palSetPort(PE, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
+ palClearPort(PORT_E, PAL_PORT_BIT(PE_LED2) | PAL_PORT_BIT(PE_LED4));
+ palSetPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED3));
chThdSleepMilliseconds(500);
}
- palSetPort(PE, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
- PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
+ palSetPort(PORT_E, PAL_PORT_BIT(PE_LED1) | PAL_PORT_BIT(PE_LED2) |
+ PAL_PORT_BIT(PE_LED3) | PAL_PORT_BIT(PE_LED4));
}
return 0;
}
diff --git a/demos/PPC-SPC560P-GCC/main.c b/demos/PPC-SPC560P-GCC/main.c
index e3c18471d..108f4c1fb 100644
--- a/demos/PPC-SPC560P-GCC/main.c
+++ b/demos/PPC-SPC560P-GCC/main.c
@@ -103,59 +103,59 @@ static msg_t Thread1(void *arg) {
unsigned i;
for (i = 0; i < 4; i++) {
- palClearPad(PD, PD_LED1);
+ palClearPad(PORT_D, PD_LED1);
chThdSleepMilliseconds(100);
- palClearPad(PD, PD_LED2);
+ palClearPad(PORT_D, PD_LED2);
chThdSleepMilliseconds(100);
- palClearPad(PD, PD_LED3);
+ palClearPad(PORT_D, PD_LED3);
chThdSleepMilliseconds(100);
- palClearPad(PD, PD_LED4);
+ palClearPad(PORT_D, PD_LED4);
chThdSleepMilliseconds(100);
- palSetPad(PD, PD_LED1);
+ palSetPad(PORT_D, PD_LED1);
chThdSleepMilliseconds(100);
- palSetPad(PD, PD_LED2);
+ palSetPad(PORT_D, PD_LED2);
chThdSleepMilliseconds(100);
- palSetPad(PD, PD_LED3);
+ palSetPad(PORT_D, PD_LED3);
chThdSleepMilliseconds(100);
- palSetPad(PD, PD_LED4);
+ palSetPad(PORT_D, PD_LED4);
chThdSleepMilliseconds(300);
}
for (i = 0; i < 4; i++) {
- palTogglePort(PD, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
- PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
+ palTogglePort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
+ PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
chThdSleepMilliseconds(500);
- palTogglePort(PD, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
- PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
+ palTogglePort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
+ PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
chThdSleepMilliseconds(500);
}
for (i = 0; i < 4; i++) {
- palTogglePad(PD, PD_LED1);
+ palTogglePad(PORT_D, PD_LED1);
chThdSleepMilliseconds(250);
- palTogglePad(PD, PD_LED1);
- palTogglePad(PD, PD_LED2);
+ palTogglePad(PORT_D, PD_LED1);
+ palTogglePad(PORT_D, PD_LED2);
chThdSleepMilliseconds(250);
- palTogglePad(PD, PD_LED2);
- palTogglePad(PD, PD_LED3);
+ palTogglePad(PORT_D, PD_LED2);
+ palTogglePad(PORT_D, PD_LED3);
chThdSleepMilliseconds(250);
- palTogglePad(PD, PD_LED3);
- palTogglePad(PD, PD_LED4);
+ palTogglePad(PORT_D, PD_LED3);
+ palTogglePad(PORT_D, PD_LED4);
chThdSleepMilliseconds(250);
- palTogglePad(PD, PD_LED4);
+ palTogglePad(PORT_D, PD_LED4);
}
for (i = 0; i < 4; i++) {
- palClearPort(PD, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED3));
- palSetPort(PD, PAL_PORT_BIT(PD_LED2) | PAL_PORT_BIT(PD_LED4));
+ palClearPort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED3));
+ palSetPort(PORT_D, PAL_PORT_BIT(PD_LED2) | PAL_PORT_BIT(PD_LED4));
chThdSleepMilliseconds(500);
- palClearPort(PD, PAL_PORT_BIT(PD_LED2) | PAL_PORT_BIT(PD_LED4));
- palSetPort(PD, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED3));
+ palClearPort(PORT_D, PAL_PORT_BIT(PD_LED2) | PAL_PORT_BIT(PD_LED4));
+ palSetPort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED3));
chThdSleepMilliseconds(500);
}
- palSetPort(PD, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
- PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
+ palSetPort(PORT_D, PAL_PORT_BIT(PD_LED1) | PAL_PORT_BIT(PD_LED2) |
+ PAL_PORT_BIT(PD_LED3) | PAL_PORT_BIT(PD_LED4));
}
return 0;
}
diff --git a/demos/PPC-SPC563M-GCC/halconf.h b/demos/PPC-SPC563M-GCC/halconf.h
index bab04ab7b..c9b3ad25a 100644
--- a/demos/PPC-SPC563M-GCC/halconf.h
+++ b/demos/PPC-SPC563M-GCC/halconf.h
@@ -45,7 +45,7 @@
* @brief Enables the PAL subsystem.
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
-#define HAL_USE_PAL FALSE
+#define HAL_USE_PAL TRUE
#endif
/**
diff --git a/demos/PPC-SPC563M-GCC/main.c b/demos/PPC-SPC563M-GCC/main.c
index aab1b4d44..fdce9de21 100644
--- a/demos/PPC-SPC563M-GCC/main.c
+++ b/demos/PPC-SPC563M-GCC/main.c
@@ -101,27 +101,22 @@ static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker");
- SIU.GPDO[GPIO_LED1].R = 1;
- SIU.GPDO[GPIO_LED2].R = 1;
- SIU.GPDO[GPIO_LED3].R = 1;
- SIU.GPDO[GPIO_LED4].R = 1;
-
while (TRUE) {
- SIU.GPDO[GPIO_LED1].R = 0;
+ palClearPad(PORT11, P11_LED1);
chThdSleepMilliseconds(100);
- SIU.GPDO[GPIO_LED2].R = 0;
+ palClearPad(PORT11, P11_LED2);
chThdSleepMilliseconds(100);
- SIU.GPDO[GPIO_LED3].R = 0;
+ palClearPad(PORT11, P11_LED3);
chThdSleepMilliseconds(100);
- SIU.GPDO[GPIO_LED4].R = 0;
+ palClearPad(PORT11, P11_LED4);
chThdSleepMilliseconds(100);
- SIU.GPDO[GPIO_LED1].R = 1;
+ palSetPad(PORT11, P11_LED1);
chThdSleepMilliseconds(100);
- SIU.GPDO[GPIO_LED2].R = 1;
+ palSetPad(PORT11, P11_LED2);
chThdSleepMilliseconds(100);
- SIU.GPDO[GPIO_LED3].R = 1;
+ palSetPad(PORT11, P11_LED3);
chThdSleepMilliseconds(100);
- SIU.GPDO[GPIO_LED4].R = 1;
+ palSetPad(PORT11, P11_LED4);
chThdSleepMilliseconds(300);
}
return 0;
diff --git a/os/hal/platforms/SPC563Mxx/hal_lld.h b/os/hal/platforms/SPC563Mxx/hal_lld.h
index bda58ed00..e7d532945 100644
--- a/os/hal/platforms/SPC563Mxx/hal_lld.h
+++ b/os/hal/platforms/SPC563Mxx/hal_lld.h
@@ -186,7 +186,7 @@
/**
* @brief PLL output clock.
*/
-#define SPC5_PLLCLK ((EXTCLK / (SPC5_CLK_PREDIV + 1)) * SPC5_CLK_MFD)
+#define SPC5_PLLCLK ((SPC5_XOSC_CLK / (SPC5_CLK_PREDIV + 1)) * SPC5_CLK_MFD)
#if (SPC5_PLLCLK < 256000000) || (SPC5_PLLCLK > 512000000)
#error "VCO frequency out of the acceptable range (256...512)"
@@ -198,7 +198,7 @@
#if !SPC5_CLK_BYPASS || defined(__DOXYGEN__)
#define SPC5_SYSCLK (SPC5_PLLCLK / (1 << (SPC5_CLK_RFD + 1)))
#else
-#define SPC5_SYSCLK EXTCLK
+#define SPC5_SYSCLK SPC5_XOSC_CLK
#endif
#if (SPC5_SYSCLK > 80000000) && !SPC5_ALLOW_OVERCLOCK
diff --git a/os/hal/platforms/SPC563Mxx/platform.mk b/os/hal/platforms/SPC563Mxx/platform.mk
index d70bad232..04e9a9739 100644
--- a/os/hal/platforms/SPC563Mxx/platform.mk
+++ b/os/hal/platforms/SPC563Mxx/platform.mk
@@ -1,9 +1,9 @@
# List of all the SPC56x platform files.
PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/SPC563Mxx/hal_lld.c \
${CHIBIOS}/os/hal/platforms/SPC5xx/ESCI_v1/serial_lld.c \
- ${CHIBIOS}/os/hal/platforms/SPC5xx/SIUL_v1/pal_lld.c
+ ${CHIBIOS}/os/hal/platforms/SPC5xx/SIU_v1/pal_lld.c
# Required include directories
PLATFORMINC = ${CHIBIOS}/os/hal/platforms/SPC563Mxx \
${CHIBIOS}/os/hal/platforms/SPC5xx/ESCI_v1 \
- ${CHIBIOS}/os/hal/platforms/SPC5xx/SIUL_v1
+ ${CHIBIOS}/os/hal/platforms/SPC5xx/SIU_v1
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)
/** @} */
@@ -85,11 +87,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.
*/
#define PAL_MODE_OUTPUT_PUSHPULL (PAL_SPC5_IBE | PAL_SPC5_OBE)
@@ -128,11 +125,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
* any assumption about it, use the provided macros when populating
@@ -141,6 +133,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.
*/
typedef struct {
@@ -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 */