Switching to C99 stdbool.h types
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2339 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
3d1383407c
commit
a350286c7c
28 changed files with 149 additions and 110 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 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 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 */
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
};
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue