From 15d0007e9687428fe314e1369a9bb4eeb427cfcc Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 3 Apr 2015 12:48:22 +0000 Subject: 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-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/OTGv1/usb_lld.c | 3 +-- os/hal/ports/STM32/LLD/OTGv1/usb_lld.h | 2 +- os/rt/include/chthreads.h | 2 +- os/rt/ports/ARM/compilers/GCC/chcoreasm.s | 1 + os/rt/ports/ARM/compilers/GCC/chtypes.h | 2 +- os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s | 1 + os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s | 1 + os/rt/ports/ARMCMx/compilers/GCC/chtypes.h | 2 +- os/rt/ports/ARMCMx/compilers/IAR/chtypes.h | 2 +- os/rt/ports/ARMCMx/compilers/RVCT/chtypes.h | 2 +- os/rt/ports/SIMIA32/chcore.c | 3 ++- os/rt/ports/SIMIA32/compilers/GCC/chtypes.h | 2 +- os/rt/ports/e200/chcore.c | 1 + os/various/lwip_bindings/lwipthread.c | 2 +- os/various/lwip_bindings/lwipthread.h | 2 +- os/various/shell.c | 25 ++++++++++-------------- 16 files changed, 26 insertions(+), 27 deletions(-) (limited to 'os') 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; -- cgit v1.2.3