diff --git a/demos/AVR/RT-ARDUINOMEGA/main.c b/demos/AVR/RT-ARDUINOMEGA/main.c
index 0228c440b..4db566c40 100644
--- a/demos/AVR/RT-ARDUINOMEGA/main.c
+++ b/demos/AVR/RT-ARDUINOMEGA/main.c
@@ -21,11 +21,10 @@
static WORKING_AREA(waThread1, 32);
static msg_t Thread1(void *arg) {
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT2, PORTB_LED1);
chThdSleepMilliseconds(1000);
}
- return 0;
}
/*
diff --git a/demos/KINETIS/RT-FREEDOM-K20D50M/main.c b/demos/KINETIS/RT-FREEDOM-K20D50M/main.c
index 4a65f5234..9a2ca0eb9 100644
--- a/demos/KINETIS/RT-FREEDOM-K20D50M/main.c
+++ b/demos/KINETIS/RT-FREEDOM-K20D50M/main.c
@@ -23,12 +23,10 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("RedBlinker");
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT3, 3);
chThdSleepMilliseconds(300);
}
-
- return 0;
}
static THD_WORKING_AREA(waThread2, 64);
@@ -36,12 +34,10 @@ static THD_FUNCTION(Thread2, arg) {
(void)arg;
chRegSetThreadName("GreenBlinker");
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT4, 4);
chThdSleepMilliseconds(600);
}
-
- return 0;
}
static THD_WORKING_AREA(waThread3, 64);
@@ -49,12 +45,10 @@ static THD_FUNCTION(Thread3, arg) {
(void)arg;
chRegSetThreadName("BlueBlinker");
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT1, 2);
chThdSleepMilliseconds(900);
}
-
- return 0;
}
/*
diff --git a/demos/KINETIS/RT-FREEDOM-KL25Z/main.c b/demos/KINETIS/RT-FREEDOM-KL25Z/main.c
index f4cf28678..d565ca041 100644
--- a/demos/KINETIS/RT-FREEDOM-KL25Z/main.c
+++ b/demos/KINETIS/RT-FREEDOM-KL25Z/main.c
@@ -23,12 +23,10 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("RedBlinker");
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT2, 18);
chThdSleepMilliseconds(300);
}
-
- return 0;
}
static THD_WORKING_AREA(waThread2, 64);
@@ -36,12 +34,10 @@ static THD_FUNCTION(Thread2, arg) {
(void)arg;
chRegSetThreadName("GreenBlinker");
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT2, 19);
chThdSleepMilliseconds(600);
}
-
- return 0;
}
static THD_WORKING_AREA(waThread3, 64);
@@ -49,12 +45,10 @@ static THD_FUNCTION(Thread3, arg) {
(void)arg;
chRegSetThreadName("BlueBlinker");
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT4, 1);
chThdSleepMilliseconds(900);
}
-
- return 0;
}
/*
diff --git a/demos/KINETIS/RT-MCHCK-K20-SPI/main.c b/demos/KINETIS/RT-MCHCK-K20-SPI/main.c
index b7530d2f2..909475944 100644
--- a/demos/KINETIS/RT-MCHCK-K20-SPI/main.c
+++ b/demos/KINETIS/RT-MCHCK-K20-SPI/main.c
@@ -42,7 +42,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("Blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOB, GPIOB_LED);
/* Send the Manufacturer and Device ID Read command */
@@ -54,8 +54,6 @@ static THD_FUNCTION(Thread1, arg) {
chThdSleepMilliseconds(1000);
}
-
- return 0;
}
/*
diff --git a/demos/KINETIS/RT-TEENSY3/main.c b/demos/KINETIS/RT-TEENSY3/main.c
index 9a541206d..591bd0ff8 100644
--- a/demos/KINETIS/RT-TEENSY3/main.c
+++ b/demos/KINETIS/RT-TEENSY3/main.c
@@ -22,16 +22,14 @@
* LED blinker thread.
*/
static THD_WORKING_AREA(waThread1, 64);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("LEDBlinker");
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT3, PORTC_TEENSY_PIN13);
chThdSleepMilliseconds(500);
}
-
- return 0;
}
/*
@@ -60,7 +58,7 @@ int main(void) {
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
TestThread(&SD1);
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(1000);
}
diff --git a/demos/LPC21xx/RT-LPC214x-OLIMEX/main.c b/demos/LPC21xx/RT-LPC214x-OLIMEX/main.c
index 062027136..b01c1915f 100644
--- a/demos/LPC21xx/RT-LPC214x-OLIMEX/main.c
+++ b/demos/LPC21xx/RT-LPC214x-OLIMEX/main.c
@@ -28,7 +28,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker1");
- while (TRUE) {
+ while (true) {
palClearPort(IOPORT1, PAL_PORT_BIT(PA_LED2));
chThdSleepMilliseconds(200);
palSetPort(IOPORT1, PAL_PORT_BIT(PA_LED1) | PAL_PORT_BIT(PA_LED2));
@@ -48,7 +48,7 @@ static THD_FUNCTION(Thread2, arg) {
(void)arg;
chRegSetThreadName("blinker2");
- while (TRUE) {
+ while (true) {
palClearPad(IOPORT1, PA_LEDUSB);
chThdSleepMilliseconds(200);
palSetPad(IOPORT1, PA_LEDUSB);
@@ -86,7 +86,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the buttons state and run test procedure.
*/
- while (TRUE) {
+ while (true) {
if (!palReadPad(IOPORT1, PA_BUTTON1))
sdWrite(&SD1, (uint8_t *)"Hello World!\r\n", 14);
if (!palReadPad(IOPORT1, PA_BUTTON2))
diff --git a/demos/SPC5/NIL-SPC560D-EVB/main.c b/demos/SPC5/NIL-SPC560D-EVB/main.c
index d40169dd3..d24e0cec7 100644
--- a/demos/SPC5/NIL-SPC560D-EVB/main.c
+++ b/demos/SPC5/NIL-SPC560D-EVB/main.c
@@ -31,7 +31,7 @@ static THD_FUNCTION(Thread1, arg) {
*/
sdStart(&SD1, NULL);
- while (TRUE) {
+ while (true) {
unsigned i;
chnWriteTimeout(&SD1, (uint8_t *)"Hello World!\r\n", 14, TIME_INFINITE);
diff --git a/demos/SPC5/RT-SPC560B-EVB/main.c b/demos/SPC5/RT-SPC560B-EVB/main.c
index 044dd750a..957f0e8c2 100644
--- a/demos/SPC5/RT-SPC560B-EVB/main.c
+++ b/demos/SPC5/RT-SPC560B-EVB/main.c
@@ -90,12 +90,12 @@ static const ShellConfig shell_cfg1 = {
* LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
unsigned i;
for (i = 0; i < 4; i++) {
@@ -153,7 +153,6 @@ static msg_t Thread1(void *arg) {
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;
}
/*
@@ -190,7 +189,7 @@ int main(void) {
/*
* Normal main() thread activity.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/SPC5/RT-SPC560D-EVB/main.c b/demos/SPC5/RT-SPC560D-EVB/main.c
index 044dd750a..957f0e8c2 100644
--- a/demos/SPC5/RT-SPC560D-EVB/main.c
+++ b/demos/SPC5/RT-SPC560D-EVB/main.c
@@ -90,12 +90,12 @@ static const ShellConfig shell_cfg1 = {
* LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
unsigned i;
for (i = 0; i < 4; i++) {
@@ -153,7 +153,6 @@ static msg_t Thread1(void *arg) {
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;
}
/*
@@ -190,7 +189,7 @@ int main(void) {
/*
* Normal main() thread activity.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/SPC5/RT-SPC560P-EVB/main.c b/demos/SPC5/RT-SPC560P-EVB/main.c
index 9b401b0ec..1806961b2 100644
--- a/demos/SPC5/RT-SPC560P-EVB/main.c
+++ b/demos/SPC5/RT-SPC560P-EVB/main.c
@@ -90,12 +90,12 @@ static const ShellConfig shell_cfg1 = {
* LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
unsigned i;
for (i = 0; i < 4; i++) {
@@ -153,7 +153,6 @@ static msg_t Thread1(void *arg) {
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;
}
/*
@@ -190,7 +189,7 @@ int main(void) {
/*
* Normal main() thread activity.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/SPC5/RT-SPC563M-EVB/main.c b/demos/SPC5/RT-SPC563M-EVB/main.c
index a18dd1cee..ab881fdc4 100644
--- a/demos/SPC5/RT-SPC563M-EVB/main.c
+++ b/demos/SPC5/RT-SPC563M-EVB/main.c
@@ -90,12 +90,12 @@ static const ShellConfig shell_cfg1 = {
* LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
unsigned i;
for (i = 0; i < 4; i++) {
@@ -136,7 +136,6 @@ static msg_t Thread1(void *arg) {
PAL_PORT_BIT(P11_LED1) | PAL_PORT_BIT(P11_LED2) |
PAL_PORT_BIT(P11_LED3) | PAL_PORT_BIT(P11_LED4));
}
- return 0;
}
/*
@@ -173,7 +172,7 @@ int main(void) {
/*
* Normal main() thread activity.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/SPC5/RT-SPC564A-EVB/main.c b/demos/SPC5/RT-SPC564A-EVB/main.c
index a18dd1cee..ab881fdc4 100644
--- a/demos/SPC5/RT-SPC564A-EVB/main.c
+++ b/demos/SPC5/RT-SPC564A-EVB/main.c
@@ -90,12 +90,12 @@ static const ShellConfig shell_cfg1 = {
* LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
unsigned i;
for (i = 0; i < 4; i++) {
@@ -136,7 +136,6 @@ static msg_t Thread1(void *arg) {
PAL_PORT_BIT(P11_LED1) | PAL_PORT_BIT(P11_LED2) |
PAL_PORT_BIT(P11_LED3) | PAL_PORT_BIT(P11_LED4));
}
- return 0;
}
/*
@@ -173,7 +172,7 @@ int main(void) {
/*
* Normal main() thread activity.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/SPC5/RT-SPC56EC-EVB/main.c b/demos/SPC5/RT-SPC56EC-EVB/main.c
index 044dd750a..957f0e8c2 100644
--- a/demos/SPC5/RT-SPC56EC-EVB/main.c
+++ b/demos/SPC5/RT-SPC56EC-EVB/main.c
@@ -90,12 +90,12 @@ static const ShellConfig shell_cfg1 = {
* LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
unsigned i;
for (i = 0; i < 4; i++) {
@@ -153,7 +153,6 @@ static msg_t Thread1(void *arg) {
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;
}
/*
@@ -190,7 +189,7 @@ int main(void) {
/*
* Normal main() thread activity.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/SPC5/RT-SPC56EL-EVB/main.c b/demos/SPC5/RT-SPC56EL-EVB/main.c
index 9b401b0ec..1806961b2 100644
--- a/demos/SPC5/RT-SPC56EL-EVB/main.c
+++ b/demos/SPC5/RT-SPC56EL-EVB/main.c
@@ -90,12 +90,12 @@ static const ShellConfig shell_cfg1 = {
* LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
unsigned i;
for (i = 0; i < 4; i++) {
@@ -153,7 +153,6 @@ static msg_t Thread1(void *arg) {
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;
}
/*
@@ -190,7 +189,7 @@ int main(void) {
/*
* Normal main() thread activity.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/STM32/CMSIS-STM32F407-DISCOVERY/main.c b/demos/STM32/CMSIS-STM32F407-DISCOVERY/main.c
index 2ec461bb6..fbb365c80 100644
--- a/demos/STM32/CMSIS-STM32F407-DISCOVERY/main.c
+++ b/demos/STM32/CMSIS-STM32F407-DISCOVERY/main.c
@@ -25,7 +25,7 @@ static void Thread1(void const *arg) {
(void)arg;
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED3); /* Orange. */
osDelay(500);
palClearPad(GPIOD, GPIOD_LED3); /* Orange. */
@@ -67,7 +67,7 @@ int main(void) {
/* In the ChibiOS/RT CMSIS RTOS implementation the main() is an
usable thread, here we just sleep in a loop printing a message.*/
- while (TRUE) {
+ while (true) {
sdWrite(&SD2, (uint8_t *)"Hello World!\r\n", 14);
osDelay(500);
}
diff --git a/demos/STM32/RT-STM32F030R8-NUCLEO/main.c b/demos/STM32/RT-STM32F030R8-NUCLEO/main.c
index 1ad4c7bc5..bd50f191d 100644
--- a/demos/STM32/RT-STM32F030R8-NUCLEO/main.c
+++ b/demos/STM32/RT-STM32F030R8-NUCLEO/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(500);
palSetPad(GPIOA, GPIOA_LED_GREEN);
@@ -63,7 +63,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!palReadPad(GPIOC, GPIOC_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F051-DISCOVERY/main.c b/demos/STM32/RT-STM32F051-DISCOVERY/main.c
index a2e6095ed..f3e18f96e 100644
--- a/demos/STM32/RT-STM32F051-DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32F051-DISCOVERY/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker1");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED4);
chThdSleepMilliseconds(500);
palSetPad(GPIOC, GPIOC_LED4);
@@ -42,7 +42,7 @@ static THD_FUNCTION(Thread2, arg) {
(void)arg;
chRegSetThreadName("blinker2");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED3);
chThdSleepMilliseconds(250);
palSetPad(GPIOC, GPIOC_LED3);
@@ -85,7 +85,7 @@ int main(void) {
* pressed the test procedure is launched with output on the serial
* driver 1.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD1);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F072-DISCOVERY/main.c b/demos/STM32/RT-STM32F072-DISCOVERY/main.c
index 4f6a22754..bd2cc1d25 100644
--- a/demos/STM32/RT-STM32F072-DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32F072-DISCOVERY/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker1");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED_BLUE);
chThdSleepMilliseconds(500);
palSetPad(GPIOC, GPIOC_LED_BLUE);
@@ -42,7 +42,7 @@ static THD_FUNCTION(Thread2, arg) {
(void)arg;
chRegSetThreadName("blinker2");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED_GREEN);
chThdSleepMilliseconds(250);
palSetPad(GPIOC, GPIOC_LED_GREEN);
@@ -85,7 +85,7 @@ int main(void) {
* pressed the test procedure is launched with output on the serial
* driver 1.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD1);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F100-DISCOVERY/main.c b/demos/STM32/RT-STM32F100-DISCOVERY/main.c
index 1ce8f73ab..f2afcea23 100644
--- a/demos/STM32/RT-STM32F100-DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32F100-DISCOVERY/main.c
@@ -84,7 +84,7 @@ int main(void) {
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD1);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F103-MAPLEMINI/main.c b/demos/STM32/RT-STM32F103-MAPLEMINI/main.c
index 545183c41..44eddabd1 100644
--- a/demos/STM32/RT-STM32F103-MAPLEMINI/main.c
+++ b/demos/STM32/RT-STM32F103-MAPLEMINI/main.c
@@ -143,7 +143,7 @@ static __attribute__((noreturn)) THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOB, GPIOB_LED);
chThdSleepMilliseconds(time);
@@ -198,7 +198,7 @@ int __attribute__((noreturn)) main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/STM32/RT-STM32F103-OLIMEX_STM32_P103/main.c b/demos/STM32/RT-STM32F103-OLIMEX_STM32_P103/main.c
index a363cf166..4b5d556e6 100644
--- a/demos/STM32/RT-STM32F103-OLIMEX_STM32_P103/main.c
+++ b/demos/STM32/RT-STM32F103-OLIMEX_STM32_P103/main.c
@@ -66,7 +66,7 @@ int main(void) {
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F103RB-NUCLEO/main.c b/demos/STM32/RT-STM32F103RB-NUCLEO/main.c
index 1ad4c7bc5..bd50f191d 100644
--- a/demos/STM32/RT-STM32F103RB-NUCLEO/main.c
+++ b/demos/STM32/RT-STM32F103RB-NUCLEO/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(500);
palSetPad(GPIOA, GPIOA_LED_GREEN);
@@ -63,7 +63,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!palReadPad(GPIOC, GPIOC_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/main.c b/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/main.c
index ae3741d84..bce8983bb 100644
--- a/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/main.c
@@ -143,7 +143,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOA, GPIOA_LED_BLUE);
chThdSleepMilliseconds(time);
@@ -198,7 +198,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/STM32/RT-STM32F303-DISCOVERY/main.c b/demos/STM32/RT-STM32F303-DISCOVERY/main.c
index ec9c1e502..d5ac58197 100644
--- a/demos/STM32/RT-STM32F303-DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32F303-DISCOVERY/main.c
@@ -110,7 +110,7 @@ int main(void) {
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD1);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F334R8-NUCLEO/main.c b/demos/STM32/RT-STM32F334R8-NUCLEO/main.c
index 1ad4c7bc5..bd50f191d 100644
--- a/demos/STM32/RT-STM32F334R8-NUCLEO/main.c
+++ b/demos/STM32/RT-STM32F334R8-NUCLEO/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(500);
palSetPad(GPIOA, GPIOA_LED_GREEN);
@@ -63,7 +63,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!palReadPad(GPIOC, GPIOC_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F373-STM32373C_EVAL/main.c b/demos/STM32/RT-STM32F373-STM32373C_EVAL/main.c
index 94039ddb2..256c6d763 100644
--- a/demos/STM32/RT-STM32F373-STM32373C_EVAL/main.c
+++ b/demos/STM32/RT-STM32F373-STM32373C_EVAL/main.c
@@ -27,7 +27,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(250);
palSetPad(GPIOC, GPIOC_LED1);
@@ -74,7 +74,7 @@ int main(void) {
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_WKUP_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F401RE-NUCLEO/main.c b/demos/STM32/RT-STM32F401RE-NUCLEO/main.c
index 1ad4c7bc5..bd50f191d 100644
--- a/demos/STM32/RT-STM32F401RE-NUCLEO/main.c
+++ b/demos/STM32/RT-STM32F401RE-NUCLEO/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(500);
palSetPad(GPIOA, GPIOA_LED_GREEN);
@@ -63,7 +63,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!palReadPad(GPIOC, GPIOC_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F407-DISCOVERY-MEMS/main.c b/demos/STM32/RT-STM32F407-DISCOVERY-MEMS/main.c
index 640a8fc9d..5f102f6a8 100644
--- a/demos/STM32/RT-STM32F407-DISCOVERY-MEMS/main.c
+++ b/demos/STM32/RT-STM32F407-DISCOVERY-MEMS/main.c
@@ -166,7 +166,7 @@ static THD_FUNCTION(Thread1, arg) {
/* Reader thread loop.*/
time = chVTGetSystemTime();
- while (TRUE) {
+ while (true) {
int32_t x, y;
unsigned i;
@@ -306,7 +306,7 @@ int main(void) {
* Normal main() thread activity, in this demo it just performs
* a shell respawn upon its termination.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp) {
if (SDU1.config->usbp->state == USB_ACTIVE) {
/* Spawns a new shell.*/
diff --git a/demos/STM32/RT-STM32F407-DISCOVERY/main.c b/demos/STM32/RT-STM32F407-DISCOVERY/main.c
index e6930f4e8..1049ea7cc 100644
--- a/demos/STM32/RT-STM32F407-DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32F407-DISCOVERY/main.c
@@ -27,7 +27,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED3); /* Orange. */
chThdSleepMilliseconds(500);
palClearPad(GPIOD, GPIOD_LED3); /* Orange. */
@@ -67,7 +67,7 @@ int main(void) {
* Normal main() thread activity, in this demo it just performs
* a shell respawn upon its termination.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/main.c b/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/main.c
index b79169664..0e38e87a1 100644
--- a/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/main.c
+++ b/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/main.c
@@ -595,7 +595,7 @@ static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palTogglePad(GPIOC, GPIOC_LED);
chThdSleepMilliseconds(fs_ready ? 125 : 500);
}
@@ -680,7 +680,7 @@ int main(void) {
*/
chEvtRegister(&inserted_event, &el0, 0);
chEvtRegister(&removed_event, &el1, 1);
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU2.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/demos/STM32/RT-STM32F411RE-NUCLEO/main.c b/demos/STM32/RT-STM32F411RE-NUCLEO/main.c
index 1ad4c7bc5..bd50f191d 100644
--- a/demos/STM32/RT-STM32F411RE-NUCLEO/main.c
+++ b/demos/STM32/RT-STM32F411RE-NUCLEO/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(500);
palSetPad(GPIOA, GPIOA_LED_GREEN);
@@ -63,7 +63,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!palReadPad(GPIOC, GPIOC_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY/main.c b/demos/STM32/RT-STM32F429-DISCOVERY/main.c
index 3237e4d51..e0a371611 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32F429-DISCOVERY/main.c
@@ -31,7 +31,7 @@ static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker1");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOG, GPIOG_LED4_RED);
chThdSleepMilliseconds(500);
palSetPad(GPIOG, GPIOG_LED4_RED);
@@ -47,7 +47,7 @@ static msg_t Thread2(void *arg) {
(void)arg;
chRegSetThreadName("blinker2");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOG, GPIOG_LED3_GREEN);
chThdSleepMilliseconds(250);
palSetPad(GPIOG, GPIOG_LED3_GREEN);
@@ -181,7 +181,7 @@ int main(void) {
* Normal main() thread activity, in this demo it just performs
* a shell respawn upon its termination.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp) {
if (SDU1.config->usbp->state == USB_ACTIVE) {
/* Spawns a new shell.*/
diff --git a/demos/STM32/RT-STM32L152-DISCOVERY/main.c b/demos/STM32/RT-STM32L152-DISCOVERY/main.c
index 800f3e822..86e1912cd 100644
--- a/demos/STM32/RT-STM32L152-DISCOVERY/main.c
+++ b/demos/STM32/RT-STM32L152-DISCOVERY/main.c
@@ -86,7 +86,7 @@ int main(void) {
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
TestThread(&SD1);
chThdSleepMilliseconds(500);
diff --git a/demos/STM32/RT-STM32L152RE-NUCLEO/main.c b/demos/STM32/RT-STM32L152RE-NUCLEO/main.c
index 1ad4c7bc5..bd50f191d 100644
--- a/demos/STM32/RT-STM32L152RE-NUCLEO/main.c
+++ b/demos/STM32/RT-STM32L152RE-NUCLEO/main.c
@@ -26,7 +26,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(500);
palSetPad(GPIOA, GPIOA_LED_GREEN);
@@ -63,7 +63,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!palReadPad(GPIOC, GPIOC_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
diff --git a/demos/various/RT-Win32-Simulator/main.c b/demos/various/RT-Win32-Simulator/main.c
index e391bf257..6540693e6 100644
--- a/demos/various/RT-Win32-Simulator/main.c
+++ b/demos/various/RT-Win32-Simulator/main.c
@@ -103,7 +103,7 @@ static const ShellConfig shell_cfg2 = {
* to the C printf() thread safe and the print operation atomic among threads.
* In this example the message is the zero terminated string itself.
*/
-static msg_t console_thread(void *arg) {
+static THD_FUNCTION(console_thread, arg) {
(void)arg;
while (!chThdShouldTerminateX()) {
@@ -112,7 +112,6 @@ static msg_t console_thread(void *arg) {
fflush(stdout);
chMsgRelease(tp, MSG_OK);
}
- return 0;
}
/**
diff --git a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c
index 7c3d387dd..4c2913164 100644
--- a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c
+++ b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c
@@ -1288,11 +1288,10 @@ void usb_lld_clear_in(USBDriver *usbp, usbep_t ep) {
* in order to not perform heavy tasks withing interrupt handlers.
*
* @param[in] p pointer to the @p USBDriver object
- * @return The function never returns.
*
* @special
*/
-msg_t usb_lld_pump(void *p) {
+void usb_lld_pump(void *p) {
USBDriver *usbp = (USBDriver *)p;
stm32_otg_t *otgp = usbp->otg;
diff --git a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h
index 22b5509c8..ffdd19c5a 100644
--- a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h
+++ b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h
@@ -543,7 +543,7 @@ extern "C" {
void usb_lld_stall_in(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_out(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_in(USBDriver *usbp, usbep_t ep);
- msg_t usb_lld_pump(void *p);
+ void usb_lld_pump(void *p);
#ifdef __cplusplus
}
#endif
diff --git a/os/rt/include/chthreads.h b/os/rt/include/chthreads.h
index aca3e1d78..690c45f7f 100644
--- a/os/rt/include/chthreads.h
+++ b/os/rt/include/chthreads.h
@@ -49,7 +49,7 @@
/**
* @brief Thread function.
*/
-typedef msg_t (*tfunc_t)(void *p);
+typedef void (*tfunc_t)(void *p);
/*===========================================================================*/
/* Module macros. */
diff --git a/os/rt/ports/ARM/compilers/GCC/chcoreasm.s b/os/rt/ports/ARM/compilers/GCC/chcoreasm.s
index 619a90bd7..764735b05 100644
--- a/os/rt/ports/ARM/compilers/GCC/chcoreasm.s
+++ b/os/rt/ports/ARM/compilers/GCC/chcoreasm.s
@@ -268,6 +268,7 @@ _bxr4: bx r4
mov r0, r5
mov lr, pc
bx r4
+ mov r0, #0 /* MSG_OK */
bl chThdExit
_zombies: b _zombies
#endif /* !defined(THUMB_NO_INTERWORKING) */
diff --git a/os/rt/ports/ARM/compilers/GCC/chtypes.h b/os/rt/ports/ARM/compilers/GCC/chtypes.h
index 72674a53f..88e9956ed 100644
--- a/os/rt/ports/ARM/compilers/GCC/chtypes.h
+++ b/os/rt/ports/ARM/compilers/GCC/chtypes.h
@@ -98,7 +98,7 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
/**
* @brief Optimized thread function declaration macro.
*/
-#define PORT_THD_FUNCTION(tname, arg) msg_t tname(void *arg)
+#define PORT_THD_FUNCTION(tname, arg) void tname(void *arg)
/**
* @brief Packed variable specifier.
diff --git a/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s b/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s
index b8f6446ba..31d2a5f63 100644
--- a/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s
+++ b/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s
@@ -95,6 +95,7 @@ _port_thread_start:
cpsie i
mov r0, r5
blx r4
+ movs r0, #0 /* MSG_OK */
bl chThdExit
/*--------------------------------------------------------------------------*
diff --git a/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s b/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s
index 8446a0ecd..b232e0397 100644
--- a/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s
+++ b/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s
@@ -96,6 +96,7 @@ _port_thread_start:
#endif
mov r0, r5
blx r4
+ movs r0, #0 /* MSG_OK */
bl chThdExit
/*--------------------------------------------------------------------------*
diff --git a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h
index 25ed63a90..af3349d79 100644
--- a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h
+++ b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h
@@ -99,7 +99,7 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
/**
* @brief Optimized thread function declaration macro.
*/
-#define PORT_THD_FUNCTION(tname, arg) msg_t tname(void *arg)
+#define PORT_THD_FUNCTION(tname, arg) void tname(void *arg)
/**
* @brief Packed variable specifier.
diff --git a/os/rt/ports/ARMCMx/compilers/IAR/chtypes.h b/os/rt/ports/ARMCMx/compilers/IAR/chtypes.h
index 964fc4d22..4e41e4c6d 100644
--- a/os/rt/ports/ARMCMx/compilers/IAR/chtypes.h
+++ b/os/rt/ports/ARMCMx/compilers/IAR/chtypes.h
@@ -98,7 +98,7 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
/**
* @brief Optimized thread function declaration macro.
*/
-#define PORT_THD_FUNCTION(tname, arg) msg_t tname(void *arg)
+#define PORT_THD_FUNCTION(tname, arg) void tname(void *arg)
/**
* @brief Packed variable specifier.
diff --git a/os/rt/ports/ARMCMx/compilers/RVCT/chtypes.h b/os/rt/ports/ARMCMx/compilers/RVCT/chtypes.h
index b308b8054..a8e92db6f 100644
--- a/os/rt/ports/ARMCMx/compilers/RVCT/chtypes.h
+++ b/os/rt/ports/ARMCMx/compilers/RVCT/chtypes.h
@@ -98,7 +98,7 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
/**
* @brief Optimized thread function declaration macro.
*/
-#define PORT_THD_FUNCTION(tname, arg) msg_t tname(void *arg)
+#define PORT_THD_FUNCTION(tname, arg) void tname(void *arg)
/**
* @brief Packed variable specifier.
diff --git a/os/rt/ports/SIMIA32/chcore.c b/os/rt/ports/SIMIA32/chcore.c
index 97cf2f142..a2dbbbe71 100644
--- a/os/rt/ports/SIMIA32/chcore.c
+++ b/os/rt/ports/SIMIA32/chcore.c
@@ -93,7 +93,8 @@ __attribute__((cdecl, noreturn))
void _port_thread_start(msg_t (*pf)(void *), void *p) {
chSysUnlock();
- chThdExit(pf(p));
+ pf(p);
+ chThdExit(0);
while(1);
}
diff --git a/os/rt/ports/SIMIA32/compilers/GCC/chtypes.h b/os/rt/ports/SIMIA32/compilers/GCC/chtypes.h
index 252bba104..175a44287 100644
--- a/os/rt/ports/SIMIA32/compilers/GCC/chtypes.h
+++ b/os/rt/ports/SIMIA32/compilers/GCC/chtypes.h
@@ -98,7 +98,7 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
/**
* @brief Optimized thread function declaration macro.
*/
-#define PORT_THD_FUNCTION(tname, arg) msg_t tname(void *arg)
+#define PORT_THD_FUNCTION(tname, arg) void tname(void *arg)
/**
* @brief Packed variable specifier.
diff --git a/os/rt/ports/e200/chcore.c b/os/rt/ports/e200/chcore.c
index cfa8a3564..28fb8926b 100644
--- a/os/rt/ports/e200/chcore.c
+++ b/os/rt/ports/e200/chcore.c
@@ -100,6 +100,7 @@ void port_dummy2(void) {
asm ("mr %r3, %r31"); /* Thread parameter. */
asm ("mtctr %r30");
asm ("bctrl"); /* Invoke thread function. */
+ asm ("li %r0, 0"); /* MSG_OK. */
asm ("bl chThdExit"); /* Thread termination on exit. */
}
diff --git a/os/various/lwip_bindings/lwipthread.c b/os/various/lwip_bindings/lwipthread.c
index 2335c01b2..ddb476aed 100644
--- a/os/various/lwip_bindings/lwipthread.c
+++ b/os/various/lwip_bindings/lwipthread.c
@@ -210,7 +210,7 @@ static err_t ethernetif_init(struct netif *netif) {
* @param[in] p pointer to a @p lwipthread_opts structure or @p NULL
* @return The function does not return.
*/
-msg_t lwip_thread(void *p) {
+THD_FUNCTION(lwip_thread, p) {
event_timer_t evt;
event_listener_t el0, el1;
struct ip_addr ip, gateway, netmask;
diff --git a/os/various/lwip_bindings/lwipthread.h b/os/various/lwip_bindings/lwipthread.h
index 5d3beb7ac..d69323e64 100644
--- a/os/various/lwip_bindings/lwipthread.h
+++ b/os/various/lwip_bindings/lwipthread.h
@@ -121,7 +121,7 @@ extern THD_WORKING_AREA(wa_lwip_thread, LWIP_THREAD_STACK_SIZE);
#ifdef __cplusplus
extern "C" {
#endif
- msg_t lwip_thread(void *p);
+ THD_FUNCTION(lwip_thread, p);
#ifdef __cplusplus
}
#endif
diff --git a/os/various/shell.c b/os/various/shell.c
index 09b61f836..4c2f3c6cd 100644
--- a/os/various/shell.c
+++ b/os/various/shell.c
@@ -121,22 +121,19 @@ static bool cmdexec(const ShellCommand *scp, BaseSequentialStream *chp,
while (scp->sc_name != NULL) {
if (strcasecmp(scp->sc_name, name) == 0) {
scp->sc_function(chp, argc, argv);
- return FALSE;
+ return false;
}
scp++;
}
- return TRUE;
+ return true;
}
/**
* @brief Shell thread function.
*
* @param[in] p pointer to a @p BaseSequentialStream object
- * @return Termination reason.
- * @retval MSG_OK terminated by command.
- * @retval MSG_RESET terminated by reset condition on the I/O channel.
*/
-static msg_t shell_thread(void *p) {
+static THD_FUNCTION(shell_thread, p) {
int n;
BaseSequentialStream *chp = ((ShellConfig *)p)->sc_channel;
const ShellCommand *scp = ((ShellConfig *)p)->sc_commands;
@@ -145,7 +142,7 @@ static msg_t shell_thread(void *p) {
chRegSetThreadName("shell");
chprintf(chp, "\r\nChibiOS/RT Shell\r\n");
- while (TRUE) {
+ while (true) {
chprintf(chp, "ch> ");
if (shellGetLine(chp, line, sizeof(line))) {
chprintf(chp, "\r\nlogout");
@@ -190,8 +187,6 @@ static msg_t shell_thread(void *p) {
}
}
shellExit(MSG_OK);
- /* Never executed, silencing a warning.*/
- return 0;
}
/**
@@ -265,22 +260,22 @@ thread_t *shellCreateStatic(const ShellConfig *scp, void *wsp,
* @param[in] line pointer to the line buffer
* @param[in] size buffer maximum length
* @return The operation status.
- * @retval TRUE the channel was reset or CTRL-D pressed.
- * @retval FALSE operation successful.
+ * @retval true the channel was reset or CTRL-D pressed.
+ * @retval false operation successful.
*
* @api
*/
bool shellGetLine(BaseSequentialStream *chp, char *line, unsigned size) {
char *p = line;
- while (TRUE) {
+ while (true) {
char c;
if (chSequentialStreamRead(chp, (uint8_t *)&c, 1) == 0)
- return TRUE;
+ return true;
if (c == 4) {
chprintf(chp, "^D");
- return TRUE;
+ return true;
}
if ((c == 8) || (c == 127)) {
if (p != line) {
@@ -294,7 +289,7 @@ bool shellGetLine(BaseSequentialStream *chp, char *line, unsigned size) {
if (c == '\r') {
chprintf(chp, "\r\n");
*p = 0;
- return FALSE;
+ return false;
}
if (c < 0x20)
continue;
diff --git a/test/rt/coverage/main.c b/test/rt/coverage/main.c
index f1ed0b739..51e253a4b 100644
--- a/test/rt/coverage/main.c
+++ b/test/rt/coverage/main.c
@@ -27,7 +27,6 @@
* Simulator main.
*/
int main(int argc, char *argv[]) {
- msg_t result;
(void)argc;
(void)argv;
@@ -43,8 +42,8 @@ int main(int argc, char *argv[]) {
conInit();
chSysInit();
- result = TestThread(&CD1);
- if (result)
+ TestThread(&CD1);
+ if (test_global_fail)
exit(1);
else
exit(0);
diff --git a/test/rt/test.c b/test/rt/test.c
index 14638a3dd..5dc791a0f 100644
--- a/test/rt/test.c
+++ b/test/rt/test.c
@@ -56,7 +56,8 @@ static ROMCONST struct testcase * ROMCONST *patterns[] = {
NULL
};
-static bool local_fail, global_fail;
+bool test_global_fail;
+static bool local_fail;
static unsigned failpoint;
static char tokens_buffer[MAX_TOKENS];
static char *tokp;
@@ -156,8 +157,8 @@ void test_emit_token(char token) {
*/
bool _test_fail(unsigned point) {
+ test_global_fail = TRUE;
local_fail = TRUE;
- global_fail = TRUE;
failpoint = point;
return TRUE;
}
@@ -309,9 +310,8 @@ static void print_line(void) {
* @brief Test execution thread function.
*
* @param[in] p pointer to a @p BaseChannel object for test output
- * @return A failure boolean value.
*/
-msg_t TestThread(void *p) {
+void TestThread(void *p) {
int i, j;
chp = p;
@@ -346,7 +346,7 @@ msg_t TestThread(void *p) {
#endif
test_println("");
- global_fail = FALSE;
+ test_global_fail = FALSE;
i = 0;
while (patterns[i]) {
j = 0;
@@ -379,12 +379,10 @@ msg_t TestThread(void *p) {
print_line();
test_println("");
test_print("Final result: ");
- if (global_fail)
+ if (test_global_fail)
test_println("FAILURE");
else
test_println("SUCCESS");
-
- return (msg_t)global_fail;
}
/** @} */
diff --git a/test/rt/test.h b/test/rt/test.h
index 90f7b977f..da080db2d 100644
--- a/test/rt/test.h
+++ b/test/rt/test.h
@@ -76,10 +76,12 @@ union test_buffers {
};
#endif
+extern bool test_global_fail;
+
#ifdef __cplusplus
extern "C" {
#endif
- msg_t TestThread(void *p);
+ void TestThread(void *p);
void test_printn(uint32_t n);
void test_print(const char *msgp);
void test_println(const char *msgp);
diff --git a/test/rt/testbmk.c b/test/rt/testbmk.c
index 7d23f02bf..b4f4af7d6 100644
--- a/test/rt/testbmk.c
+++ b/test/rt/testbmk.c
@@ -63,13 +63,13 @@ static semaphore_t sem1;
static mutex_t mtx1;
#endif
-static msg_t thread1(void *p) {
+static THD_FUNCTION(thread1, p) {
- return (msg_t)p;
+ chThdExit((msg_t)p);
}
#if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
-static msg_t thread2(void *p) {
+static THD_FUNCTION(thread2, p) {
thread_t *tp;
msg_t msg;
@@ -79,7 +79,6 @@ static msg_t thread2(void *p) {
msg = chMsgGet(tp);
chMsgRelease(tp, msg);
} while (msg);
- return 0;
}
#ifdef __GNUC__
@@ -204,7 +203,7 @@ ROMCONST struct testcase testbmk3 = {
* iterations after a second of continuous operations.
*/
-msg_t thread4(void *p) {
+static THD_FUNCTION(thread4, p) {
msg_t msg;
thread_t *self = chThdGetSelfX();
@@ -215,7 +214,6 @@ msg_t thread4(void *p) {
msg = self->p_u.rdymsg;
} while (msg == MSG_OK);
chSysUnlock();
- return 0;
}
static void bmk4_execute(void) {
@@ -344,12 +342,11 @@ ROMCONST struct testcase testbmk6 = {
* a second of continuous operations.
*/
-static msg_t thread3(void *p) {
+static THD_FUNCTION(thread3, p) {
(void)p;
while (!chThdShouldTerminateX())
chSemWait(&sem1);
- return 0;
}
static void bmk7_setup(void) {
@@ -405,7 +402,7 @@ ROMCONST struct testcase testbmk7 = {
* a second of continuous operations.
*/
-static msg_t thread8(void *p) {
+static THD_FUNCTION(thread8, p) {
do {
chThdYield();
@@ -417,7 +414,6 @@ static msg_t thread8(void *p) {
_sim_check_for_interrupts();
#endif
} while(!chThdShouldTerminateX());
- return 0;
}
static void bmk8_execute(void) {
diff --git a/test/rt/testbuild/main.c b/test/rt/testbuild/main.c
index 540a8a7d0..5eccafa5a 100644
--- a/test/rt/testbuild/main.c
+++ b/test/rt/testbuild/main.c
@@ -26,7 +26,6 @@
* Simulator main.
*/
int main(int argc, char *argv[]) {
- msg_t result;
(void)argc;
(void)argv;
@@ -42,8 +41,8 @@ int main(int argc, char *argv[]) {
conInit();
chSysInit();
- result = TestThread(&CD1);
- if (result)
+ TestThread(&CD1);
+ if (test_global_fail)
exit(1);
else
exit(0);
diff --git a/test/rt/testdyn.c b/test/rt/testdyn.c
index f085e7ae8..8dd6d5bf2 100644
--- a/test/rt/testdyn.c
+++ b/test/rt/testdyn.c
@@ -68,10 +68,9 @@ static memory_pool_t mp1;
* one to fail.
*/
-static msg_t thread(void *p) {
+static THD_FUNCTION(thread, p) {
test_emit_token(*(char *)p);
- return 0;
}
#if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
diff --git a/test/rt/testevt.c b/test/rt/testevt.c
index 5a7aa1b93..cc4a456d5 100644
--- a/test/rt/testevt.c
+++ b/test/rt/testevt.c
@@ -130,20 +130,18 @@ static void evt2_setup(void) {
chEvtGetAndClearEvents(ALL_EVENTS);
}
-static msg_t thread1(void *p) {
+static THD_FUNCTION(thread1, p) {
chThdSleepMilliseconds(50);
chEvtSignal((thread_t *)p, 1);
- return 0;
}
-static msg_t thread2(void *p) {
+static THD_FUNCTION(thread2, p) {
(void)p;
chEvtBroadcast(&es1);
chThdSleepMilliseconds(50);
chEvtBroadcast(&es2);
- return 0;
}
static void evt2_execute(void) {
diff --git a/test/rt/testmsg.c b/test/rt/testmsg.c
index aa04ce744..2a98d0fc6 100644
--- a/test/rt/testmsg.c
+++ b/test/rt/testmsg.c
@@ -56,12 +56,11 @@
* not find a fifth message waiting.
*/
-static msg_t thread(void *p) {
+static THD_FUNCTION(thread, p) {
chMsgSend(p, 'A');
chMsgSend(p, 'B');
chMsgSend(p, 'C');
- return 0;
}
static void msg1_execute(void) {
diff --git a/test/rt/testmtx.c b/test/rt/testmtx.c
index f15e82dc7..f34072ad0 100644
--- a/test/rt/testmtx.c
+++ b/test/rt/testmtx.c
@@ -86,12 +86,11 @@ static void mtx1_setup(void) {
chMtxObjectInit(&m1);
}
-static msg_t thread1(void *p) {
+static THD_FUNCTION(thread1, p) {
chMtxLock(&m1);
test_emit_token(*(char *)p);
chMtxUnlock(&m1);
- return 0;
}
static void mtx1_execute(void) {
@@ -154,7 +153,7 @@ static void mtx2_setup(void) {
}
/* Low priority thread */
-static msg_t thread2L(void *p) {
+static THD_FUNCTION(thread2L, p) {
(void)p;
chMtxLock(&m1);
@@ -162,21 +161,19 @@ static msg_t thread2L(void *p) {
chMtxUnlock(&m1);
test_cpu_pulse(10);
test_emit_token('C');
- return 0;
}
/* Medium priority thread */
-static msg_t thread2M(void *p) {
+static THD_FUNCTION(thread2M, p) {
(void)p;
chThdSleepMilliseconds(20);
test_cpu_pulse(40);
test_emit_token('B');
- return 0;
}
/* High priority thread */
-static msg_t thread2H(void *p) {
+static THD_FUNCTION(thread2H, p) {
(void)p;
chThdSleepMilliseconds(40);
@@ -184,7 +181,6 @@ static msg_t thread2H(void *p) {
test_cpu_pulse(10);
chMtxUnlock(&m1);
test_emit_token('A');
- return 0;
}
static void mtx2_execute(void) {
@@ -245,18 +241,17 @@ static void mtx3_setup(void) {
}
/* Lowest priority thread */
-static msg_t thread3LL(void *p) {
+static THD_FUNCTION(thread3LL, p) {
(void)p;
chMtxLock(&m1);
test_cpu_pulse(30);
chMtxUnlock(&m1);
test_emit_token('E');
- return 0;
}
/* Low priority thread */
-static msg_t thread3L(void *p) {
+static THD_FUNCTION(thread3L, p) {
(void)p;
chThdSleepMilliseconds(10);
@@ -268,11 +263,10 @@ static msg_t thread3L(void *p) {
test_cpu_pulse(10);
chMtxUnlock(&m2);
test_emit_token('D');
- return 0;
}
/* Medium priority thread */
-static msg_t thread3M(void *p) {
+static THD_FUNCTION(thread3M, p) {
(void)p;
chThdSleepMilliseconds(20);
@@ -280,21 +274,19 @@ static msg_t thread3M(void *p) {
test_cpu_pulse(10);
chMtxUnlock(&m2);
test_emit_token('C');
- return 0;
}
/* High priority thread */
-static msg_t thread3H(void *p) {
+static THD_FUNCTION(thread3H, p) {
(void)p;
chThdSleepMilliseconds(40);
test_cpu_pulse(20);
test_emit_token('B');
- return 0;
}
/* Highest priority thread */
-static msg_t thread3HH(void *p) {
+static THD_FUNCTION(thread3HH, p) {
(void)p;
chThdSleepMilliseconds(50);
@@ -302,7 +294,6 @@ static msg_t thread3HH(void *p) {
test_cpu_pulse(10);
chMtxUnlock(&m2);
test_emit_token('A');
- return 0;
}
static void mtx3_execute(void) {
@@ -344,22 +335,20 @@ static void mtx4_setup(void) {
chMtxObjectInit(&m2);
}
-static msg_t thread4a(void *p) {
+static THD_FUNCTION(thread4a, p) {
(void)p;
chThdSleepMilliseconds(50);
chMtxLock(&m2);
chMtxUnlock(&m2);
- return 0;
}
-static msg_t thread4b(void *p) {
+static THD_FUNCTION(thread4b, p) {
(void)p;
chThdSleepMilliseconds(150);
chMtxLock(&m1);
chMtxUnlock(&m1);
- return 0;
}
static void mtx4_execute(void) {
@@ -483,13 +472,12 @@ static void mtx6_setup(void) {
chMtxObjectInit(&m1);
}
-static msg_t thread10(void *p) {
+static THD_FUNCTION(thread10, p) {
chMtxLock(&m1);
chCondWait(&c1);
test_emit_token(*(char *)p);
chMtxUnlock(&m1);
- return 0;
}
static void mtx6_execute(void) {
@@ -571,7 +559,7 @@ static void mtx8_setup(void) {
chMtxObjectInit(&m2);
}
-static msg_t thread11(void *p) {
+static THD_FUNCTION(thread11, p) {
chMtxLock(&m2);
chMtxLock(&m1);
@@ -583,15 +571,13 @@ static msg_t thread11(void *p) {
test_emit_token(*(char *)p);
chMtxUnlock(&m1);
chMtxUnlock(&m2);
- return 0;
}
-static msg_t thread12(void *p) {
+static THD_FUNCTION(thread12, p) {
chMtxLock(&m2);
test_emit_token(*(char *)p);
chMtxUnlock(&m2);
- return 0;
}
static void mtx8_execute(void) {
diff --git a/test/rt/testqueues.c b/test/rt/testqueues.c
index ebd06435e..50981f26c 100644
--- a/test/rt/testqueues.c
+++ b/test/rt/testqueues.c
@@ -70,7 +70,7 @@ static OUTPUTQUEUE_DECL(oq, test.wa.T1, TEST_QUEUES_SIZE, notify, NULL);
* @page test_queues_001 Input Queues functionality and APIs
*
*
Description
- * This test case tests sysnchronos and asynchronous operations on an
+ * This test case tests synchronous and asynchronous operations on an
* @p InputQueue object including timeouts. The queue state must remain
* consistent through the whole test.
*/
@@ -80,11 +80,10 @@ static void queues1_setup(void) {
chIQObjectInit(&iq, wa[0], TEST_QUEUES_SIZE, notify, NULL);
}
-static msg_t thread1(void *p) {
+static THD_FUNCTION(thread1, p) {
(void)p;
chIQGetTimeout(&iq, MS2ST(200));
- return 0;
}
static void queues1_execute(void) {
@@ -157,7 +156,7 @@ ROMCONST struct testcase testqueues1 = {
* @page test_queues_002 Output Queues functionality and APIs
*
* Description
- * This test case tests sysnchronos and asynchronous operations on an
+ * This test case tests synchronous and asynchronous operations on an
* @p OutputQueue object including timeouts. The queue state must remain
* consistent through the whole test.
*/
@@ -167,11 +166,10 @@ static void queues2_setup(void) {
chOQObjectInit(&oq, wa[0], TEST_QUEUES_SIZE, notify, NULL);
}
-static msg_t thread2(void *p) {
+static THD_FUNCTION(thread2, p) {
(void)p;
chOQPutTimeout(&oq, 0, MS2ST(200));
- return 0;
}
static void queues2_execute(void) {
diff --git a/test/rt/testsem.c b/test/rt/testsem.c
index 11965695e..c8258b2de 100644
--- a/test/rt/testsem.c
+++ b/test/rt/testsem.c
@@ -74,11 +74,10 @@ static void sem1_setup(void) {
chSemObjectInit(&sem1, 0);
}
-static msg_t thread1(void *p) {
+static THD_FUNCTION(thread1, p) {
chSemWait(&sem1);
test_emit_token(*(char *)p);
- return 0;
}
static void sem1_execute(void) {
@@ -131,7 +130,7 @@ static void sem2_setup(void) {
chSemObjectInit(&sem1, 0);
}
-static msg_t thread2(void *p) {
+static THD_FUNCTION(thread2, p) {
(void)p;
chThdSleepMilliseconds(50);
@@ -139,7 +138,6 @@ static msg_t thread2(void *p) {
chSemSignalI(&sem1); /* For coverage reasons */
chSchRescheduleS();
chSysUnlock();
- return 0;
}
static void sem2_execute(void) {
@@ -206,12 +204,11 @@ static void sem3_setup(void) {
chSemObjectInit(&sem1, 0);
}
-static msg_t thread3(void *p) {
+static THD_FUNCTION(thread3, p) {
(void)p;
chSemWait(&sem1);
chSemSignal(&sem1);
- return 0;
}
static void sem3_execute(void) {
@@ -241,10 +238,9 @@ ROMCONST struct testcase testsem3 = {
* checks the binary semaphore status and the expected status of the underlying
* counting semaphore.
*/
-static msg_t thread4(void *p) {
+static THD_FUNCTION(thread4, p) {
chBSemSignal((binary_semaphore_t *)p);
- return 0;
}
static void sem4_execute(void) {
diff --git a/test/rt/testthd.c b/test/rt/testthd.c
index 0f0c88c86..5b1127aa3 100644
--- a/test/rt/testthd.c
+++ b/test/rt/testthd.c
@@ -57,10 +57,9 @@
* priority order regardless of the initial order.
*/
-static msg_t thread(void *p) {
+static THD_FUNCTION(thread, p) {
test_emit_token(*(char *)p);
- return 0;
}
static void thd1_execute(void) {
diff --git a/testhal/AVR/I2C/main.c b/testhal/AVR/I2C/main.c
index fc68956c3..50d979693 100644
--- a/testhal/AVR/I2C/main.c
+++ b/testhal/AVR/I2C/main.c
@@ -20,11 +20,10 @@
static WORKING_AREA(waThread1, 32);
static msg_t Thread1(void *arg) {
- while (TRUE) {
+ while (true) {
palTogglePad(IOPORT2, PORTB_LED1);
chThdSleepMilliseconds(1000);
}
- return 0;
}
/*
diff --git a/testhal/AVR/ICU/main.c b/testhal/AVR/ICU/main.c
index 2cbe1db2e..3faaed2ee 100644
--- a/testhal/AVR/ICU/main.c
+++ b/testhal/AVR/ICU/main.c
@@ -58,7 +58,7 @@ void output_single_cycle(const uint16_t low, const uint16_t high) {
}
static WORKING_AREA(waThread1, 64);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
thread1 = chThdGetSelfX();
@@ -71,11 +71,10 @@ static msg_t Thread1(void *arg) {
period);
chEvtSignal(thread_main, (eventmask_t) 1);
}
- return 0;
}
static WORKING_AREA(waThread2, 64);
-static msg_t Thread2(void *arg) {
+static THD_FUNCTION(Thread2, arg) {
BaseSequentialStream *serp = (BaseSequentialStream *) &SD1;
thread2 = chThdGetSelfX();
@@ -84,7 +83,6 @@ static msg_t Thread2(void *arg) {
chprintf(serp, "OVERFLOW\r\n");
chEvtSignal(thread_main, (eventmask_t) 2);
}
- return 0;
}
int main(void) {
diff --git a/testhal/KINETIS/I2C/main.c b/testhal/KINETIS/I2C/main.c
index 1b10ba166..8c0df50b0 100644
--- a/testhal/KINETIS/I2C/main.c
+++ b/testhal/KINETIS/I2C/main.c
@@ -37,8 +37,6 @@ static THD_FUNCTION(Thread1, arg) {
}
chThdSleepMilliseconds(500);
}
-
- return 0;
}
/*
diff --git a/testhal/STM32/STM32F0xx/ADC/main.c b/testhal/STM32/STM32F0xx/ADC/main.c
index 8b36522c5..00471e038 100644
--- a/testhal/STM32/STM32F0xx/ADC/main.c
+++ b/testhal/STM32/STM32F0xx/ADC/main.c
@@ -84,11 +84,11 @@ static const ADCConversionGroup adcgrpcfg2 = {
* Red LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED4);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED4);
@@ -142,7 +142,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
adcSTM32SetCCR(0);
diff --git a/testhal/STM32/STM32F0xx/EXT/main.c b/testhal/STM32/STM32F0xx/EXT/main.c
index 51844bbda..171983f00 100644
--- a/testhal/STM32/STM32F0xx/EXT/main.c
+++ b/testhal/STM32/STM32F0xx/EXT/main.c
@@ -89,7 +89,7 @@ int main(void) {
* Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F0xx/IRQ_STORM/main.c b/testhal/STM32/STM32F0xx/IRQ_STORM/main.c
index 9127ac762..ef5e498a9 100644
--- a/testhal/STM32/STM32F0xx/IRQ_STORM/main.c
+++ b/testhal/STM32/STM32F0xx/IRQ_STORM/main.c
@@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE];
* Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) {
chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -325,7 +325,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
return 0;
diff --git a/testhal/STM32/STM32F0xx/PWM-ICU/main.c b/testhal/STM32/STM32F0xx/PWM-ICU/main.c
index 084929b17..bf700e4f1 100644
--- a/testhal/STM32/STM32F0xx/PWM-ICU/main.c
+++ b/testhal/STM32/STM32F0xx/PWM-ICU/main.c
@@ -141,7 +141,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F0xx/SPI/main.c b/testhal/STM32/STM32F0xx/SPI/main.c
index b0e4c1c3b..8e5fa0458 100644
--- a/testhal/STM32/STM32F0xx/SPI/main.c
+++ b/testhal/STM32/STM32F0xx/SPI/main.c
@@ -49,11 +49,11 @@ static uint8_t rxbuf[512];
* SPI bus contender 1.
*/
static THD_WORKING_AREA(spi_thread_1_wa, 256);
-static msg_t spi_thread_1(void *p) {
+static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOC, GPIOC_LED4); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -63,18 +63,17 @@ static msg_t spi_thread_1(void *p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* SPI bus contender 2.
*/
static THD_WORKING_AREA(spi_thread_2_wa, 256);
-static msg_t spi_thread_2(void *p) {
+static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOC, GPIOC_LED4); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,18 +83,17 @@ static msg_t spi_thread_2(void *p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(blinker_wa, 128);
-static msg_t blinker(void *arg) {
+static THD_FUNCTION(blinker, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED3);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED3);
@@ -155,7 +153,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F0xx/UART/main.c b/testhal/STM32/STM32F0xx/UART/main.c
index 2c7f79b34..363607890 100644
--- a/testhal/STM32/STM32F0xx/UART/main.c
+++ b/testhal/STM32/STM32F0xx/UART/main.c
@@ -136,7 +136,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
diff --git a/testhal/STM32/STM32F0xx/USB_CDC/main.c b/testhal/STM32/STM32F0xx/USB_CDC/main.c
index 43ac2c294..2866b85ce 100644
--- a/testhal/STM32/STM32F0xx/USB_CDC/main.c
+++ b/testhal/STM32/STM32F0xx/USB_CDC/main.c
@@ -438,11 +438,11 @@ static const ShellConfig shell_cfg1 = {
* Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOC, GPIOC_LED_RED);
chThdSleepMilliseconds(time);
@@ -497,7 +497,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F1xx/ADC/main.c b/testhal/STM32/STM32F1xx/ADC/main.c
index 6000aba83..ae54da840 100644
--- a/testhal/STM32/STM32F1xx/ADC/main.c
+++ b/testhal/STM32/STM32F1xx/ADC/main.c
@@ -95,13 +95,12 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(IOPORT3, GPIOC_LED);
chThdSleepMilliseconds(500);
palSetPad(IOPORT3, GPIOC_LED);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -149,7 +148,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
adcStopConversion(&ADCD1);
chThdSleepMilliseconds(500);
diff --git a/testhal/STM32/STM32F1xx/CAN/main.c b/testhal/STM32/STM32F1xx/CAN/main.c
index c24a74297..5fb0d6abb 100644
--- a/testhal/STM32/STM32F1xx/CAN/main.c
+++ b/testhal/STM32/STM32F1xx/CAN/main.c
@@ -48,7 +48,6 @@ static THD_FUNCTION(can_rx, p) {
}
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
@@ -71,7 +70,6 @@ static THD_FUNCTION(can_tx, p) {
canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -104,7 +102,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/EXT/main.c b/testhal/STM32/STM32F1xx/EXT/main.c
index 6b6749a3d..2a6fa80a5 100644
--- a/testhal/STM32/STM32F1xx/EXT/main.c
+++ b/testhal/STM32/STM32F1xx/EXT/main.c
@@ -89,7 +89,7 @@ int main(void) {
* Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F1xx/I2C/main.c b/testhal/STM32/STM32F1xx/I2C/main.c
index 67a5c0aab..36fb15ac5 100644
--- a/testhal/STM32/STM32F1xx/I2C/main.c
+++ b/testhal/STM32/STM32F1xx/I2C/main.c
@@ -42,14 +42,14 @@ static float acc[3];
*/
static THD_WORKING_AREA(PollAccelThreadWA, 256);
static THD_FUNCTION(PollAccelThread, arg) {
- chRegSetThreadName("PollAccel");
+
(void)arg;
- while (TRUE) {
+ chRegSetThreadName("PollAccel");
+ while (true) {
osalThreadSleepMilliseconds(32);
lis3GetAcc(acc);
}
- return 0;
}
/*
@@ -57,14 +57,14 @@ static THD_FUNCTION(PollAccelThread, arg) {
*/
static THD_WORKING_AREA(PollFakeThreadWA, 256);
static THD_FUNCTION(PollFakeThread, arg) {
- chRegSetThreadName("PollFake");
+
(void)arg;
- while (TRUE) {
+ chRegSetThreadName("PollFake");
+ while (true) {
osalThreadSleepMilliseconds(16);
request_fake();
}
- return 0;
}
/*
@@ -103,7 +103,7 @@ int main(void) {
NULL);
/* main loop handles LED */
- while (TRUE) {
+ while (true) {
if (sqrtf(acc[0]*acc[0] + acc[1]*acc[1]) > 0.5)
palClearPad(IOPORT3, GPIOC_LED); /* on */
else
diff --git a/testhal/STM32/STM32F1xx/IRQ_STORM/main.c b/testhal/STM32/STM32F1xx/IRQ_STORM/main.c
index d4f06cf8b..1cc385d86 100644
--- a/testhal/STM32/STM32F1xx/IRQ_STORM/main.c
+++ b/testhal/STM32/STM32F1xx/IRQ_STORM/main.c
@@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE];
* Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) {
chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -327,7 +327,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F1xx/PWM-ICU/main.c b/testhal/STM32/STM32F1xx/PWM-ICU/main.c
index 52d66c850..d19819da0 100644
--- a/testhal/STM32/STM32F1xx/PWM-ICU/main.c
+++ b/testhal/STM32/STM32F1xx/PWM-ICU/main.c
@@ -137,7 +137,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/RTC/main.c b/testhal/STM32/STM32F1xx/RTC/main.c
index b43362453..573a31569 100644
--- a/testhal/STM32/STM32F1xx/RTC/main.c
+++ b/testhal/STM32/STM32F1xx/RTC/main.c
@@ -30,7 +30,7 @@ RTCAlarm alarmspec;
static THD_WORKING_AREA(blinkWA, 128);
static THD_FUNCTION(blink_thd, arg) {
(void)arg;
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(100);
palTogglePad(GPIOC, GPIOC_LED);
}
@@ -57,7 +57,7 @@ int main(void) {
alarmspec.tv_sec = tv_sec + 20;
rtcSetAlarm(&RTCD1, 0, &alarmspec);
- while (TRUE){
+ while (true){
chThdSleepSeconds(10);
/* going to anabiosis*/
@@ -138,7 +138,7 @@ int main(void) {
rtcSetCallback(&RTCD1, my_cb);
- while (TRUE){
+ while (true){
/* Wait until alarm callback signaled semaphore.*/
status = chBSemWaitTimeout(&alarm_sem, S2ST(RTC_ALARMPERIOD + 5));
diff --git a/testhal/STM32/STM32F1xx/SPI/main.c b/testhal/STM32/STM32F1xx/SPI/main.c
index 5c55ccd45..ff8ea72fa 100644
--- a/testhal/STM32/STM32F1xx/SPI/main.c
+++ b/testhal/STM32/STM32F1xx/SPI/main.c
@@ -52,7 +52,7 @@ static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
palClearPad(IOPORT3, GPIOC_LED); /* LED ON. */
spiStart(&SPID1, &hs_spicfg); /* Setup transfer parameters. */
@@ -62,7 +62,6 @@ static THD_FUNCTION(spi_thread_1, p) {
spiUnselect(&SPID1); /* Slave Select de-assertion. */
spiReleaseBus(&SPID1); /* Ownership release. */
}
- return 0;
}
/*
@@ -74,7 +73,7 @@ static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
palSetPad(IOPORT3, GPIOC_LED); /* LED OFF. */
spiStart(&SPID1, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,7 +83,6 @@ static THD_FUNCTION(spi_thread_2, p) {
spiUnselect(&SPID1); /* Slave Select de-assertion. */
spiReleaseBus(&SPID1); /* Ownership release. */
}
- return 0;
}
/*
@@ -129,7 +127,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/UART/main.c b/testhal/STM32/STM32F1xx/UART/main.c
index 36b26d385..b77c09df9 100644
--- a/testhal/STM32/STM32F1xx/UART/main.c
+++ b/testhal/STM32/STM32F1xx/UART/main.c
@@ -138,7 +138,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/USB_CDC/main.c b/testhal/STM32/STM32F1xx/USB_CDC/main.c
index da03352bd..eae64e0b5 100644
--- a/testhal/STM32/STM32F1xx/USB_CDC/main.c
+++ b/testhal/STM32/STM32F1xx/USB_CDC/main.c
@@ -441,8 +441,9 @@ static THD_WORKING_AREA(waThread1, 128);
static THD_FUNCTION(Thread1, arg) {
(void)arg;
+
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(IOPORT3, GPIOC_LED);
chThdSleepMilliseconds(time);
@@ -497,7 +498,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c b/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c
index 0e4602b2c..3394dbe1b 100644
--- a/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c
+++ b/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c
@@ -442,7 +442,7 @@ static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(IOPORT3, GPIOC_LED_STATUS1);
chThdSleepMilliseconds(time);
@@ -497,7 +497,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminated(shelltp)) {
diff --git a/testhal/STM32/STM32F30x/ADC/main.c b/testhal/STM32/STM32F30x/ADC/main.c
index 046757687..0686becb7 100644
--- a/testhal/STM32/STM32F30x/ADC/main.c
+++ b/testhal/STM32/STM32F30x/ADC/main.c
@@ -105,17 +105,16 @@ static const ADCConversionGroup adcgrpcfg2 = {
* Red LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
palClearPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -163,7 +162,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
}
diff --git a/testhal/STM32/STM32F30x/ADC_DUAL/main.c b/testhal/STM32/STM32F30x/ADC_DUAL/main.c
index 98fc6dd72..b77e267b2 100644
--- a/testhal/STM32/STM32F30x/ADC_DUAL/main.c
+++ b/testhal/STM32/STM32F30x/ADC_DUAL/main.c
@@ -129,17 +129,16 @@ static const ADCConversionGroup adcgrpcfg2 = {
* Red LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
palClearPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -187,7 +186,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
}
diff --git a/testhal/STM32/STM32F30x/CAN/main.c b/testhal/STM32/STM32F30x/CAN/main.c
index a1f281cf9..e9511c17b 100644
--- a/testhal/STM32/STM32F30x/CAN/main.c
+++ b/testhal/STM32/STM32F30x/CAN/main.c
@@ -31,7 +31,7 @@ static const CANConfig cancfg = {
* Receiver thread.
*/
static THD_WORKING_AREA(can_rx_wa, 256);
-static msg_t can_rx(void *p) {
+static THD_FUNCTION(can_rx, p) {
event_listener_t el;
CANRxFrame rxmsg;
@@ -47,14 +47,13 @@ static msg_t can_rx(void *p) {
}
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
* Transmitter thread.
*/
static THD_WORKING_AREA(can_tx_wa, 256);
-static msg_t can_tx(void * p) {
+static THD_FUNCTION(can_tx, p) {
CANTxFrame txmsg;
(void)p;
@@ -70,7 +69,6 @@ static msg_t can_tx(void * p) {
canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -102,7 +100,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F30x/EXT/main.c b/testhal/STM32/STM32F30x/EXT/main.c
index a8800a141..c905da39f 100644
--- a/testhal/STM32/STM32F30x/EXT/main.c
+++ b/testhal/STM32/STM32F30x/EXT/main.c
@@ -93,7 +93,7 @@ int main(void) {
* Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F30x/IRQ_STORM/main.c b/testhal/STM32/STM32F30x/IRQ_STORM/main.c
index 2472d0a75..09d922afe 100644
--- a/testhal/STM32/STM32F30x/IRQ_STORM/main.c
+++ b/testhal/STM32/STM32F30x/IRQ_STORM/main.c
@@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE];
* Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) {
chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -329,7 +329,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F30x/PWM-ICU/main.c b/testhal/STM32/STM32F30x/PWM-ICU/main.c
index d1bc47e5f..ee9f8a8d2 100644
--- a/testhal/STM32/STM32F30x/PWM-ICU/main.c
+++ b/testhal/STM32/STM32F30x/PWM-ICU/main.c
@@ -136,7 +136,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F30x/SPI/main.c b/testhal/STM32/STM32F30x/SPI/main.c
index b7e6398b2..62610dfa5 100644
--- a/testhal/STM32/STM32F30x/SPI/main.c
+++ b/testhal/STM32/STM32F30x/SPI/main.c
@@ -49,11 +49,11 @@ static uint8_t rxbuf[512];
* SPI bus contender 1.
*/
static THD_WORKING_AREA(spi_thread_1_wa, 256);
-static msg_t spi_thread_1(void *p) {
+static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOE, GPIOE_LED10_RED); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -63,18 +63,17 @@ static msg_t spi_thread_1(void *p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* SPI bus contender 2.
*/
static THD_WORKING_AREA(spi_thread_2_wa, 256);
-static msg_t spi_thread_2(void *p) {
+static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOE, GPIOE_LED10_RED);/* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,18 +83,17 @@ static msg_t spi_thread_2(void *p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(blinker_wa, 128);
-static msg_t blinker(void *arg) {
+static THD_FUNCTION(blinker, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(500);
palClearPad(GPIOE, GPIOE_LED3_RED);
@@ -155,7 +153,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F30x/UART/main.c b/testhal/STM32/STM32F30x/UART/main.c
index 68a9e31c6..35d48f70b 100644
--- a/testhal/STM32/STM32F30x/UART/main.c
+++ b/testhal/STM32/STM32F30x/UART/main.c
@@ -136,7 +136,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
diff --git a/testhal/STM32/STM32F30x/USB_CDC/main.c b/testhal/STM32/STM32F30x/USB_CDC/main.c
index 834a9c2c6..c40a82cb1 100644
--- a/testhal/STM32/STM32F30x/USB_CDC/main.c
+++ b/testhal/STM32/STM32F30x/USB_CDC/main.c
@@ -445,11 +445,11 @@ static const ShellConfig shell_cfg1 = {
* Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(time);
@@ -504,7 +504,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c b/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c
index b3d664317..bada16558 100644
--- a/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c
+++ b/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c
@@ -154,11 +154,11 @@ static const ShellConfig shell_cfg2 = {
* Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg1.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(time);
@@ -216,7 +216,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp1 && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp1)) {
diff --git a/testhal/STM32/STM32F37x/ADC/main.c b/testhal/STM32/STM32F37x/ADC/main.c
index fb6f5c8f4..063683a3d 100644
--- a/testhal/STM32/STM32F37x/ADC/main.c
+++ b/testhal/STM32/STM32F37x/ADC/main.c
@@ -111,13 +111,12 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -163,7 +162,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_WKUP_BUTTON)) {
adcStopConversion(&ADCD1);
}
diff --git a/testhal/STM32/STM32F37x/CAN/main.c b/testhal/STM32/STM32F37x/CAN/main.c
index 21da0b697..5b50a102e 100644
--- a/testhal/STM32/STM32F37x/CAN/main.c
+++ b/testhal/STM32/STM32F37x/CAN/main.c
@@ -47,7 +47,6 @@ static THD_FUNCTION(can_rx, p) {
}
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
@@ -70,7 +69,6 @@ static THD_FUNCTION(can_tx, p) {
canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -102,7 +100,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F37x/EXT/main.c b/testhal/STM32/STM32F37x/EXT/main.c
index 296478d84..3ce6a34f3 100644
--- a/testhal/STM32/STM32F37x/EXT/main.c
+++ b/testhal/STM32/STM32F37x/EXT/main.c
@@ -91,7 +91,7 @@ int main(void) {
* Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F37x/I2C/main.c b/testhal/STM32/STM32F37x/I2C/main.c
index 92a7c0ab9..5eb3dcbaa 100644
--- a/testhal/STM32/STM32F37x/I2C/main.c
+++ b/testhal/STM32/STM32F37x/I2C/main.c
@@ -50,13 +50,12 @@ static THD_FUNCTION(blinker, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -88,7 +87,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
unsigned i;
msg_t msg;
static const uint8_t cmd[] = {0, 0};
diff --git a/testhal/STM32/STM32F37x/IRQ_STORM/main.c b/testhal/STM32/STM32F37x/IRQ_STORM/main.c
index 34ae66902..f7a2fd642 100644
--- a/testhal/STM32/STM32F37x/IRQ_STORM/main.c
+++ b/testhal/STM32/STM32F37x/IRQ_STORM/main.c
@@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE];
* Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) {
chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -328,7 +328,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F37x/PWM-ICU/main.c b/testhal/STM32/STM32F37x/PWM-ICU/main.c
index 5188ad9b3..bb23765d2 100644
--- a/testhal/STM32/STM32F37x/PWM-ICU/main.c
+++ b/testhal/STM32/STM32F37x/PWM-ICU/main.c
@@ -134,7 +134,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F37x/SDADC/main.c b/testhal/STM32/STM32F37x/SDADC/main.c
index 2abf339b3..1285a5793 100644
--- a/testhal/STM32/STM32F37x/SDADC/main.c
+++ b/testhal/STM32/STM32F37x/SDADC/main.c
@@ -108,13 +108,12 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -156,7 +155,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_WKUP_BUTTON)) {
adcStopConversion(&SDADCD1);
}
diff --git a/testhal/STM32/STM32F37x/SPI/main.c b/testhal/STM32/STM32F37x/SPI/main.c
index f15de5a1f..a2de89200 100644
--- a/testhal/STM32/STM32F37x/SPI/main.c
+++ b/testhal/STM32/STM32F37x/SPI/main.c
@@ -54,7 +54,7 @@ static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOC, GPIOC_LED2); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -64,7 +64,6 @@ static THD_FUNCTION(spi_thread_1, p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -76,7 +75,7 @@ static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOC, GPIOC_LED2); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -86,7 +85,6 @@ static THD_FUNCTION(spi_thread_2, p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -99,7 +97,7 @@ static THD_FUNCTION(blinker, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED1);
@@ -154,7 +152,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F37x/UART/main.c b/testhal/STM32/STM32F37x/UART/main.c
index dc1a80b58..5ce33d16d 100644
--- a/testhal/STM32/STM32F37x/UART/main.c
+++ b/testhal/STM32/STM32F37x/UART/main.c
@@ -134,7 +134,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
diff --git a/testhal/STM32/STM32F37x/USB_CDC/main.c b/testhal/STM32/STM32F37x/USB_CDC/main.c
index 516181b64..9eea7d19c 100644
--- a/testhal/STM32/STM32F37x/USB_CDC/main.c
+++ b/testhal/STM32/STM32F37x/USB_CDC/main.c
@@ -449,7 +449,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(time);
@@ -504,7 +504,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F4xx/ADC/main.c b/testhal/STM32/STM32F4xx/ADC/main.c
index 6b2c9846d..7a1cd59a7 100644
--- a/testhal/STM32/STM32F4xx/ADC/main.c
+++ b/testhal/STM32/STM32F4xx/ADC/main.c
@@ -92,11 +92,11 @@ static const ADCConversionGroup adcgrpcfg2 = {
* Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED5);
chThdSleepMilliseconds(500);
palClearPad(GPIOD, GPIOD_LED5);
@@ -150,7 +150,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
adcSTM32DisableTSVREFE();
diff --git a/testhal/STM32/STM32F4xx/CAN/main.c b/testhal/STM32/STM32F4xx/CAN/main.c
index ebdaf2fab..b7ae9dc79 100644
--- a/testhal/STM32/STM32F4xx/CAN/main.c
+++ b/testhal/STM32/STM32F4xx/CAN/main.c
@@ -41,7 +41,7 @@ static const CANConfig cancfg = {
*/
static THD_WORKING_AREA(can_rx1_wa, 256);
static THD_WORKING_AREA(can_rx2_wa, 256);
-static msg_t can_rx(void *p) {
+static THD_FUNCTION(can_rx, p) {
struct can_instance *cip = p;
event_listener_t el;
CANRxFrame rxmsg;
@@ -59,14 +59,13 @@ static msg_t can_rx(void *p) {
}
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
* Transmitter thread.
*/
static THD_WORKING_AREA(can_tx_wa, 256);
-static msg_t can_tx(void * p) {
+static THD_FUNCTION(can_tx, p) {
CANTxFrame txmsg;
(void)p;
@@ -83,7 +82,6 @@ static msg_t can_tx(void * p) {
canTransmit(&CAND2, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -120,7 +118,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/DAC/main.c b/testhal/STM32/STM32F4xx/DAC/main.c
index 62f9a2c6f..8049ce958 100644
--- a/testhal/STM32/STM32F4xx/DAC/main.c
+++ b/testhal/STM32/STM32F4xx/DAC/main.c
@@ -36,7 +36,7 @@ int main(void) {
* Normal main() thread activity, if the button is pressed then the I2s
* transfer is stopped.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/DMA_STORM/main.c b/testhal/STM32/STM32F4xx/DMA_STORM/main.c
index 05265aa38..d119613f9 100644
--- a/testhal/STM32/STM32F4xx/DMA_STORM/main.c
+++ b/testhal/STM32/STM32F4xx/DMA_STORM/main.c
@@ -82,7 +82,7 @@ static void tmo(void *p) {
static THD_WORKING_AREA(waSPI1, 1024);
static THD_WORKING_AREA(waSPI2, 1024);
static THD_WORKING_AREA(waSPI3, 1024);
-static msg_t spi_thread(void *p) {
+static THD_FUNCTION(spi_thread, p) {
unsigned i;
SPIDriver *spip = (SPIDriver *)p;
virtual_timer_t vt;
@@ -96,7 +96,7 @@ static msg_t spi_thread(void *p) {
txbuf[i] = (uint8_t)i;
/* Continuous transmission.*/
- while (TRUE) {
+ while (true) {
/* Starts a VT working as watchdog to catch a malfunction in the SPI
driver.*/
chVTSet(&vt, MS2ST(10), tmo, NULL);
@@ -113,11 +113,11 @@ static msg_t spi_thread(void *p) {
* a LED.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED3); /* Orange. */
chThdSleepMilliseconds(500);
palClearPad(GPIOD, GPIOD_LED3); /* Orange. */
@@ -173,7 +173,7 @@ int main(void) {
/* Normal main() thread activity, it does continues memory copy operations
using 2 DMA streams at the lowest priority.*/
- while (TRUE) {
+ while (true) {
virtual_timer_t vt;
chVTObjectInit(&vt);
diff --git a/testhal/STM32/STM32F4xx/EXT/main.c b/testhal/STM32/STM32F4xx/EXT/main.c
index 66e41c3a9..e85774cc6 100644
--- a/testhal/STM32/STM32F4xx/EXT/main.c
+++ b/testhal/STM32/STM32F4xx/EXT/main.c
@@ -91,7 +91,7 @@ int main(void) {
* Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F4xx/GPT/main.c b/testhal/STM32/STM32F4xx/GPT/main.c
index a1d6fd007..e58f7e0a1 100644
--- a/testhal/STM32/STM32F4xx/GPT/main.c
+++ b/testhal/STM32/STM32F4xx/GPT/main.c
@@ -85,7 +85,7 @@ int main(void) {
* Normal main() thread activity, it changes the GPT1 period every
* five seconds.
*/
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED4);
gptStartContinuous(&GPTD4, 5000);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F4xx/I2C/main.c b/testhal/STM32/STM32F4xx/I2C/main.c
index e7ccffb57..8b3369e75 100644
--- a/testhal/STM32/STM32F4xx/I2C/main.c
+++ b/testhal/STM32/STM32F4xx/I2C/main.c
@@ -150,7 +150,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
palTogglePad(GPIOB, GPIOB_LED_B);
chThdSleepMilliseconds(100);
diff --git a/testhal/STM32/STM32F4xx/I2S/main.c b/testhal/STM32/STM32F4xx/I2S/main.c
index b27861411..21895f7d3 100644
--- a/testhal/STM32/STM32F4xx/I2S/main.c
+++ b/testhal/STM32/STM32F4xx/I2S/main.c
@@ -70,7 +70,7 @@ int main(void) {
* Normal main() thread activity, if the button is pressed then the I2s
* transfer is stopped.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
i2sStopExchange(&I2SD2);
chThdSleepMilliseconds(500);
diff --git a/testhal/STM32/STM32F4xx/IRQ_STORM/main.c b/testhal/STM32/STM32F4xx/IRQ_STORM/main.c
index 0b5ae9c00..e863910c3 100644
--- a/testhal/STM32/STM32F4xx/IRQ_STORM/main.c
+++ b/testhal/STM32/STM32F4xx/IRQ_STORM/main.c
@@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE];
* Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) {
chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -328,7 +328,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c
index d3cce8724..4f8d5e8bb 100644
--- a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c
+++ b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c
@@ -45,7 +45,7 @@ static bool saturated;
* Test worker thread.
*/
static THD_WORKING_AREA(waWorkerThread, 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
(void)arg;
@@ -67,7 +67,7 @@ static msg_t WorkerThread(void *arg) {
* Test periodic thread.
*/
static THD_WORKING_AREA(waPeriodicThread, 128);
-static msg_t PeriodicThread(void *arg) {
+static THD_FUNCTION(PeriodicThread, arg) {
(void)arg;
@@ -307,7 +307,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F4xx/PWM-ICU/main.c b/testhal/STM32/STM32F4xx/PWM-ICU/main.c
index adadbcc57..3f288fce3 100644
--- a/testhal/STM32/STM32F4xx/PWM-ICU/main.c
+++ b/testhal/STM32/STM32F4xx/PWM-ICU/main.c
@@ -136,7 +136,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/RTC/main.c b/testhal/STM32/STM32F4xx/RTC/main.c
index 1c2b60082..5a5a85f19 100644
--- a/testhal/STM32/STM32F4xx/RTC/main.c
+++ b/testhal/STM32/STM32F4xx/RTC/main.c
@@ -52,11 +52,10 @@ static time_t unix_time;
static THD_WORKING_AREA(blinkWA, 128);
static THD_FUNCTION(blink_thd, arg){
(void)arg;
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(100);
palTogglePad(GPIOB, GPIOB_LED_R);
}
- return 0;
}
/*
@@ -282,7 +281,7 @@ int main(void){
shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO);
/* wait until user do not want to test wakeup */
- while (TRUE){
+ while (true){
osalThreadSleepMilliseconds(200);
}
#endif /* WAKEUP_TEST */
diff --git a/testhal/STM32/STM32F4xx/SDC/main.c b/testhal/STM32/STM32F4xx/SDC/main.c
index 8d6bb9767..ac7be48ee 100644
--- a/testhal/STM32/STM32F4xx/SDC/main.c
+++ b/testhal/STM32/STM32F4xx/SDC/main.c
@@ -39,11 +39,11 @@ static const SDCConfig sdccfg = {
* LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED);
@@ -295,7 +295,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F4xx/SPI/main.c b/testhal/STM32/STM32F4xx/SPI/main.c
index fd18555ae..59464a0fd 100644
--- a/testhal/STM32/STM32F4xx/SPI/main.c
+++ b/testhal/STM32/STM32F4xx/SPI/main.c
@@ -47,11 +47,11 @@ static uint8_t rxbuf[512];
* SPI bus contender 1.
*/
static THD_WORKING_AREA(spi_thread_1_wa, 256);
-static msg_t spi_thread_1(void *p) {
+static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOD, GPIOD_LED5); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -61,18 +61,17 @@ static msg_t spi_thread_1(void *p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* SPI bus contender 2.
*/
static THD_WORKING_AREA(spi_thread_2_wa, 256);
-static msg_t spi_thread_2(void *p) {
+static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOD, GPIOD_LED5); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -82,7 +81,6 @@ static msg_t spi_thread_2(void *p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -131,7 +129,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/UART/main.c b/testhal/STM32/STM32F4xx/UART/main.c
index 44ba350ce..aea045c89 100644
--- a/testhal/STM32/STM32F4xx/UART/main.c
+++ b/testhal/STM32/STM32F4xx/UART/main.c
@@ -144,7 +144,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
/*
* Starts both a transmission and a receive operations, both will be
diff --git a/testhal/STM32/STM32F4xx/USB_CDC/main.c b/testhal/STM32/STM32F4xx/USB_CDC/main.c
index 938ffaa8a..fcd346160 100644
--- a/testhal/STM32/STM32F4xx/USB_CDC/main.c
+++ b/testhal/STM32/STM32F4xx/USB_CDC/main.c
@@ -438,7 +438,7 @@ static const ShellConfig shell_cfg1 = {
* Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
@@ -510,7 +510,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU2.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c b/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c
index b8a75106a..7827acf47 100644
--- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c
+++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c
@@ -147,7 +147,7 @@ static const ShellConfig shell_cfg2 = {
* Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
@@ -211,7 +211,7 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp1 && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp1)) {
diff --git a/testhal/STM32/STM32L1xx/ADC/main.c b/testhal/STM32/STM32L1xx/ADC/main.c
index d00652432..9ca096a51 100644
--- a/testhal/STM32/STM32L1xx/ADC/main.c
+++ b/testhal/STM32/STM32L1xx/ADC/main.c
@@ -100,7 +100,7 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOB, GPIOB_LED4);
chThdSleepMilliseconds(500);
palClearPad(GPIOB, GPIOB_LED4);
@@ -154,7 +154,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
adcSTM32DisableTSVREFE();
diff --git a/testhal/STM32/STM32L1xx/EXT/main.c b/testhal/STM32/STM32L1xx/EXT/main.c
index cae04dfb7..26ea0359c 100644
--- a/testhal/STM32/STM32L1xx/EXT/main.c
+++ b/testhal/STM32/STM32L1xx/EXT/main.c
@@ -89,7 +89,7 @@ int main(void) {
* Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32L1xx/IRQ_STORM/main.c b/testhal/STM32/STM32L1xx/IRQ_STORM/main.c
index 675e94699..3d3ea3a1f 100644
--- a/testhal/STM32/STM32L1xx/IRQ_STORM/main.c
+++ b/testhal/STM32/STM32L1xx/IRQ_STORM/main.c
@@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE];
* Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) {
chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -329,7 +329,7 @@ int main(void) {
/*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32L1xx/PWM-ICU/main.c b/testhal/STM32/STM32L1xx/PWM-ICU/main.c
index b70b06435..610b90912 100644
--- a/testhal/STM32/STM32L1xx/PWM-ICU/main.c
+++ b/testhal/STM32/STM32L1xx/PWM-ICU/main.c
@@ -136,7 +136,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32L1xx/SPI/main.c b/testhal/STM32/STM32L1xx/SPI/main.c
index 3ba87936a..287597da6 100644
--- a/testhal/STM32/STM32L1xx/SPI/main.c
+++ b/testhal/STM32/STM32L1xx/SPI/main.c
@@ -52,7 +52,7 @@ static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOB, GPIOB_LED4); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -62,7 +62,6 @@ static THD_FUNCTION(spi_thread_1, p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -74,7 +73,7 @@ static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOB, GPIOB_LED4); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,7 +83,6 @@ static THD_FUNCTION(spi_thread_2, p) {
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -132,7 +130,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32L1xx/UART/main.c b/testhal/STM32/STM32L1xx/UART/main.c
index 106f246d5..04b40d752 100644
--- a/testhal/STM32/STM32L1xx/UART/main.c
+++ b/testhal/STM32/STM32L1xx/UART/main.c
@@ -136,7 +136,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}