Mass change, all thread functions now return void.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7849 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
67b6d6cebf
commit
15d0007e96
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.*/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.*/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
/**
|
||||
* @brief Thread function.
|
||||
*/
|
||||
typedef msg_t (*tfunc_t)(void *p);
|
||||
typedef void (*tfunc_t)(void *p);
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module macros. */
|
||||
|
|
|
@ -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) */
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -95,6 +95,7 @@ _port_thread_start:
|
|||
cpsie i
|
||||
mov r0, r5
|
||||
blx r4
|
||||
movs r0, #0 /* MSG_OK */
|
||||
bl chThdExit
|
||||
|
||||
/*--------------------------------------------------------------------------*
|
||||
|
|
|
@ -96,6 +96,7 @@ _port_thread_start:
|
|||
#endif
|
||||
mov r0, r5
|
||||
blx r4
|
||||
movs r0, #0 /* MSG_OK */
|
||||
bl chThdExit
|
||||
|
||||
/*--------------------------------------------------------------------------*
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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. */
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <h2>Description</h2>
|
||||
* 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
|
||||
*
|
||||
* <h2>Description</h2>
|
||||
* 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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -37,8 +37,6 @@ static THD_FUNCTION(Thread1, arg) {
|
|||
}
|
||||
chThdSleepMilliseconds(500);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -136,7 +136,7 @@ int main(void) {
|
|||
/*
|
||||
* Normal main() thread activity, in this demo it does nothing.
|
||||
*/
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
chThdSleepMilliseconds(500);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -136,7 +136,7 @@ int main(void) {
|
|||
/*
|
||||
* Normal main() thread activity, in this demo it does nothing.
|
||||
*/
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
chThdSleepMilliseconds(500);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue