diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-12-14 21:15:18 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-12-14 21:15:18 +0000 |
commit | 313eb5bb780f9e9baa353651996b51ce33a85fca (patch) | |
tree | 2bd68d26bb0f4b17186f7b7cdb26f0f5c02932fd /nuttx/sched | |
parent | 33d20a1c87eb7cae586cc0d444729eda6c46e723 (diff) | |
download | px4-nuttx-313eb5bb780f9e9baa353651996b51ce33a85fca.tar.gz px4-nuttx-313eb5bb780f9e9baa353651996b51ce33a85fca.tar.bz2 px4-nuttx-313eb5bb780f9e9baa353651996b51ce33a85fca.zip |
Switching to C99 stdbool.h types
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2339 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched')
28 files changed, 150 insertions, 111 deletions
diff --git a/nuttx/sched/env_findvar.c b/nuttx/sched/env_findvar.c index 2ed10aede..b789a101d 100644 --- a/nuttx/sched/env_findvar.c +++ b/nuttx/sched/env_findvar.c @@ -41,6 +41,7 @@ #ifndef CONFIG_DISABLE_ENVIRON +#include <stdbool.h> #include <string.h> #include <sched.h> @@ -56,7 +57,7 @@ * Function: env_cmpname ****************************************************************************/ -static boolean env_cmpname(const char *pszname, const char *peqname) +static bool env_cmpname(const char *pszname, const char *peqname) { /* Search until we find anything different in the two names */ @@ -66,9 +67,9 @@ static boolean env_cmpname(const char *pszname, const char *peqname) if ( *pszname == '\0' && *peqname == '=' ) { - return TRUE; + return true; } - return FALSE; + return false; } /**************************************************************************** diff --git a/nuttx/sched/mq_internal.h b/nuttx/sched/mq_internal.h index 6a40144d4..e362ec2fb 100644 --- a/nuttx/sched/mq_internal.h +++ b/nuttx/sched/mq_internal.h @@ -45,6 +45,7 @@ #include <sys/types.h> #include <stdint.h> +#include <stdbool.h> #include <limits.h> #include <mqueue.h> #include <sched.h> @@ -114,7 +115,7 @@ struct msgq_s int16_t nwaitnotfull; /* Number tasks waiting for not full */ int16_t nwaitnotempty; /* Number tasks waiting for not empty */ uint8_t maxmsgsize; /* Max size of message in message queue */ - boolean unlinked; /* TRUE if the msg queue has been unlinked */ + bool unlinked; /* true if the msg queue has been unlinked */ #ifndef CONFIG_DISABLE_SIGNALS FAR struct mq_des *ntmqdes; /* Notification: Owning mqdes (NULL if none) */ pid_t ntpid; /* Notification: Receiving Task's PID */ diff --git a/nuttx/sched/mq_receive.c b/nuttx/sched/mq_receive.c index cd7748c3f..aff9e3be8 100644 --- a/nuttx/sched/mq_receive.c +++ b/nuttx/sched/mq_receive.c @@ -38,15 +38,18 @@ ************************************************************************/ #include <nuttx/config.h> + #include <sys/types.h> +#include <stdbool.h> #include <errno.h> #include <mqueue.h> #include <debug.h> #include <nuttx/arch.h> + #include "mq_internal.h" /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ /************************************************************************ @@ -119,7 +122,7 @@ ssize_t mq_receive(mqd_t mqdes, void *msg, size_t msglen, int *prio) irqstate_t saved_state; ssize_t ret = ERROR; - DEBUGASSERT(up_interrupt_context() == FALSE); + DEBUGASSERT(up_interrupt_context() == false); /* Verify the input parameters and, in case of an error, set * errno appropriately. diff --git a/nuttx/sched/mq_timedreceive.c b/nuttx/sched/mq_timedreceive.c index a13a8a632..1100331eb 100644 --- a/nuttx/sched/mq_timedreceive.c +++ b/nuttx/sched/mq_timedreceive.c @@ -41,6 +41,7 @@ #include <sys/types.h> #include <stdint.h> +#include <stdbool.h> #include <unistd.h> #include <errno.h> #include <mqueue.h> @@ -53,7 +54,7 @@ #include "mq_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -196,7 +197,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, void *msg, size_t msglen, irqstate_t saved_state; int ret = ERROR; - DEBUGASSERT(up_interrupt_context() == FALSE); + DEBUGASSERT(up_interrupt_context() == false); /* Verify the input parameters and, in case of an error, set * errno appropriately. diff --git a/nuttx/sched/mq_timedsend.c b/nuttx/sched/mq_timedsend.c index 7bdbbb7e1..412d2b8b4 100644 --- a/nuttx/sched/mq_timedsend.c +++ b/nuttx/sched/mq_timedsend.c @@ -41,6 +41,7 @@ #include <sys/types.h> #include <stdint.h> +#include <stdbool.h> #include <unistd.h> #include <mqueue.h> #include <wdog.h> @@ -53,7 +54,7 @@ #include "mq_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -192,7 +193,7 @@ int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio, irqstate_t saved_state; int ret = ERROR; - DEBUGASSERT(up_interrupt_context() == FALSE); + DEBUGASSERT(up_interrupt_context() == false); /* Verify the input parameters -- setting errno appropriately * on any failures to verify. diff --git a/nuttx/sched/mq_unlink.c b/nuttx/sched/mq_unlink.c index 7d77e266d..0f1e63e48 100644 --- a/nuttx/sched/mq_unlink.c +++ b/nuttx/sched/mq_unlink.c @@ -39,13 +39,15 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <mqueue.h> #include <sched.h> + #include "os_internal.h" #include "mq_internal.h" /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ /************************************************************************ @@ -131,7 +133,7 @@ int mq_unlink(const char *mq_name) else { - msgq->unlinked = TRUE; + msgq->unlinked = true; } ret = OK; diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index cda7dc61c..d37000b6a 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -41,13 +41,15 @@ ****************************************************************************/ #include <nuttx/config.h> + #include <sys/types.h> +#include <stdbool.h> #include <queue.h> #include <sched.h> #include <nuttx/kmalloc.h> /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /* OS CRASH CODES */ @@ -136,7 +138,7 @@ typedef struct pidhash_s pidhash_t; struct tasklist_s { DSEG volatile dq_queue_t *list; /* Pointer to the task list */ - boolean prioritized; /* TRUE if the list is prioritized */ + bool prioritized; /* true if the list is prioritized */ }; typedef struct tasklist_s tasklist_t; @@ -240,41 +242,39 @@ extern const tasklist_t g_tasklisttable[NUM_TASK_STATES]; * Public Function Prototypes ****************************************************************************/ -extern void task_start(void); -extern int task_schedsetup(FAR _TCB *tcb, int priority, - start_t start, main_t main); -extern int task_argsetup(FAR _TCB *tcb, const char *name, - const char *argv[]); -extern int task_deletecurrent(void); - -extern boolean sched_addreadytorun(FAR _TCB *rtrtcb); -extern boolean sched_removereadytorun(FAR _TCB *rtrtcb); -extern boolean sched_addprioritized(FAR _TCB *newTcb, - DSEG dq_queue_t *list); -extern boolean sched_mergepending(void); -extern void sched_addblocked(FAR _TCB *btcb, tstate_t task_state); -extern void sched_removeblocked(FAR _TCB *btcb); -extern int sched_setpriority(FAR _TCB *tcb, int sched_priority); +extern void task_start(void); +extern int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, + main_t main); +extern int task_argsetup(FAR _TCB *tcb, const char *name, const char *argv[]); +extern int task_deletecurrent(void); + +extern bool sched_addreadytorun(FAR _TCB *rtrtcb); +extern bool sched_removereadytorun(FAR _TCB *rtrtcb); +extern bool sched_addprioritized(FAR _TCB *newTcb, DSEG dq_queue_t *list); +extern bool sched_mergepending(void); +extern void sched_addblocked(FAR _TCB *btcb, tstate_t task_state); +extern void sched_removeblocked(FAR _TCB *btcb); +extern int sched_setpriority(FAR _TCB *tcb, int sched_priority); #ifdef CONFIG_PRIORITY_INHERITANCE -extern int sched_reprioritize(FAR _TCB *tcb, int sched_priority); +extern int sched_reprioritize(FAR _TCB *tcb, int sched_priority); #else # define sched_reprioritize(tcb,sched_priority) sched_setpriority(tcb,sched_priority) #endif extern FAR _TCB *sched_gettcb(pid_t pid); -extern boolean sched_verifytcb(FAR _TCB *tcb); +extern bool sched_verifytcb(FAR _TCB *tcb); #if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 -extern int sched_setupidlefiles(FAR _TCB *tcb); -extern int sched_setuptaskfiles(FAR _TCB *tcb); -extern int sched_setuppthreadfiles(FAR _TCB *tcb); +extern int sched_setupidlefiles(FAR _TCB *tcb); +extern int sched_setuptaskfiles(FAR _TCB *tcb); +extern int sched_setuppthreadfiles(FAR _TCB *tcb); #if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 -extern int sched_setupstreams(FAR _TCB *tcb); -extern int sched_flushfiles(FAR _TCB *tcb); +extern int sched_setupstreams(FAR _TCB *tcb); +extern int sched_flushfiles(FAR _TCB *tcb); #endif -extern int sched_releasefiles(FAR _TCB *tcb); +extern int sched_releasefiles(FAR _TCB *tcb); #endif -extern int sched_releasetcb(FAR _TCB *tcb); -extern void sched_garbagecollection(void); +extern int sched_releasetcb(FAR _TCB *tcb); +extern void sched_garbagecollection(void); #endif /* __OS_INTERNAL_H */ diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c index 6f36f58a6..3c25b7008 100644 --- a/nuttx/sched/os_start.c +++ b/nuttx/sched/os_start.c @@ -38,6 +38,7 @@ ****************************************************************************/ #include <sys/types.h> +#include <stdbool.h> #include <debug.h> #include <string.h> @@ -66,7 +67,7 @@ #endif /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -174,18 +175,18 @@ pid_t g_worker; const tasklist_t g_tasklisttable[NUM_TASK_STATES] = { - { NULL, FALSE }, /* TSTATE_TASK_INVALID */ - { &g_pendingtasks, TRUE }, /* TSTATE_TASK_PENDING */ - { &g_readytorun, TRUE }, /* TSTATE_TASK_READYTORUN */ - { &g_readytorun, TRUE }, /* TSTATE_TASK_RUNNING */ - { &g_inactivetasks, FALSE }, /* TSTATE_TASK_INACTIVE */ - { &g_waitingforsemaphore, TRUE }, /* TSTATE_WAIT_SEM */ + { NULL, false }, /* TSTATE_TASK_INVALID */ + { &g_pendingtasks, true }, /* TSTATE_TASK_PENDING */ + { &g_readytorun, true }, /* TSTATE_TASK_READYTORUN */ + { &g_readytorun, true }, /* TSTATE_TASK_RUNNING */ + { &g_inactivetasks, false }, /* TSTATE_TASK_INACTIVE */ + { &g_waitingforsemaphore, true }, /* TSTATE_WAIT_SEM */ #ifndef CONFIG_DISABLE_SIGNALS - { &g_waitingforsignal, FALSE }, /* TSTATE_WAIT_SIG */ + { &g_waitingforsignal, false }, /* TSTATE_WAIT_SIG */ #endif #ifndef CONFIG_DISABLE_MQUEUE - { &g_waitingformqnotempty, TRUE }, /* TSTATE_WAIT_MQNOTEMPTY */ - { &g_waitingformqnotfull, TRUE } /* TSTATE_WAIT_MQNOTFULL */ + { &g_waitingformqnotempty, true }, /* TSTATE_WAIT_MQNOTEMPTY */ + { &g_waitingformqnotfull, true } /* TSTATE_WAIT_MQNOTFULL */ #endif }; diff --git a/nuttx/sched/pthread_completejoin.c b/nuttx/sched/pthread_completejoin.c index fa91e4a6a..fff3b46cf 100644 --- a/nuttx/sched/pthread_completejoin.c +++ b/nuttx/sched/pthread_completejoin.c @@ -37,15 +37,19 @@ * Included Files ************************************************************************/ +#include <nuttx/config.h> + #include <sys/types.h> +#include <stdbool.h> #include <pthread.h> #include <errno.h> #include <debug.h> + #include "os_internal.h" #include "pthread_internal.h" /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ /************************************************************************ @@ -74,7 +78,7 @@ * ************************************************************************/ -static boolean pthread_notifywaiters(FAR join_t *pjoin) +static bool pthread_notifywaiters(FAR join_t *pjoin) { int ntasks_waiting; int status; @@ -111,9 +115,9 @@ static boolean pthread_notifywaiters(FAR join_t *pjoin) */ (void)pthread_takesemaphore(&pjoin->data_sem); - return TRUE; + return true; } - return FALSE; + return false; } /************************************************************************ @@ -158,11 +162,11 @@ int pthread_completejoin(pid_t pid, FAR void *exit_value) } else { - boolean waiters; + bool waiters; /* Save the return exit value in the thread structure. */ - pjoin->terminated = TRUE; + pjoin->terminated = true; pjoin->exit_value = exit_value; /* Notify waiters of the availability of the exit value */ diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c index 4f3d05bdc..b49698122 100644 --- a/nuttx/sched/pthread_create.c +++ b/nuttx/sched/pthread_create.c @@ -38,7 +38,9 @@ ****************************************************************************/ #include <nuttx/config.h> + #include <sys/types.h> +#include <stdbool.h> #include <string.h> #include <pthread.h> #include <sched.h> @@ -47,13 +49,14 @@ #include <queue.h> #include <nuttx/kmalloc.h> #include <nuttx/arch.h> + #include "os_internal.h" #include "clock_internal.h" #include "env_internal.h" #include "pthread_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -204,7 +207,7 @@ static void pthread_start(void) /* Report to the spawner that we successfully started. */ - pjoin->started = TRUE; + pjoin->started = true; (void)pthread_givesemaphore(&pjoin->data_sem); /* Pass control to the thread entry point. The argument is diff --git a/nuttx/sched/pthread_detach.c b/nuttx/sched/pthread_detach.c index dc8352930..52ea63ca5 100644 --- a/nuttx/sched/pthread_detach.c +++ b/nuttx/sched/pthread_detach.c @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <stdbool.h> #include <pthread.h> #include <errno.h> #include <debug.h> @@ -48,7 +49,7 @@ #include "pthread_internal.h" /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ /************************************************************************ @@ -121,7 +122,7 @@ int pthread_detach(pthread_t thread) * thread exits */ - pjoin->detached = TRUE; + pjoin->detached = true; } /* Either case is successful */ diff --git a/nuttx/sched/pthread_internal.h b/nuttx/sched/pthread_internal.h index 55d58d49f..1770ff1b5 100644 --- a/nuttx/sched/pthread_internal.h +++ b/nuttx/sched/pthread_internal.h @@ -40,13 +40,16 @@ * Included Files ****************************************************************************/ +#include <nuttx/config.h> + #include <sys/types.h> #include <stdint.h> +#include <stdbool.h> #include <pthread.h> #include <nuttx/compiler.h> /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -66,9 +69,9 @@ struct join_s { FAR struct join_s *next; /* Implements link list */ uint8_t crefs; /* Reference count */ - boolean started; /* TRUE: pthread started. */ - boolean detached; /* TRUE: pthread_detached'ed */ - boolean terminated; /* TRUE: detach'ed+exit'ed */ + bool started; /* true: pthread started. */ + bool detached; /* true: pthread_detached'ed */ + bool terminated; /* true: detach'ed+exit'ed */ pthread_t thread; /* Includes pid */ sem_t exit_sem; /* Implements join */ sem_t data_sem; /* Implements join */ diff --git a/nuttx/sched/pthread_once.c b/nuttx/sched/pthread_once.c index b2db0ab5f..dc0fcd2bd 100644 --- a/nuttx/sched/pthread_once.c +++ b/nuttx/sched/pthread_once.c @@ -39,13 +39,14 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <pthread.h> #include <sched.h> #include <errno.h> #include <debug.h> /******************************************************************************** - * Definitions + * Pre-processor Definitions ********************************************************************************/ /******************************************************************************** @@ -104,7 +105,7 @@ int pthread_once(FAR pthread_once_t *once_control, CODE void (*init_routine)(voi sched_lock(); if (!*once_control) { - *once_control = TRUE; + *once_control = true; /* Call the init_routine with pre-emption enabled. */ diff --git a/nuttx/sched/sched_addprioritized.c b/nuttx/sched/sched_addprioritized.c index 824dc32d6..d937dcee3 100644 --- a/nuttx/sched/sched_addprioritized.c +++ b/nuttx/sched/sched_addprioritized.c @@ -40,13 +40,14 @@ #include <nuttx/config.h> #include <stdint.h> +#include <stdbool.h> #include <queue.h> #include <assert.h> #include "os_internal.h" /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ /************************************************************************ @@ -80,7 +81,7 @@ * list - Points to the prioritized list to add tcb to * * Return Value: - * TRUE if the head of the list has changed. + * true if the head of the list has changed. * * Assumptions: * - The caller has established a critical section before @@ -94,12 +95,12 @@ * match the state associated with the list. ************************************************************************/ -boolean sched_addprioritized(FAR _TCB *tcb, DSEG dq_queue_t *list) +bool sched_addprioritized(FAR _TCB *tcb, DSEG dq_queue_t *list) { FAR _TCB *next; FAR _TCB *prev; uint8_t sched_priority = tcb->sched_priority; - boolean ret = FALSE; + bool ret = false; /* Lets do a sanity check before we get started. */ @@ -131,7 +132,7 @@ boolean sched_addprioritized(FAR _TCB *tcb, DSEG dq_queue_t *list) tcb->blink = NULL; list->head = (FAR dq_entry_t*)tcb; list->tail = (FAR dq_entry_t*)tcb; - ret = TRUE; + ret = true; } else { @@ -156,7 +157,7 @@ boolean sched_addprioritized(FAR _TCB *tcb, DSEG dq_queue_t *list) tcb->blink = NULL; next->blink = tcb; list->head = (FAR dq_entry_t*)tcb; - ret = TRUE; + ret = true; } else { diff --git a/nuttx/sched/sched_addreadytorun.c b/nuttx/sched/sched_addreadytorun.c index 503d15f98..51e219342 100644 --- a/nuttx/sched/sched_addreadytorun.c +++ b/nuttx/sched/sched_addreadytorun.c @@ -39,13 +39,14 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <queue.h> #include <assert.h> #include "os_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -83,7 +84,7 @@ * btcb - Points to the blocked TCB that is ready-to-run * * Return Value: - * TRUE if the currently active task (the head of the + * true if the currently active task (the head of the * g_readytorun list) has changed. * * Assumptions: @@ -97,10 +98,10 @@ * ****************************************************************************/ -boolean sched_addreadytorun(FAR _TCB *btcb) +bool sched_addreadytorun(FAR _TCB *btcb) { FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; - boolean ret; + bool ret; /* Check if pre-emption is disabled for the current running * task and if the new ready-to-run task would cause the @@ -115,7 +116,7 @@ boolean sched_addreadytorun(FAR _TCB *btcb) sched_addprioritized(btcb, (FAR dq_queue_t*)&g_pendingtasks); btcb->task_state = TSTATE_TASK_PENDING; - ret = FALSE; + ret = false; } /* Otherwise, add the new task to the g_readytorun task list */ @@ -134,14 +135,14 @@ boolean sched_addreadytorun(FAR _TCB *btcb) btcb->task_state = TSTATE_TASK_RUNNING; btcb->flink->task_state = TSTATE_TASK_READYTORUN; - ret = TRUE; + ret = true; } else { /* The new btcb was added in the middle of the g_readytorun list */ btcb->task_state = TSTATE_TASK_READYTORUN; - ret = FALSE; + ret = false; } return ret; diff --git a/nuttx/sched/sched_mergepending.c b/nuttx/sched/sched_mergepending.c index c45010e8c..1448c0096 100644 --- a/nuttx/sched/sched_mergepending.c +++ b/nuttx/sched/sched_mergepending.c @@ -39,13 +39,14 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <queue.h> #include <assert.h> #include "os_internal.h" /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ /************************************************************************ @@ -79,7 +80,7 @@ * None * * Return Value: - * TRUE if the head of the g_readytorun task list has changed. + * true if the head of the g_readytorun task list has changed. * * Assumptions: * - The caller has established a critical section before @@ -90,13 +91,13 @@ * ************************************************************************/ -boolean sched_mergepending(void) +bool sched_mergepending(void) { FAR _TCB *pndtcb; FAR _TCB *pndnext; FAR _TCB *rtrtcb; FAR _TCB *rtrprev; - boolean ret = FALSE; + bool ret = false; /* Initialize the inner search loop */ @@ -142,7 +143,7 @@ boolean sched_mergepending(void) g_readytorun.head = (FAR dq_entry_t*)pndtcb; rtrtcb->task_state = TSTATE_TASK_READYTORUN; pndtcb->task_state = TSTATE_TASK_RUNNING; - ret = TRUE; + ret = true; } else { diff --git a/nuttx/sched/sched_removereadytorun.c b/nuttx/sched/sched_removereadytorun.c index f09b5fc99..46f148150 100644 --- a/nuttx/sched/sched_removereadytorun.c +++ b/nuttx/sched/sched_removereadytorun.c @@ -39,13 +39,14 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <queue.h> #include <assert.h> #include "os_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -78,7 +79,7 @@ * rtcb - Points to the TCB that is ready-to-run * * Return Value: - * TRUE if the currently active task (the head of the + * true if the currently active task (the head of the * g_readytorun list) has changed. * * Assumptions: @@ -87,11 +88,12 @@ * a good idea -- use irqsave()). * - The caller handles the condition that occurs if the * the head of the g_readytorun list is changed. + * ****************************************************************************/ -boolean sched_removereadytorun(FAR _TCB *rtcb) +bool sched_removereadytorun(FAR _TCB *rtcb) { - boolean ret = FALSE; + bool ret = false; /* Check if the TCB to be removed is at the head of the ready * to run list. In this case, we are removing the currently @@ -109,7 +111,7 @@ boolean sched_removereadytorun(FAR _TCB *rtcb) sched_note_switch(rtcb, rtcb->flink); rtcb->flink->task_state = TSTATE_TASK_RUNNING; - ret = TRUE; + ret = true; } /* Remove the TCB from the ready-to-run list */ diff --git a/nuttx/sched/sched_verifytcb.c b/nuttx/sched/sched_verifytcb.c index 5b91e77d2..af7cdebe1 100644 --- a/nuttx/sched/sched_verifytcb.c +++ b/nuttx/sched/sched_verifytcb.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <sched.h> #include "os_internal.h" @@ -71,12 +72,12 @@ * Name: sched_verifytcb * * Description: - * Return TRUE if the tcb refers to an active task; FALSE if it is a stale + * Return true if the tcb refers to an active task; false if it is a stale * TCB handle. * ****************************************************************************/ -boolean sched_verifytcb(FAR _TCB *tcb) +bool sched_verifytcb(FAR _TCB *tcb) { /* Return true if the PID hashes to this TCB. */ diff --git a/nuttx/sched/sem_internal.h b/nuttx/sched/sem_internal.h index 054946301..feb99ef0b 100644 --- a/nuttx/sched/sem_internal.h +++ b/nuttx/sched/sem_internal.h @@ -44,12 +44,13 @@ #include <nuttx/compiler.h> #include <stdint.h> +#include <stdbool.h> #include <semaphore.h> #include <sched.h> #include <queue.h> /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -64,7 +65,7 @@ struct nsem_s FAR struct nsem_s *blink; /* Backward link */ uint16_t nconnect; /* Number of connections to semaphore */ FAR char *name; /* Semaphore name (NULL if un-named) */ - boolean unlinked; /* TRUE if the semaphore has been unlinked */ + bool unlinked; /* true if the semaphore has been unlinked */ sem_t sem; /* The semaphore itself */ }; typedef struct nsem_s nsem_t; diff --git a/nuttx/sched/sem_open.c b/nuttx/sched/sem_open.c index aeb5097eb..cd9ca6129 100644 --- a/nuttx/sched/sem_open.c +++ b/nuttx/sched/sem_open.c @@ -37,7 +37,10 @@ * Included Files ****************************************************************************/ +#include <nuttx/config.h> + #include <sys/types.h> +#include <stdbool.h> #include <stdarg.h> #include <limits.h> #include <fcntl.h> @@ -48,7 +51,7 @@ #include "sem_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -178,7 +181,7 @@ FAR sem_t *sem_open (FAR const char *name, int oflag, ...) sem_init(sem, 0, value); psem->nconnect = 1; - psem->unlinked = FALSE; + psem->unlinked = false; psem->name = (FAR char*)psem + sizeof(nsem_t); strcpy(psem->name, name); diff --git a/nuttx/sched/sem_trywait.c b/nuttx/sched/sem_trywait.c index 27eb6a60c..d50dc106d 100644 --- a/nuttx/sched/sem_trywait.c +++ b/nuttx/sched/sem_trywait.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <semaphore.h> #include <sched.h> #include <errno.h> @@ -48,7 +49,7 @@ #include "sem_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -102,7 +103,7 @@ int sem_trywait(FAR sem_t *sem) /* This API should not be called from interrupt handlers */ - DEBUGASSERT(up_interrupt_context() == FALSE) + DEBUGASSERT(up_interrupt_context() == false) /* Assume any errors reported are due to invalid arguments. */ diff --git a/nuttx/sched/sem_unlink.c b/nuttx/sched/sem_unlink.c index 79f8be010..ec0864180 100644 --- a/nuttx/sched/sem_unlink.c +++ b/nuttx/sched/sem_unlink.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <semaphore.h> #include <sched.h> #include <queue.h> @@ -47,7 +48,7 @@ #include "sem_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -126,7 +127,7 @@ int sem_unlink(FAR const char *name) else { - psem->unlinked = TRUE; + psem->unlinked = true; } ret = OK; } diff --git a/nuttx/sched/sem_wait.c b/nuttx/sched/sem_wait.c index f723b7215..747d7cd48 100644 --- a/nuttx/sched/sem_wait.c +++ b/nuttx/sched/sem_wait.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <semaphore.h> #include <errno.h> #include <assert.h> @@ -48,7 +49,7 @@ #include "sem_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -101,7 +102,7 @@ int sem_wait(FAR sem_t *sem) /* This API should not be called from interrupt handlers */ - DEBUGASSERT(up_interrupt_context() == FALSE) + DEBUGASSERT(up_interrupt_context() == false) /* Assume any errors reported are due to invalid arguments. */ diff --git a/nuttx/sched/sig_ismember.c b/nuttx/sched/sig_ismember.c index 77cd520fd..670ef7bd2 100644 --- a/nuttx/sched/sig_ismember.c +++ b/nuttx/sched/sig_ismember.c @@ -40,7 +40,7 @@ #include <signal.h> /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -75,7 +75,7 @@ * signo - Signal to test for * * Return Value: - * 1 (TRUE), if the specified signal is a member of the set, + * 1 (true), if the specified signal is a member of the set, * 0 (OK or FALSE), if it is not, or * -1 (ERROR) if the signal number is invalid. * diff --git a/nuttx/sched/wd_cancel.c b/nuttx/sched/wd_cancel.c index f17e0d227..ea686cf92 100644 --- a/nuttx/sched/wd_cancel.c +++ b/nuttx/sched/wd_cancel.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <assert.h> #include <wdog.h> #include <nuttx/arch.h> @@ -47,7 +48,7 @@ #include "wd_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -156,7 +157,7 @@ int wd_cancel (WDOG_ID wdid) /* Mark the watchdog inactive */ - wdid->active = FALSE; + wdid->active = false; } irqrestore(saved_state); return ret; diff --git a/nuttx/sched/wd_create.c b/nuttx/sched/wd_create.c index 296ff5c3d..a383de6a5 100644 --- a/nuttx/sched/wd_create.c +++ b/nuttx/sched/wd_create.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> +#include <stdbool.h> #include <wdog.h> #include <queue.h> #include <nuttx/arch.h> @@ -46,7 +47,7 @@ #include "wd_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -101,7 +102,7 @@ WDOG_ID wd_create (void) if (wdog) { wdog->next = NULL; - wdog->active = FALSE; + wdog->active = false; } return (WDOG_ID)wdog; } diff --git a/nuttx/sched/wd_internal.h b/nuttx/sched/wd_internal.h index 2a64d9eaf..4df2a0e65 100644 --- a/nuttx/sched/wd_internal.h +++ b/nuttx/sched/wd_internal.h @@ -43,11 +43,12 @@ #include <nuttx/config.h> #include <stdint.h> +#include <stdbool.h> #include <wdog.h> #include <nuttx/compiler.h> /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ /************************************************************************ @@ -66,7 +67,7 @@ struct wdog_s FAR void *picbase; /* PIC base address */ #endif int lag; /* Timer associated with the delay */ - boolean active; /* TRUE if the watchdog is actively timing */ + bool active; /* true if the watchdog is actively timing */ uint8_t argc; /* The number of parameters to pass */ uint32_t parm[CONFIG_MAX_WDOGPARMS]; }; diff --git a/nuttx/sched/wd_start.c b/nuttx/sched/wd_start.c index 31bc3bea0..1f37dbf99 100644 --- a/nuttx/sched/wd_start.c +++ b/nuttx/sched/wd_start.c @@ -40,6 +40,7 @@ #include <sys/types.h> #include <stdint.h> +#include <stdbool.h> #include <stdarg.h> #include <wdog.h> #include <unistd.h> @@ -52,7 +53,7 @@ #include "wd_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -267,7 +268,7 @@ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) /* Put the lag into the watchdog structure and mark it as active. */ wdog->lag = delay; - wdog->active = TRUE; + wdog->active = true; irqrestore(saved_state); return OK; @@ -330,7 +331,7 @@ void wd_timer(void) /* Indicate that the watchdog is no longer active. */ - wdog->active = FALSE; + wdog->active = false; /* Get the current task's process ID. We'll need this later to * see if the watchdog function caused a context switch. |