98 #define _THREADS_QUEUE_DATA(name) {(thread_t *)&name, (thread_t *)&name}   107 #define _THREADS_QUEUE_DECL(name)                                           \   108   threads_queue_t name = _THREADS_QUEUE_DATA(name)   122 #define THD_WORKING_AREA_SIZE(n)                                            \   123   MEM_ALIGN_NEXT(sizeof(thread_t) + PORT_WA_SIZE(n), PORT_STACK_ALIGN)   135 #define THD_WORKING_AREA(s, n) PORT_WORKING_AREA(s, n)   142 #define THD_WORKING_AREA_BASE(s) ((stkalign_t *)(s))   149 #define THD_WORKING_AREA_END(s) (THD_WORKING_AREA_BASE(s) +                 \   150                                  (sizeof (s) / sizeof (stkalign_t)))   161 #define THD_FUNCTION(tname, arg) PORT_THD_FUNCTION(tname, arg)   181 #define chThdSleepSeconds(sec) chThdSleep(TIME_S2I(sec))   197 #define chThdSleepMilliseconds(msec) chThdSleep(TIME_MS2I(msec))   213 #define chThdSleepMicroseconds(usec) chThdSleep(TIME_US2I(usec))   224 #if CH_DBG_FILL_THREADS == TRUE   234 #if CH_CFG_USE_REGISTRY == TRUE   240 #if CH_CFG_USE_WAITEXIT == TRUE   300 #if (CH_DBG_THREADS_PROFILING == TRUE) || defined(__DOXYGEN__)   307 #if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE) ||  \ static void chThdQueueObjectInit(threads_queue_t *tqp)
Initializes a threads queue object. 
 
void chThdExitS(msg_t msg)
Terminates the current thread. 
 
thread_t * chThdAddRef(thread_t *tp)
Adds a reference to a thread object. 
 
static tprio_t chThdGetPriorityX(void)
Returns the current thread priority. 
 
thread_t * chThdCreateI(const thread_descriptor_t *tdp)
Creates a new thread into a static memory area. 
 
uint64_t systime_t
Type of system time. 
 
uint64_t sysinterval_t
Type of time interval. 
 
msg_t chThdSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout)
Sends the current thread sleeping and sets a reference variable. 
 
tprio_t prio
Thread priority. 
 
static systime_t chThdGetTicksX(thread_t *tp)
Returns the number of ticks consumed by the specified thread. 
 
thread_t * chThdCreateSuspendedI(const thread_descriptor_t *tdp)
Creates a new thread into a static memory area. 
 
void chThdExit(msg_t msg)
Terminates the current thread. 
 
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers. 
 
Type of a thread descriptor. 
 
void chThdDequeueAllI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up all threads from the threads queue object. 
 
thread_t * chThdCreateStatic(void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg)
Creates a new thread into a static memory area. 
 
#define CH_STATE_WTSTART
Just created. 
 
msg_t chThdEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout)
Enqueues the caller thread on a threads queue object. 
 
static bool chThdTerminatedX(thread_t *tp)
Verifies if the specified thread is in the CH_STATE_FINAL state. 
 
stkalign_t * wbase
Pointer to the working area base. 
 
static bool chThdQueueIsEmptyI(threads_queue_t *tqp)
Evaluates to true if the specified queue is empty. 
 
void(* tfunc_t)(void *p)
Thread function. 
 
msg_t rdymsg
Thread wakeup code. 
 
void chThdTerminate(thread_t *tp)
Requests a thread termination. 
 
void chThdResumeS(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object. 
 
stkalign_t * wend
End of the working area. 
 
void _thread_memfill(uint8_t *startp, uint8_t *endp, uint8_t v)
Memory fill utility. 
 
static thread_t * chThdStartI(thread_t *tp)
Resumes a thread created with chThdCreateI(). 
 
static stkalign_t * chThdGetWorkingAreaX(thread_t *tp)
Returns the working area base of the specified thread. 
 
static bool chThdShouldTerminateX(void)
Verifies if the current thread has a termination request pending. 
 
msg_t chThdWait(thread_t *tp)
Blocks the execution of the invoking thread until the specified thread terminates then the exit code ...
 
stkalign_t * wabase
Working area base address. 
 
static void chThdDoDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the threads queue object. 
 
tprio_t chThdSetPriority(tprio_t newprio)
Changes the running thread priority level then reschedules if necessary. 
 
volatile systime_t time
Thread consumed time in ticks. 
 
#define chDbgCheck(c)
Function parameters check. 
 
#define CH_STATE_FINAL
Thread terminated. 
 
systime_t chThdSleepUntilWindowed(systime_t prev, systime_t next)
Suspends the invoking thread until the system time arrives to the specified value. 
 
static void chThdSleepS(sysinterval_t ticks)
Suspends the invoking thread for the specified number of ticks. 
 
static void queue_init(threads_queue_t *tqp)
Threads queue initialization. 
 
void chThdResumeI(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object. 
 
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification. 
 
tfunc_t funcp
Thread function pointer. 
 
const char * name
Thread name. 
 
void * arg
Thread argument. 
 
ready_list_t rlist
Ready list header. 
 
ch_system_t ch
System data structures. 
 
void chThdDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the threads queue object, if any. 
 
static bool queue_isempty(const threads_queue_t *tqp)
Evaluates to true if the specified threads queue is empty. 
 
tstate_t state
Current thread state. 
 
void chThdYield(void)
Yields the time slot. 
 
void chThdResume(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object. 
 
msg_t chThdSuspendS(thread_reference_t *trp)
Sends the current thread sleeping and sets a reference variable. 
 
union ch_thread::@0 u
State-specific fields. 
 
void chThdSleep(sysinterval_t time)
Suspends the invoking thread for the specified time. 
 
#define TIME_IMMEDIATE
Zero interval specification for some functions with a timeout specification. 
 
thread_t * _thread_init(thread_t *tp, const char *name, tprio_t prio)
Initializes a thread structure. 
 
uint64_t stkalign_t
Type of stack and memory alignment enforcement. 
 
static thread_t * chThdGetSelfX(void)
Returns a pointer to the current thread_t. 
 
static bool queue_notempty(const threads_queue_t *tqp)
Evaluates to true if the specified threads queue is not empty. 
 
thread_t * chThdCreate(const thread_descriptor_t *tdp)
Creates a new thread into a static memory area. 
 
thread_t * chThdStart(thread_t *tp)
Resumes a thread created with chThdCreateI(). 
 
#define chDbgAssert(c, r)
Condition assertion. 
 
#define CH_STATE_QUEUED
On an I/O queue. 
 
void chThdRelease(thread_t *tp)
Releases a reference to a thread object. 
 
void chThdSleepUntil(systime_t time)
Suspends the invoking thread until the system time arrives to the specified value. 
 
thread_t * chThdCreateSuspended(const thread_descriptor_t *tdp)
Creates a new thread into a static memory area. 
 
tmode_t flags
Various thread flags. 
 
thread_t * queue_fifo_remove(threads_queue_t *tqp)
Removes the first-out thread from a queue and returns it. 
 
#define CH_FLAG_TERMINATE
Termination requested flag. 
 
#define CH_STATE_SLEEPING
Sleeping. 
 
tprio_t prio
Thread priority. 
 
Structure representing a thread.