From 8b55cb9767ce881b7a22c5af34605ed3a261582d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 27 Aug 2009 16:42:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1109 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-AT91SAM7X-GCC/board.c | 14 +++++------ demos/ARM7-AT91SAM7X-GCC/main.c | 16 ++++++------- demos/ARM7-AT91SAM7X-WEB-GCC/board.c | 14 +++++------ demos/ARM7-AT91SAM7X-WEB-GCC/main.c | 16 ++++++------- demos/ARM7-LPC214x-G++/main.cpp | 12 +++++----- demos/ARM7-LPC214x-GCC-minimal/main.c | 12 +++++----- demos/ARM7-LPC214x-GCC/main.c | 28 +++++++++++----------- demos/ARM7-LPC214x-GCC/mmcsd.c | 4 ++-- demos/ARMCM3-STM32F103-GCC/main.c | 12 +++++----- demos/MSP430-MSP430x1611-GCC/main.c | 12 +++++----- docs/reports/STM32F103-72.txt | 38 +++++++++++++---------------- os/io/platforms/AT91SAM7X/pal_lld.h | 4 ++-- os/io/platforms/AT91SAM7X/serial_lld.c | 20 ++++++++-------- os/io/platforms/AT91SAM7X/serial_lld.h | 4 ++-- os/io/platforms/LPC214x/lpc214x_ssp.c | 4 ++-- os/io/platforms/LPC214x/pal_lld.h | 4 ++-- os/io/platforms/LPC214x/serial_lld.c | 28 +++++++++++----------- os/io/platforms/LPC214x/serial_lld.h | 4 ++-- os/io/platforms/MSP430/pal_lld.c | 44 +++++++++++++++++----------------- os/io/platforms/MSP430/pal_lld.h | 12 +++++----- os/io/platforms/MSP430/serial_lld.c | 32 ++++++++++++------------- os/io/platforms/MSP430/serial_lld.h | 4 ++-- os/io/platforms/STM32F103/pal_lld.c | 42 ++++++++++++++++---------------- os/io/platforms/STM32F103/pal_lld.h | 14 +++++------ os/io/platforms/STM32F103/serial_lld.c | 30 +++++++++++------------ os/io/platforms/STM32F103/serial_lld.h | 6 ++--- os/io/templates/pal_lld.h | 2 +- readme.txt | 3 +++ 28 files changed, 216 insertions(+), 219 deletions(-) diff --git a/demos/ARM7-AT91SAM7X-GCC/board.c b/demos/ARM7-AT91SAM7X-GCC/board.c index fb52c8f3b..31e362845 100644 --- a/demos/ARM7-AT91SAM7X-GCC/board.c +++ b/demos/ARM7-AT91SAM7X-GCC/board.c @@ -133,25 +133,25 @@ void hwinit1(void) { /* * LCD pins setup. */ - palClearPad(IOPORT_B, PIOB_LCD_BL); - palSetPadMode(IOPORT_B, PIOB_LCD_BL, PAL_MODE_OUTPUT_PUSHPULL); + palClearPad(IOPORT2, PIOB_LCD_BL); + palSetPadMode(IOPORT2, PIOB_LCD_BL, PAL_MODE_OUTPUT_PUSHPULL); - palSetPad(IOPORT_A, PIOA_LCD_RESET); - palSetPadMode(IOPORT_A, PIOA_LCD_RESET, PAL_MODE_OUTPUT_PUSHPULL); + palSetPad(IOPORT1, PIOA_LCD_RESET); + palSetPadMode(IOPORT1, PIOA_LCD_RESET, PAL_MODE_OUTPUT_PUSHPULL); /* * Joystick and buttons setup. */ - palSetGroupMode(IOPORT_A, + palSetGroupMode(IOPORT1, PIOA_B1_MASK | PIOA_B2_MASK | PIOA_B3_MASK | PIOA_B4_MASK | PIOA_B5_MASK, PAL_MODE_INPUT); - palSetGroupMode(IOPORT_B, PIOB_SW1_MASK | PIOB_SW2_MASK, PAL_MODE_INPUT); + palSetGroupMode(IOPORT2, PIOB_SW1_MASK | PIOB_SW2_MASK, PAL_MODE_INPUT); /* * MMC/SD slot setup. */ - palSetGroupMode(IOPORT_B, + palSetGroupMode(IOPORT2, PIOB_MMC_WP_MASK | PIOB_MMC_CP_MASK, PAL_MODE_INPUT); diff --git a/demos/ARM7-AT91SAM7X-GCC/main.c b/demos/ARM7-AT91SAM7X-GCC/main.c index d1ca61cc7..f6c297a41 100644 --- a/demos/ARM7-AT91SAM7X-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-GCC/main.c @@ -28,9 +28,9 @@ static WORKING_AREA(waThread1, 64); static msg_t Thread1(void *arg) { while (TRUE) { - palSetPad(IOPORT_B, PIOB_LCD_BL); + palSetPad(IOPORT2, PIOB_LCD_BL); chThdSleepMilliseconds(100); - palClearPad(IOPORT_B, PIOB_LCD_BL); + palClearPad(IOPORT2, PIOB_LCD_BL); chThdSleepMilliseconds(900); } return 0; @@ -43,9 +43,9 @@ static msg_t Thread1(void *arg) { int main(int argc, char **argv) { /* - * Activates the communication port 1 using the driver default configuration. + * Activates the serial driver 1 using the driver default configuration. */ - sdStart(&COM1, NULL); + sdStart(&SD1, NULL); /* * Creates the blinker thread. @@ -57,10 +57,10 @@ int main(int argc, char **argv) { */ while (TRUE) { chThdSleepMilliseconds(500); - if (!palReadPad(IOPORT_B, PIOB_SW1)) - sdWrite(&COM1, (uint8_t *)"Hello World!\r\n", 14); - if (!palReadPad(IOPORT_B, PIOB_SW2)) - TestThread(&COM1); + if (!palReadPad(IOPORT2, PIOB_SW1)) + sdWrite(&SD1, (uint8_t *)"Hello World!\r\n", 14); + if (!palReadPad(IOPORT2, PIOB_SW2)) + TestThread(&SD1); } return 0; diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/board.c b/demos/ARM7-AT91SAM7X-WEB-GCC/board.c index 51efb3c6d..e57f8bcdc 100644 --- a/demos/ARM7-AT91SAM7X-WEB-GCC/board.c +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/board.c @@ -135,25 +135,25 @@ void hwinit1(void) { /* * LCD pins setup. */ - palClearPad(IOPORT_B, PIOB_LCD_BL); - palSetPadMode(IOPORT_B, PIOB_LCD_BL, PAL_MODE_OUTPUT_PUSHPULL); + palClearPad(IOPORT2, PIOB_LCD_BL); + palSetPadMode(IOPORT2, PIOB_LCD_BL, PAL_MODE_OUTPUT_PUSHPULL); - palSetPad(IOPORT_A, PIOA_LCD_RESET); - palSetPadMode(IOPORT_A, PIOA_LCD_RESET, PAL_MODE_OUTPUT_PUSHPULL); + palSetPad(IOPORT1, PIOA_LCD_RESET); + palSetPadMode(IOPORT1, PIOA_LCD_RESET, PAL_MODE_OUTPUT_PUSHPULL); /* * Joystick and buttons setup. */ - palSetGroupMode(IOPORT_A, + palSetGroupMode(IOPORT1, PIOA_B1_MASK | PIOA_B2_MASK | PIOA_B3_MASK | PIOA_B4_MASK | PIOA_B5_MASK, PAL_MODE_INPUT); - palSetGroupMode(IOPORT_B, PIOB_SW1_MASK | PIOB_SW2_MASK, PAL_MODE_INPUT); + palSetGroupMode(IOPORT2, PIOB_SW1_MASK | PIOB_SW2_MASK, PAL_MODE_INPUT); /* * MMC/SD slot setup. */ - palSetGroupMode(IOPORT_B, + palSetGroupMode(IOPORT2, PIOB_MMC_WP_MASK | PIOB_MMC_CP_MASK, PAL_MODE_INPUT); diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/main.c b/demos/ARM7-AT91SAM7X-WEB-GCC/main.c index e18d83d71..adfba225f 100644 --- a/demos/ARM7-AT91SAM7X-WEB-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/main.c @@ -33,9 +33,9 @@ static WORKING_AREA(waThread1, 64); static msg_t Thread1(void *arg) { while (TRUE) { - palSetPad(IOPORT_B, PIOB_LCD_BL); + palSetPad(IOPORT2, PIOB_LCD_BL); chThdSleepMilliseconds(100); - palClearPad(IOPORT_B, PIOB_LCD_BL); + palClearPad(IOPORT2, PIOB_LCD_BL); chThdSleepMilliseconds(900); } return 0; @@ -48,9 +48,9 @@ static msg_t Thread1(void *arg) { int main(int argc, char **argv) { /* - * Activates the communication port 1 using the driver default configuration. + * Activates the serial driver 2 using the driver default configuration. */ - sdStart(&COM1, NULL); + sdStart(&SD1, NULL); /* * Creates the blinker and web server threads. @@ -63,10 +63,10 @@ int main(int argc, char **argv) { */ while (TRUE) { chThdSleepMilliseconds(500); - if (!palReadPad(IOPORT_B, PIOB_SW1)) - sdWrite(&COM1, (uint8_t *)"Hello World!\r\n", 14); - if (!palReadPad(IOPORT_B, PIOB_SW2)) - TestThread(&COM1); + if (!palReadPad(IOPORT2, PIOB_SW1)) + sdWrite(&SD1, (uint8_t *)"Hello World!\r\n", 14); + if (!palReadPad(IOPORT2, PIOB_SW2)) + TestThread(&SD1); } return 0; diff --git a/demos/ARM7-LPC214x-G++/main.cpp b/demos/ARM7-LPC214x-G++/main.cpp index b217e86a2..b46ccd86e 100644 --- a/demos/ARM7-LPC214x-G++/main.cpp +++ b/demos/ARM7-LPC214x-G++/main.cpp @@ -99,10 +99,10 @@ protected: case STOP: return 0; case BITCLEAR: - palClearPort(IOPORT_A, curr->value); + palClearPort(IOPORT1, curr->value); break; case BITSET: - palSetPort(IOPORT_A, curr->value); + palSetPort(IOPORT1, curr->value); break; } curr++; @@ -124,7 +124,7 @@ class TesterThread : public EnhancedThread<128> { protected: virtual msg_t Main(void) { - return TestThread(&COM1); + return TestThread(&SD1); } public: @@ -137,7 +137,7 @@ public: */ static void TimerHandler(eventid_t id) { - if (!(palReadPort(IOPORT_A) & BOTH_BUTTONS)) { // Both buttons + if (!(palReadPort(IOPORT1) & BOTH_BUTTONS)) { // Both buttons TesterThread tester; tester.Wait(); }; @@ -155,9 +155,9 @@ int main(int argc, char **argv) { struct EventListener el0; /* - * Activates the communication port 1 using the driver default configuration. + * Activates the serial driver 2 using the driver default configuration. */ - sdStart(&COM1, NULL); + sdStart(&SD1, NULL); evtInit(&evt, 500); // Initializes an event timer. evtStart(&evt); // Starts the event timer. diff --git a/demos/ARM7-LPC214x-GCC-minimal/main.c b/demos/ARM7-LPC214x-GCC-minimal/main.c index 83d192b91..d303237c4 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/main.c +++ b/demos/ARM7-LPC214x-GCC-minimal/main.c @@ -29,13 +29,13 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) { while (TRUE) { - palClearPort(IOPORT_A, PAL_PORT_BIT(PA_LED2)); + palClearPort(IOPORT1, PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(200); - palSetPort(IOPORT_A, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); + palSetPort(IOPORT1, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(800); - palClearPort(IOPORT_A, PAL_PORT_BIT(PA_LED1)); + palClearPort(IOPORT1, PAL_PORT_BIT(PA_LED1)); chThdSleepMilliseconds(200); - palSetPort(IOPORT_A, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); + palSetPort(IOPORT1, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(800); } return 0; @@ -48,9 +48,9 @@ static WORKING_AREA(waThread2, 128); static msg_t Thread2(void *arg) { while (TRUE) { - palClearPad(IOPORT_A, PA_LEDUSB); + palClearPad(IOPORT1, PA_LEDUSB); chThdSleepMilliseconds(200); - palSetPad(IOPORT_A, PA_LEDUSB); + palSetPad(IOPORT1, PA_LEDUSB); chThdSleepMilliseconds(300); } return 0; diff --git a/demos/ARM7-LPC214x-GCC/main.c b/demos/ARM7-LPC214x-GCC/main.c index 33197c2cb..a8db1b667 100644 --- a/demos/ARM7-LPC214x-GCC/main.c +++ b/demos/ARM7-LPC214x-GCC/main.c @@ -36,13 +36,13 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) { while (TRUE) { - palClearPort(IOPORT_A, PAL_PORT_BIT(PA_LED2)); + palClearPort(IOPORT1, PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(200); - palSetPort(IOPORT_A, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); + palSetPort(IOPORT1, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(800); - palClearPort(IOPORT_A, PAL_PORT_BIT(PA_LED1)); + palClearPort(IOPORT1, PAL_PORT_BIT(PA_LED1)); chThdSleepMilliseconds(200); - palSetPort(IOPORT_A, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); + palSetPort(IOPORT1, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(800); } return 0; @@ -55,9 +55,9 @@ static WORKING_AREA(waThread2, 128); static msg_t Thread2(void *arg) { while (TRUE) { - palClearPad(IOPORT_A, PA_LEDUSB); + palClearPad(IOPORT1, PA_LEDUSB); chThdSleepMilliseconds(200); - palSetPad(IOPORT_A, PA_LEDUSB); + palSetPad(IOPORT1, PA_LEDUSB); chThdSleepMilliseconds(300); } return 0; @@ -70,17 +70,17 @@ static WORKING_AREA(waTestThread, 128); */ static void TimerHandler(eventid_t id) { - if (!(palReadPort(IOPORT_A) & BOTH_BUTTONS)) { + if (!(palReadPort(IOPORT1) & BOTH_BUTTONS)) { Thread *tp = chThdCreateStatic(waTestThread, sizeof(waTestThread), - NORMALPRIO, TestThread, &COM1); + NORMALPRIO, TestThread, &SD1); chThdWait(tp); PlaySound(500, MS2ST(100)); } else { - if (!palReadPad(IOPORT_A, PA_BUTTON1)) + if (!palReadPad(IOPORT1, PA_BUTTON1)) PlaySound(1000, MS2ST(100)); - if (!palReadPad(IOPORT_A, PA_BUTTON2)) { - sdWrite(&COM1, (uint8_t *)"Hello World!\r\n", 14); + if (!palReadPad(IOPORT1, PA_BUTTON2)) { + sdWrite(&SD1, (uint8_t *)"Hello World!\r\n", 14); PlaySound(2000, MS2ST(100)); } } @@ -129,15 +129,15 @@ int main(int argc, char **argv) { struct EventListener el0, el1, el2; /* - * Activates the communication port 1 using the driver default configuration. + * Activates the serial driver 2 using the driver default configuration. */ - sdStart(&COM1, NULL); + sdStart(&SD1, NULL); /* * If a button is pressed during the reset then the blinking leds threads * are not started in order to make accurate benchmarks. */ - if ((palReadPort(IOPORT_A) & BOTH_BUTTONS) == BOTH_BUTTONS) { + if ((palReadPort(IOPORT1) & BOTH_BUTTONS) == BOTH_BUTTONS) { chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL); } diff --git a/demos/ARM7-LPC214x-GCC/mmcsd.c b/demos/ARM7-LPC214x-GCC/mmcsd.c index 98ff2a23b..aba532544 100644 --- a/demos/ARM7-LPC214x-GCC/mmcsd.c +++ b/demos/ARM7-LPC214x-GCC/mmcsd.c @@ -43,7 +43,7 @@ void InitMMC(void) { void tmrfunc(void *par) { if (cnt) { - if (!palReadPad(IOPORT_B, PB_CP1)) { + if (!palReadPad(IOPORT2, PB_CP1)) { if (!--cnt) chEvtBroadcastI(&MMCInsertEventSource); } @@ -51,7 +51,7 @@ void tmrfunc(void *par) { cnt = POLLING_INTERVAL; } else { - if (palReadPad(IOPORT_B, PB_CP1)) { + if (palReadPad(IOPORT2, PB_CP1)) { cnt = POLLING_INTERVAL; chEvtBroadcastI(&MMCRemoveEventSource); } diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c index d1f78f7e8..ca2fa842b 100644 --- a/demos/ARMCM3-STM32F103-GCC/main.c +++ b/demos/ARMCM3-STM32F103-GCC/main.c @@ -31,9 +31,9 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) { while (TRUE) { - palClearPad(IOPORT_C, GPIOC_LED); + palClearPad(IOPORT3, GPIOC_LED); chThdSleepMilliseconds(500); - palSetPad(IOPORT_C, GPIOC_LED); + palSetPad(IOPORT3, GPIOC_LED); chThdSleepMilliseconds(500); } return 0; @@ -46,9 +46,9 @@ static msg_t Thread1(void *arg) { int main(int argc, char **argv) { /* - * Activates the communication port 2 using the driver default configuration. + * Activates the serial driver 2 using the driver default configuration. */ - sdStart(&COM2, NULL); + sdStart(&SD2, NULL); /* * Creates the blinker thread. @@ -60,8 +60,8 @@ int main(int argc, char **argv) { * sleeping in a loop and check the button state. */ while (TRUE) { - if (palReadPad(IOPORT_A, GPIOA_BUTTON)) - TestThread(&COM2); + if (palReadPad(IOPORT1, GPIOA_BUTTON)) + TestThread(&SD2); chThdSleepMilliseconds(500); } return 0; diff --git a/demos/MSP430-MSP430x1611-GCC/main.c b/demos/MSP430-MSP430x1611-GCC/main.c index d52f2bb07..02622e817 100644 --- a/demos/MSP430-MSP430x1611-GCC/main.c +++ b/demos/MSP430-MSP430x1611-GCC/main.c @@ -31,9 +31,9 @@ static WORKING_AREA(waThread1, 64); static msg_t Thread1(void *arg) { while (TRUE) { - palSetPad(IOPORT_F, P6_O_LED); + palSetPad(IOPORT6, P6_O_LED); chThdSleepMilliseconds(500); - palClearPad(IOPORT_F, P6_O_LED); + palClearPad(IOPORT6, P6_O_LED); chThdSleepMilliseconds(500); } return 0; @@ -50,9 +50,9 @@ int main(int argc, char **argv) { hwinit(); /* - * Activates the communication port 1 using the driver default configuration. + * Activates the serial driver 2 using the driver default configuration. */ - sdStart(&COM1, NULL); + sdStart(&SD1, NULL); /* * The main() function becomes a thread here then the interrupts are @@ -70,8 +70,8 @@ int main(int argc, char **argv) { * sleeping in a loop. */ while (TRUE) { - if (!palReadPad(IOPORT_F, P6_I_BUTTON)) - TestThread(&COM1); + if (!palReadPad(IOPORT6, P6_I_BUTTON)) + TestThread(&SD1); chThdSleepMilliseconds(500); } return 0; diff --git a/docs/reports/STM32F103-72.txt b/docs/reports/STM32F103-72.txt index 2aeee176d..73ceeffa0 100644 --- a/docs/reports/STM32F103-72.txt +++ b/docs/reports/STM32F103-72.txt @@ -5,7 +5,7 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) *** ChibiOS/RT test suite *** -*** Kernel: 1.3.1unstable +*** Kernel: 1.3.2unstable *** Architecture: ARM Cortex-M3 *** GCC Version: 4.3.3 @@ -71,7 +71,7 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 7.1 (Heap, allocation and fragmentation test) ---- Size : 16324 bytes, not fragmented +--- Size : 16408 bytes, not fragmented --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 8.1 (Memory Pools, queue/dequeue) @@ -89,54 +89,48 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Test Case 10.2 (Queues, output queues) --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 11.1 (Serial driver, synchronous) ---- Result: SUCCESS ----------------------------------------------------------------------------- ---- Test Case 11.2 (Serial driver, asynchronous) ---- Result: SUCCESS ----------------------------------------------------------------------------- ---- Test Case 12.1 (Benchmark, messages #1) +--- Test Case 11.1 (Benchmark, messages #1) --- Score : 215037 msgs/S, 430074 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.2 (Benchmark, messages #2) +--- Test Case 11.2 (Benchmark, messages #2) --- Score : 174744 msgs/S, 349488 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.3 (Benchmark, messages #3) +--- Test Case 11.3 (Benchmark, messages #3) --- Score : 174744 msgs/S, 349488 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.4 (Benchmark, context switch) +--- Test Case 11.4 (Benchmark, context switch) --- Score : 676760 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.5 (Benchmark, threads, full cycle) +--- Test Case 11.5 (Benchmark, threads, full cycle) --- Score : 164727 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.6 (Benchmark, threads, create only) +--- Test Case 11.6 (Benchmark, threads, create only) --- Score : 215680 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.7 (Benchmark, mass reschedulation, 5 threads) +--- Test Case 11.7 (Benchmark, mass reschedulation, 5 threads) --- Score : 54745 reschedulations/S, 328470 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.8 (Benchmark, I/O Queues throughput) ---- Score : 474884 bytes/S +--- Test Case 11.8 (Benchmark, I/O Queues throughput) +--- Score : 474888 bytes/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.9 (Benchmark, virtual timers set/reset) ---- Score : 647072 timers/S +--- Test Case 11.9 (Benchmark, virtual timers set/reset) +--- Score : 647070 timers/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.10 (Benchmark, semaphores wait/signal) +--- Test Case 11.10 (Benchmark, semaphores wait/signal) --- Score : 823264 wait+signal/S --- Result: SUCCESS ---------------------------------------------------------------------------- ---- Test Case 12.11 (Benchmark, mutexes lock/unlock) ---- Score : 601088 lock+unlock/S +--- Test Case 11.11 (Benchmark, mutexes lock/unlock) +--- Score : 601084 lock+unlock/S --- Result: SUCCESS ---------------------------------------------------------------------------- diff --git a/os/io/platforms/AT91SAM7X/pal_lld.h b/os/io/platforms/AT91SAM7X/pal_lld.h index 1f50b5734..c00007fc3 100644 --- a/os/io/platforms/AT91SAM7X/pal_lld.h +++ b/os/io/platforms/AT91SAM7X/pal_lld.h @@ -90,12 +90,12 @@ typedef AT91PS_PIO ioportid_t; /** * @brief PIO port A identifier. */ -#define IOPORT_A AT91C_BASE_PIOA +#define IOPORT1 AT91C_BASE_PIOA /** * @brief PIO port B identifier. */ -#define IOPORT_B AT91C_BASE_PIOB +#define IOPORT2 AT91C_BASE_PIOB /*===========================================================================*/ /* Implementation, some of the following macros could be implemented as */ diff --git a/os/io/platforms/AT91SAM7X/serial_lld.c b/os/io/platforms/AT91SAM7X/serial_lld.c index e053aac13..282ebbf7a 100644 --- a/os/io/platforms/AT91SAM7X/serial_lld.c +++ b/os/io/platforms/AT91SAM7X/serial_lld.c @@ -31,12 +31,12 @@ #if USE_SAM7X_USART0 || defined(__DOXYGEN__) /** @brief USART0 serial driver identifier.*/ -SerialDriver COM1; +SerialDriver SD1; #endif #if USE_SAM7X_USART1 || defined(__DOXYGEN__) /** @brief USART1 serial driver identifier.*/ -SerialDriver COM2; +SerialDriver SD2; #endif /** @brief Driver default configuration.*/ @@ -165,7 +165,7 @@ CH_IRQ_HANDLER(USART0IrqHandler) { CH_IRQ_PROLOGUE(); - serve_interrupt(AT91C_BASE_US0, &COM1); + serve_interrupt(AT91C_BASE_US0, &SD1); CH_IRQ_EPILOGUE(); } @@ -176,7 +176,7 @@ CH_IRQ_HANDLER(USART1IrqHandler) { CH_IRQ_PROLOGUE(); - serve_interrupt(AT91C_BASE_US1, &COM2); + serve_interrupt(AT91C_BASE_US1, &SD2); CH_IRQ_EPILOGUE(); } @@ -192,7 +192,7 @@ CH_IRQ_HANDLER(USART1IrqHandler) { void sd_lld_init(void) { #if USE_SAM7X_USART0 - sdObjectInit(&COM1, NULL, notify1); + sdObjectInit(&SD1, NULL, notify1); AT91C_BASE_PIOA->PIO_PDR = AT91C_PA0_RXD0 | AT91C_PA1_TXD0; AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA0 | AT91C_PIO_PA1; AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA0 | AT91C_PIO_PA1; @@ -202,7 +202,7 @@ void sd_lld_init(void) { #endif #if USE_SAM7X_USART1 - sdObjectInit(&COM2, NULL, notify2); + sdObjectInit(&SD2, NULL, notify2); AT91C_BASE_PIOA->PIO_PDR = AT91C_PA5_RXD1 | AT91C_PA6_TXD1; AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA5 | AT91C_PIO_PA6; AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA5 | AT91C_PIO_PA6; @@ -226,7 +226,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { config = &default_config; #if USE_SAM7X_USART0 - if (&COM1 == sdp) { + if (&SD1 == sdp) { /* Starts the clock and clears possible sources of immediate interrupts.*/ AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_US0); /* USART initialization.*/ @@ -237,7 +237,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { } #endif #if USE_SAM7X_USART1 - if (&COM2 == sdp) { + if (&SD2 == sdp) { /* Starts the clock and clears possible sources of immediate interrupts.*/ AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_US1); /* USART initialization.*/ @@ -259,7 +259,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { void sd_lld_stop(SerialDriver *sdp) { #if USE_LPC214x_UART1 - if (&COM1 == sdp) { + if (&SD1 == sdp) { usart_deinit(AT91C_BASE_US0); AT91C_BASE_PMC->PMC_PCDR = (1 << AT91C_ID_US0); AIC_DisableIT(AT91C_ID_US0); @@ -267,7 +267,7 @@ void sd_lld_stop(SerialDriver *sdp) { } #endif #if USE_LPC214x_UART2 - if (&COM2 == sdp) { + if (&SD2 == sdp) { usart_deinit(AT91C_BASE_US1); AT91C_BASE_PMC->PMC_PCDR = (1 << AT91C_ID_US1); AIC_DisableIT(AT91C_ID_US1); diff --git a/os/io/platforms/AT91SAM7X/serial_lld.h b/os/io/platforms/AT91SAM7X/serial_lld.h index f6f704e95..639c4055d 100644 --- a/os/io/platforms/AT91SAM7X/serial_lld.h +++ b/os/io/platforms/AT91SAM7X/serial_lld.h @@ -139,10 +139,10 @@ typedef struct { /** @cond never*/ #if USE_SAM7X_USART0 -extern SerialDriver COM1; +extern SerialDriver SD1; #endif #if USE_SAM7X_USART1 -extern SerialDriver COM2; +extern SerialDriver SD2; #endif #ifdef __cplusplus diff --git a/os/io/platforms/LPC214x/lpc214x_ssp.c b/os/io/platforms/LPC214x/lpc214x_ssp.c index fb7b70183..af9915395 100644 --- a/os/io/platforms/LPC214x/lpc214x_ssp.c +++ b/os/io/platforms/LPC214x/lpc214x_ssp.c @@ -44,7 +44,7 @@ void sspAcquireBus(void) { #if LPC214x_SSP_USE_MUTEX chSemWait(&me); #endif - palClearPad(IOPORT_A, 20); + palClearPad(IOPORT1, 20); } /** @@ -54,7 +54,7 @@ void sspAcquireBus(void) { */ void sspReleaseBus(void) { - palClearPad(IOPORT_A, 20); + palClearPad(IOPORT1, 20); #if LPC214x_SSP_USE_MUTEX chSemSignal(&me); #endif diff --git a/os/io/platforms/LPC214x/pal_lld.h b/os/io/platforms/LPC214x/pal_lld.h index 50e0ff4a5..4547abc61 100644 --- a/os/io/platforms/LPC214x/pal_lld.h +++ b/os/io/platforms/LPC214x/pal_lld.h @@ -93,12 +93,12 @@ typedef FIO * ioportid_t; /** * @brief FIO port 0 identifier. */ -#define IOPORT_A FIO0Base +#define IOPORT1 FIO0Base /** * @brief FIO port 1 identifier. */ -#define IOPORT_B FIO1Base +#define IOPORT2 FIO1Base /*===========================================================================*/ /* Implementation, some of the following macros could be implemented as */ diff --git a/os/io/platforms/LPC214x/serial_lld.c b/os/io/platforms/LPC214x/serial_lld.c index 09884a3fe..b97d42185 100644 --- a/os/io/platforms/LPC214x/serial_lld.c +++ b/os/io/platforms/LPC214x/serial_lld.c @@ -32,12 +32,12 @@ #if USE_LPC214x_UART0 || defined(__DOXYGEN__) /** @brief UART0 serial driver identifier.*/ -SerialDriver COM1; +SerialDriver SD1; #endif #if USE_LPC214x_UART1 || defined(__DOXYGEN__) /** @brief UART1 serial driver identifier.*/ -SerialDriver COM2; +SerialDriver SD2; #endif /** @brief Driver default configuration.*/ @@ -199,13 +199,13 @@ static void preload(UART *u, SerialDriver *sdp) { static void notify1(void) { #if UART_FIFO_PRELOAD > 0 - preload(U0Base, &COM1); + preload(U0Base, &SD1); #else UART *u = U0Base; if (u->UART_LSR & LSR_THRE) { chSysLockFromIsr(); - u->UART_THR = chOQGetI(&COM1.sd_oqueue); + u->UART_THR = chOQGetI(&SD1.sd_oqueue); chSysUnlockFromIsr(); } u->UART_IER |= IER_THRE; @@ -217,12 +217,12 @@ static void notify1(void) { static void notify2(void) { #if UART_FIFO_PRELOAD > 0 - preload(U1Base, &COM2); + preload(U1Base, &SD2); #else UART *u = U1Base; if (u->UART_LSR & LSR_THRE) - u->UART_THR = chOQGetI(&COM2.sd_oqueue); + u->UART_THR = chOQGetI(&SD2.sd_oqueue); u->UART_IER |= IER_THRE; #endif } @@ -237,7 +237,7 @@ CH_IRQ_HANDLER(UART0IrqHandler) { CH_IRQ_PROLOGUE(); - serve_interrupt(U0Base, &COM1); + serve_interrupt(U0Base, &SD1); VICVectAddr = 0; CH_IRQ_EPILOGUE(); @@ -249,7 +249,7 @@ CH_IRQ_HANDLER(UART1IrqHandler) { CH_IRQ_PROLOGUE(); - serve_interrupt(U1Base, &COM2); + serve_interrupt(U1Base, &SD2); VICVectAddr = 0; CH_IRQ_EPILOGUE(); @@ -267,11 +267,11 @@ CH_IRQ_HANDLER(UART1IrqHandler) { void sd_lld_init(void) { #if USE_LPC214x_UART0 - sdObjectInit(&COM1, NULL, notify1); + sdObjectInit(&SD1, NULL, notify1); SetVICVector(UART0IrqHandler, LPC214x_UART1_PRIORITY, SOURCE_UART0); #endif #if USE_LPC214x_UART1 - sdObjectInit(&COM2, NULL, notify2); + sdObjectInit(&SD2, NULL, notify2); SetVICVector(UART1IrqHandler, LPC214x_UART2_PRIORITY, SOURCE_UART1); #endif } @@ -290,7 +290,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { config = &default_config; #if USE_LPC214x_UART1 - if (&COM1 == sdp) { + if (&SD1 == sdp) { PCONP = (PCONP & PCALL) | PCUART0; uart_init(U0Base, config); VICIntEnable = INTMASK(SOURCE_UART0); @@ -298,7 +298,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { } #endif #if USE_LPC214x_UART2 - if (&COM2 == sdp) { + if (&SD2 == sdp) { PCONP = (PCONP & PCALL) | PCUART1; uart_init(U1Base, config); VICIntEnable = INTMASK(SOURCE_UART1); @@ -317,7 +317,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { void sd_lld_stop(SerialDriver *sdp) { #if USE_LPC214x_UART1 - if (&COM1 == sdp) { + if (&SD1 == sdp) { uart_deinit(U0Base); PCONP = (PCONP & PCALL) & ~PCUART0; VICIntEnClear = INTMASK(SOURCE_UART0); @@ -325,7 +325,7 @@ void sd_lld_stop(SerialDriver *sdp) { } #endif #if USE_LPC214x_UART2 - if (&COM2 == sdp) { + if (&SD2 == sdp) { uart_deinit(U1Base); PCONP = (PCONP & PCALL) & ~PCUART1; VICIntEnClear = INTMASK(SOURCE_UART1); diff --git a/os/io/platforms/LPC214x/serial_lld.h b/os/io/platforms/LPC214x/serial_lld.h index b543d844c..d4bc6d01d 100644 --- a/os/io/platforms/LPC214x/serial_lld.h +++ b/os/io/platforms/LPC214x/serial_lld.h @@ -156,10 +156,10 @@ typedef struct { /** @cond never*/ #if USE_LPC214x_UART0 -extern SerialDriver COM1; +extern SerialDriver SD1; #endif #if USE_LPC214x_UART1 -extern SerialDriver COM2; +extern SerialDriver SD2; #endif #ifdef __cplusplus diff --git a/os/io/platforms/MSP430/pal_lld.c b/os/io/platforms/MSP430/pal_lld.c index 885a58dbc..227853a12 100644 --- a/os/io/platforms/MSP430/pal_lld.c +++ b/os/io/platforms/MSP430/pal_lld.c @@ -38,43 +38,43 @@ void _pal_lld_init(const MSP430DIOConfig *config) { #if defined(__MSP430_HAS_PORT1__) || defined(__MSP430_HAS_PORT1_R__) - IOPORT_A->iop_full.ie.reg_p = 0; - IOPORT_A->iop_full.ifg.reg_p = 0; - IOPORT_A->iop_full.sel.reg_p = 0; - IOPORT_A->iop_common.out = config->P1Data.out; - IOPORT_A->iop_common.dir = config->P1Data.dir; + IOPORT1->iop_full.ie.reg_p = 0; + IOPORT1->iop_full.ifg.reg_p = 0; + IOPORT1->iop_full.sel.reg_p = 0; + IOPORT1->iop_common.out = config->P1Data.out; + IOPORT1->iop_common.dir = config->P1Data.dir; #endif #if defined(__MSP430_HAS_PORT2__) || defined(__MSP430_HAS_PORT2_R__) - IOPORT_B->iop_full.ie.reg_p = 0; - IOPORT_B->iop_full.ifg.reg_p = 0; - IOPORT_B->iop_full.sel.reg_p = 0; - IOPORT_B->iop_common.out = config->P2Data.out; - IOPORT_B->iop_common.dir = config->P2Data.dir; + IOPORT2->iop_full.ie.reg_p = 0; + IOPORT2->iop_full.ifg.reg_p = 0; + IOPORT2->iop_full.sel.reg_p = 0; + IOPORT2->iop_common.out = config->P2Data.out; + IOPORT2->iop_common.dir = config->P2Data.dir; #endif #if defined(__MSP430_HAS_PORT3__) || defined(__MSP430_HAS_PORT3_R__) - IOPORT_C->iop_simple.sel.reg_p = 0; - IOPORT_C->iop_common.out = config->P3Data.out; - IOPORT_C->iop_common.dir = config->P3Data.dir; + IOPORT3->iop_simple.sel.reg_p = 0; + IOPORT3->iop_common.out = config->P3Data.out; + IOPORT3->iop_common.dir = config->P3Data.dir; #endif #if defined(__MSP430_HAS_PORT4__) || defined(__MSP430_HAS_PORT4_R__) - IOPORT_D->iop_simple.sel.reg_p = 0; - IOPORT_D->iop_common.out = config->P4Data.out; - IOPORT_D->iop_common.dir = config->P4Data.dir; + IOPORT4->iop_simple.sel.reg_p = 0; + IOPORT4->iop_common.out = config->P4Data.out; + IOPORT4->iop_common.dir = config->P4Data.dir; #endif #if defined(__MSP430_HAS_PORT5__) || defined(__MSP430_HAS_PORT5_R__) - IOPORT_E->iop_simple.sel.reg_p = 0; - IOPORT_E->iop_common.out = config->P5Data.out; - IOPORT_E->iop_common.dir = config->P5Data.dir; + IOPORT5->iop_simple.sel.reg_p = 0; + IOPORT5->iop_common.out = config->P5Data.out; + IOPORT5->iop_common.dir = config->P5Data.dir; #endif #if defined(__MSP430_HAS_PORT6__) || defined(__MSP430_HAS_PORT6_R__) - IOPORT_F->iop_simple.sel.reg_p = 0; - IOPORT_F->iop_common.out = config->P6Data.out; - IOPORT_F->iop_common.dir = config->P6Data.dir; + IOPORT6->iop_simple.sel.reg_p = 0; + IOPORT6->iop_common.out = config->P6Data.out; + IOPORT6->iop_common.dir = config->P6Data.dir; #endif } diff --git a/os/io/platforms/MSP430/pal_lld.h b/os/io/platforms/MSP430/pal_lld.h index 94407a849..91c0707c1 100644 --- a/os/io/platforms/MSP430/pal_lld.h +++ b/os/io/platforms/MSP430/pal_lld.h @@ -150,7 +150,7 @@ typedef union __ioport * ioportid_t; #if defined(__MSP430_HAS_PORT1__) || \ defined(__MSP430_HAS_PORT1_R__) || \ defined(__DOXYGEN__) -#define IOPORT_A ((ioportid_t)0x0020) +#define IOPORT1 ((ioportid_t)0x0020) #endif /** @@ -160,7 +160,7 @@ typedef union __ioport * ioportid_t; #if defined(__MSP430_HAS_PORT2__) || \ defined(__MSP430_HAS_PORT2_R__) || \ defined(__DOXYGEN__) -#define IOPORT_B ((ioportid_t)0x0028) +#define IOPORT2 ((ioportid_t)0x0028) #endif /** @@ -170,7 +170,7 @@ typedef union __ioport * ioportid_t; #if defined(__MSP430_HAS_PORT3__) || \ defined(__MSP430_HAS_PORT3_R__) || \ defined(__DOXYGEN__) -#define IOPORT_C ((ioportid_t)0x0018) +#define IOPORT3 ((ioportid_t)0x0018) #endif /** @@ -180,7 +180,7 @@ typedef union __ioport * ioportid_t; #if defined(__MSP430_HAS_PORT4__) || \ defined(__MSP430_HAS_PORT4_R__) || \ defined(__DOXYGEN__) -#define IOPORT_D ((ioportid_t)0x001c) +#define IOPORT4 ((ioportid_t)0x001c) #endif /** @@ -190,7 +190,7 @@ typedef union __ioport * ioportid_t; #if defined(__MSP430_HAS_PORT5__) || \ defined(__MSP430_HAS_PORT5_R__) || \ defined(__DOXYGEN__) -#define IOPORT_E ((ioportid_t)0x0030) +#define IOPORT5 ((ioportid_t)0x0030) #endif /** @@ -200,7 +200,7 @@ typedef union __ioport * ioportid_t; #if defined(__MSP430_HAS_PORT6__) || \ defined(__MSP430_HAS_PORT6_R__) || \ defined(__DOXYGEN__) -#define IOPORT_F ((ioportid_t)0x0034) +#define IOPORT6 ((ioportid_t)0x0034) #endif /*===========================================================================*/ diff --git a/os/io/platforms/MSP430/serial_lld.c b/os/io/platforms/MSP430/serial_lld.c index c62920480..1c9504097 100644 --- a/os/io/platforms/MSP430/serial_lld.c +++ b/os/io/platforms/MSP430/serial_lld.c @@ -33,11 +33,11 @@ #if USE_MSP430_USART0 || defined(__DOXYGEN__) /** @brief USART0 serial driver identifier.*/ -SerialDriver COM1; +SerialDriver SD1; #endif #if USE_MSP430_USART1 || defined(__DOXYGEN__) /** @brief USART1 serial driver identifier.*/ -SerialDriver COM2; +SerialDriver SD2; #endif /** @brief Driver default configuration.*/ @@ -72,7 +72,7 @@ static void notify1(void) { if (!(U0IE & UTXIE0)) { chSysLockFromIsr(); - U0TXBUF = (uint8_t)sdRequestDataI(&COM1); + U0TXBUF = (uint8_t)sdRequestDataI(&SD1); chSysUnlockFromIsr(); U0IE |= UTXIE0; } @@ -113,7 +113,7 @@ void usart0_deinit(void) { static void notify2(void) { if (!(U1IE & UTXIE1)) { - U1TXBUF = (uint8_t)sdRequestDataI(&COM2); + U1TXBUF = (uint8_t)sdRequestDataI(&SD2); U1IE |= UTXIE1; } } @@ -160,7 +160,7 @@ CH_IRQ_HANDLER(USART0TX_VECTOR) { CH_IRQ_PROLOGUE(); chSysLockFromIsr(); - b = sdRequestDataI(&COM1); + b = sdRequestDataI(&SD1); chSysUnlockFromIsr(); if (b < Q_OK) U0IE &= ~UTXIE0; @@ -176,9 +176,9 @@ CH_IRQ_HANDLER(USART0RX_VECTOR) { CH_IRQ_PROLOGUE(); if ((urctl = U0RCTL) & RXERR) - set_error(urctl, &COM1); + set_error(urctl, &SD1); chSysLockFromIsr(); - sdIncomingDataI(&COM1, U0RXBUF); + sdIncomingDataI(&SD1, U0RXBUF); chSysUnlockFromIsr(); CH_IRQ_EPILOGUE(); @@ -192,7 +192,7 @@ CH_IRQ_HANDLER(USART1TX_VECTOR) { CH_IRQ_PROLOGUE(); chSysLockFromIsr(); - b = sdRequestDataI(&COM2); + b = sdRequestDataI(&SD2); chSysUnlockFromIsr(); if (b < Q_OK) U1IE &= ~UTXIE1; @@ -208,9 +208,9 @@ CH_IRQ_HANDLER(USART1RX_VECTOR) { CH_IRQ_PROLOGUE(); if ((urctl = U1RCTL) & RXERR) - set_error(urctl, &COM2); + set_error(urctl, &SD2); chSysLockFromIsr(); - sdIncomingDataI(&COM2, U1RXBUF); + sdIncomingDataI(&SD2, U1RXBUF); chSysUnlockFromIsr(); CH_IRQ_EPILOGUE(); @@ -227,13 +227,13 @@ CH_IRQ_HANDLER(USART1RX_VECTOR) { void sd_lld_init(void) { #if USE_MSP430_USART0 - sdObjectInit(&COM1, NULL, notify1); + sdObjectInit(&SD1, NULL, notify1); /* I/O pins for USART0.*/ P3SEL |= BV(4) + BV(5); #endif #if USE_MSP430_USART1 - sdObjectInit(&COM2, NULL, notify2); + sdObjectInit(&SD2, NULL, notify2); /* I/O pins for USART1.*/ P3SEL |= BV(6) + BV(7); #endif @@ -253,13 +253,13 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { config = &default_config; #if USE_MSP430_USART0 - if (&COM1 == sdp) { + if (&SD1 == sdp) { usart0_init(config); return; } #endif #if USE_MSP430_USART1 - if (&COM2 == sdp) { + if (&SD2 == sdp) { usart1_init(config); return; } @@ -276,13 +276,13 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { void sd_lld_stop(SerialDriver *sdp) { #if USE_MSP430_USART0 - if (&COM1 == sdp) { + if (&SD1 == sdp) { usart0_deinit(); return; } #endif #if USE_MSP430_USART1 - if (&COM2 == sdp) { + if (&SD2 == sdp) { usart1_deinit(); return; } diff --git a/os/io/platforms/MSP430/serial_lld.h b/os/io/platforms/MSP430/serial_lld.h index d57cc3771..255376b83 100644 --- a/os/io/platforms/MSP430/serial_lld.h +++ b/os/io/platforms/MSP430/serial_lld.h @@ -141,10 +141,10 @@ typedef struct { /** @cond never*/ #if USE_MSP430_USART0 -extern SerialDriver COM1; +extern SerialDriver SD1; #endif #if USE_MSP430_USART1 -extern SerialDriver COM2; +extern SerialDriver SD2; #endif #ifdef __cplusplus diff --git a/os/io/platforms/STM32F103/pal_lld.c b/os/io/platforms/STM32F103/pal_lld.c index f2fad1360..c50efadc0 100644 --- a/os/io/platforms/STM32F103/pal_lld.c +++ b/os/io/platforms/STM32F103/pal_lld.c @@ -72,30 +72,30 @@ void _pal_lld_init(const STM32GPIOConfig *config) { RCC->APB2RSTR = APB2_RST_MASK; RCC->APB2RSTR = 0; - IOPORT_A->ODR = config->PAData.odr; - IOPORT_A->CRH = config->PAData.crh; - IOPORT_A->CRL = config->PAData.crl; - IOPORT_B->ODR = config->PBData.odr; - IOPORT_B->CRH = config->PBData.crh; - IOPORT_B->CRL = config->PBData.crl; - IOPORT_C->ODR = config->PCData.odr; - IOPORT_C->CRH = config->PCData.crh; - IOPORT_C->CRL = config->PCData.crl; - IOPORT_D->ODR = config->PDData.odr; - IOPORT_D->CRH = config->PDData.crh; - IOPORT_D->CRL = config->PDData.crl; + IOPORT1->ODR = config->PAData.odr; + IOPORT1->CRH = config->PAData.crh; + IOPORT1->CRL = config->PAData.crl; + IOPORT2->ODR = config->PBData.odr; + IOPORT2->CRH = config->PBData.crh; + IOPORT2->CRL = config->PBData.crl; + IOPORT3->ODR = config->PCData.odr; + IOPORT3->CRH = config->PCData.crh; + IOPORT3->CRL = config->PCData.crl; + IOPORT4->ODR = config->PDData.odr; + IOPORT4->CRH = config->PDData.crh; + IOPORT4->CRL = config->PDData.crl; #if !defined(STM32F10X_LD) || defined(__DOXYGEN__) - IOPORT_E->ODR = config->PEData.odr; - IOPORT_E->CRH = config->PEData.crh; - IOPORT_E->CRL = config->PEData.crl; + IOPORT5->ODR = config->PEData.odr; + IOPORT5->CRH = config->PEData.crh; + IOPORT5->CRL = config->PEData.crl; #endif #if defined(STM32F10X_HD) || defined(__DOXYGEN__) - IOPORT_F->ODR = config->PFData.odr; - IOPORT_F->CRH = config->PFData.crh; - IOPORT_F->CRL = config->PFData.crl; - IOPORT_G->ODR = config->PGData.odr; - IOPORT_G->CRH = config->PGData.crh; - IOPORT_G->CRL = config->PGData.crl; + IOPORT6->ODR = config->PFData.odr; + IOPORT6->CRH = config->PFData.crh; + IOPORT6->CRL = config->PFData.crl; + IOPORT7->ODR = config->PGData.odr; + IOPORT7->CRH = config->PGData.crh; + IOPORT7->CRL = config->PGData.crl; #endif } diff --git a/os/io/platforms/STM32F103/pal_lld.h b/os/io/platforms/STM32F103/pal_lld.h index 3a0811ac2..c1c65f85f 100644 --- a/os/io/platforms/STM32F103/pal_lld.h +++ b/os/io/platforms/STM32F103/pal_lld.h @@ -116,40 +116,40 @@ typedef GPIO_TypeDef * ioportid_t; /** * @brief GPIO port A identifier. */ -#define IOPORT_A GPIOA +#define IOPORT1 GPIOA /** * @brief GPIO port B identifier. */ -#define IOPORT_B GPIOB +#define IOPORT2 GPIOB /** * @brief GPIO port C identifier. */ -#define IOPORT_C GPIOC +#define IOPORT3 GPIOC /** * @brief GPIO port D identifier. */ -#define IOPORT_D GPIOD +#define IOPORT4 GPIOD /** * @brief GPIO port E identifier. */ #if !defined(STM32F10X_LD) || defined(__DOXYGEN__) -#define IOPORT_E GPIOE +#define IOPORT5 GPIOE #endif /** * @brief GPIO port F identifier. */ #if defined(STM32F10X_HD) || defined(__DOXYGEN__) -#define IOPORT_F GPIOF +#define IOPORT6 GPIOF /** * @brief GPIO port G identifier. */ -#define IOPORT_G GPIOG +#define IOPORT7 GPIOG #endif /*===========================================================================*/ diff --git a/os/io/platforms/STM32F103/serial_lld.c b/os/io/platforms/STM32F103/serial_lld.c index 09849605c..2a727dc43 100644 --- a/os/io/platforms/STM32F103/serial_lld.c +++ b/os/io/platforms/STM32F103/serial_lld.c @@ -32,17 +32,17 @@ #if USE_STM32_USART1 || defined(__DOXYGEN__) /** @brief USART1 serial driver identifier.*/ -SerialDriver COM1; +SerialDriver SD1; #endif #if USE_STM32_USART2 || defined(__DOXYGEN__) /** @brief USART2 serial driver identifier.*/ -SerialDriver COM2; +SerialDriver SD2; #endif #if USE_STM32_USART3 || defined(__DOXYGEN__) /** @brief USART3 serial driver identifier.*/ -SerialDriver COM3; +SerialDriver SD3; #endif /** @brief Driver default configuration.*/ @@ -174,7 +174,7 @@ CH_IRQ_HANDLER(VectorD4) { CH_IRQ_PROLOGUE(); - serve_interrupt(USART1, &COM1); + serve_interrupt(USART1, &SD1); CH_IRQ_EPILOGUE(); } @@ -185,7 +185,7 @@ CH_IRQ_HANDLER(VectorD8) { CH_IRQ_PROLOGUE(); - serve_interrupt(USART2, &COM2); + serve_interrupt(USART2, &SD2); CH_IRQ_EPILOGUE(); } @@ -196,7 +196,7 @@ CH_IRQ_HANDLER(VectorDC) { CH_IRQ_PROLOGUE(); - serve_interrupt(USART3, &COM3); + serve_interrupt(USART3, &SD3); CH_IRQ_EPILOGUE(); } @@ -212,17 +212,17 @@ CH_IRQ_HANDLER(VectorDC) { void sd_lld_init(void) { #if USE_STM32_USART1 - sdObjectInit(&COM1, NULL, notify1); + sdObjectInit(&SD1, NULL, notify1); GPIOA->CRH = (GPIOA->CRH & 0xFFFFF00F) | 0x000004B0; #endif #if USE_STM32_USART2 - sdObjectInit(&COM2, NULL, notify2); + sdObjectInit(&SD2, NULL, notify2); GPIOA->CRL = (GPIOA->CRL & 0xFFFF00FF) | 0x00004B00; #endif #if USE_STM32_USART3 - sdObjectInit(&COM3, NULL, notify3); + sdObjectInit(&SD3, NULL, notify3); GPIOB->CRH = (GPIOB->CRH & 0xFFFF00FF) | 0x00004B00; #endif } @@ -241,7 +241,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { config = &default_config; #if USE_STM32_USART1 - if (&COM1 == sdp) { + if (&SD1 == sdp) { RCC->APB2ENR |= RCC_APB2ENR_USART1EN; usart_init(USART1, config); NVICEnableVector(USART1_IRQn, STM32_USART1_PRIORITY); @@ -249,7 +249,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { } #endif #if USE_STM32_USART2 - if (&COM2 == sdp) { + if (&SD2 == sdp) { RCC->APB1ENR |= RCC_APB1ENR_USART2EN; usart_init(USART2, config); NVICEnableVector(USART2_IRQn, STM32_USART2_PRIORITY); @@ -257,7 +257,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { } #endif #if USE_STM32_USART3 - if (&COM3 == sdp) { + if (&SD3 == sdp) { RCC->APB1ENR |= RCC_APB1ENR_USART3EN; usart_init(USART3, config); NVICEnableVector(USART3_IRQn, STM32_USART3_PRIORITY); @@ -276,7 +276,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { void sd_lld_stop(SerialDriver *sdp) { #if USE_STM32_USART1 - if (&COM1 == sdp) { + if (&SD1 == sdp) { usart_deinit(USART1); RCC->APB2ENR &= ~RCC_APB2ENR_USART1EN; NVICDisableVector(USART1_IRQn); @@ -284,7 +284,7 @@ void sd_lld_stop(SerialDriver *sdp) { } #endif #if USE_STM32_USART2 - if (&COM2 == sdp) { + if (&SD2 == sdp) { usart_deinit(USART2); RCC->APB1ENR &= ~RCC_APB1ENR_USART2EN; NVICDisableVector(USART2_IRQn); @@ -292,7 +292,7 @@ void sd_lld_stop(SerialDriver *sdp) { } #endif #if USE_STM32_USART3 - if (&COM3 == sdp) { + if (&SD3 == sdp) { usart_deinit(USART3); RCC->APB1ENR &= ~RCC_APB1ENR_USART3EN; NVICDisableVector(USART3_IRQn); diff --git a/os/io/platforms/STM32F103/serial_lld.h b/os/io/platforms/STM32F103/serial_lld.h index 5460d4a57..a623eb308 100644 --- a/os/io/platforms/STM32F103/serial_lld.h +++ b/os/io/platforms/STM32F103/serial_lld.h @@ -181,13 +181,13 @@ typedef struct { /** @cond never*/ #if USE_STM32_USART1 -extern SerialDriver COM1; +extern SerialDriver SD1; #endif #if USE_STM32_USART2 -extern SerialDriver COM2; +extern SerialDriver SD2; #endif #if USE_STM32_USART3 -extern SerialDriver COM3; +extern SerialDriver SD3; #endif #ifdef __cplusplus diff --git a/os/io/templates/pal_lld.h b/os/io/templates/pal_lld.h index 3da1c6d7d..84e09a220 100644 --- a/os/io/templates/pal_lld.h +++ b/os/io/templates/pal_lld.h @@ -87,7 +87,7 @@ typedef uint32_t ioportid_t; * @details Low level drivers can define multiple ports, it is suggested to * use this naming convention. */ -#define IOPORT_A 0 +#define IOPORT1 0 /*===========================================================================*/ /* Implementation, some of the following macros could be implemented as */ diff --git a/readme.txt b/readme.txt index 0b16a0f11..918f4cb4b 100644 --- a/readme.txt +++ b/readme.txt @@ -17,6 +17,9 @@ demo directory. - CHANGE: Removed the CH_USE_SERIAL_FULLDUPLEX configuration option because the serial driver is no more part of the kernel. +- CHANGE: Reorganized the PAL and Serial identifiers now IOPORT1..N and + SD1..N rather than IOPORT_A..Z and COM1..N, some of the old names were + conflicting with some AVR libraries. *** 1.3.1 *** - FIX: Removed mention of an obsolete option from the documentation (bug -- cgit v1.2.3