59 #if (CH_DBG_SYSTEM_STATE_CHECK == TRUE) || defined(__DOXYGEN__)   224 #if CH_DBG_SYSTEM_STATE_CHECK == TRUE   234   tcp = nil_thd_configs;
   236 #if CH_DBG_ENABLE_STACK_CHECK   250 #if CH_DBG_ENABLE_STACK_CHECK   259 #if CH_DBG_SYSTEM_STATE_CHECK == TRUE   264 #if CH_CFG_USE_MEMCORE == TRUE   269 #if CH_CFG_USE_HEAP == TRUE   274 #if CH_CFG_USE_FACTORY == TRUE   330 #if CH_CFG_ST_TIMEDELTA == 0   344         if (NIL_THD_IS_WTQUEUE(tp)) {
   347         else if (NIL_THD_IS_SUSP(tp)) {
   378       tp->timeout = timeout;
   383         if (NIL_THD_IS_WTQUEUE(tp)) {
   387           if (NIL_THD_IS_SUSP(tp)) {
   414     port_timer_stop_alarm();
   496 #if (PORT_SUPPORTS_RT == TRUE) || defined(__DOXYGEN__)   517   return (
bool)((cnt - start) < (end - start));
   552   chDbgAssert(!NIL_THD_IS_READY(tp), 
"already ready");
   636                "idle cannot sleep");
   639   otp->
state = newstate;
   641 #if CH_CFG_ST_TIMEDELTA > 0   656       port_timer_start_alarm(abstime);
   663         port_timer_set_alarm(abstime);
   669     otp->timeout = abstime - nil.
lasttime;
   674   otp->timeout = timeout;
   681     if (NIL_THD_IS_READY(ntp)) {
   693                 "pointer out of range");
   828     if (tp->u1.tqp == tqp) {
   831       chDbgAssert(NIL_THD_IS_WTQUEUE(tp), 
"not waiting");
   839                 "pointer out of range");
   857   if (tqp->cnt < (
cnt_t)0) {
   877   while (tqp->cnt < (
cnt_t)0) {
   880                 "pointer out of range");
   883     if (tp->u1.tqp == tqp) {
   885       chDbgAssert(NIL_THD_IS_WTQUEUE(tp), 
"not waiting");
   894 #if (CH_CFG_USE_SEMAPHORES == TRUE) || defined(__DOXYGEN__)   951   if (cnt <= (
cnt_t)0) {
   998       if (tp->u1.semp == sp) {
  1000         chDbgAssert(NIL_THD_IS_WTQUEUE(tp), 
"not waiting");
  1008                   "pointer out of range");
  1059   while (cnt < (
cnt_t)0) {
  1062                 "pointer out of range");
  1065     if (tp->u1.semp == sp) {
  1067       chDbgAssert(NIL_THD_IS_WTQUEUE(tp), 
"not waiting");
  1077 #if (CH_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__)  1112   if (NIL_THD_IS_WTOREVT(tp) &&
  1141   if ((m = (ctp->epmask & mask)) == (
eventmask_t)0) {
  1153     m = ctp->epmask & mask;
 tfunc_t funcp
Thread function. 
 
stkalign_t * wbase
Thread working area base. 
 
#define chSysGetRealtimeCounterX()
Returns the current value of the system real time counter. 
 
void chSchRescheduleS(void)
Reschedules if needed. 
 
cnt_t cnt
The semaphore counter. 
 
#define chSysLock()
Enters the kernel lock state. 
 
systime_t nexttime
Time of the next scheduled tick event. 
 
uint64_t systime_t
Type of system time. 
 
uint64_t sysinterval_t
Type of time interval. 
 
#define NIL_STATE_READY
Thread ready or executing. 
 
void chEvtSignal(thread_t *tp, eventmask_t mask)
Adds a set of event flags directly to the specified thread_t. 
 
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification. 
 
void chSysHalt(const char *reason)
Halts the system. 
 
void chThdDequeueAllI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up all threads from the threads queue object. 
 
void chSemSignal(semaphore_t *sp)
Performs a signal operation on a semaphore. 
 
msg_t chThdSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout)
Sends the current thread sleeping and sets a reference variable. 
 
void chEvtSignalI(thread_t *tp, eventmask_t mask)
Adds a set of event flags directly to the specified thread_t. 
 
#define chTimeAddX(systime, interval)
Adds an interval to a system time returning a system time. 
 
void _core_init(void)
Low level memory manager initialization. 
 
cnt_t lock_cnt
Lock nesting level. 
 
volatile systime_t systime
System time. 
 
#define chTimeDiffX(start, end)
Subtracts two system times returning an interval. 
 
static void port_disable(void)
Disables all the interrupt sources. 
 
void chThdResumeI(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object. 
 
#define port_switch(ntp, otp)
Performs a context switch between two threads. 
 
void chSemSignalI(semaphore_t *sp)
Performs a signal operation on a semaphore. 
 
#define CH_CFG_SYSTEM_INIT_HOOK(tp)
System initialization hook. 
 
#define NIL_STATE_WTOREVT
Waiting for events. 
 
void chThdDoDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the threads queue object. 
 
Structure representing a thread static configuration. 
 
static void port_lock_from_isr(void)
Kernel-lock action from an interrupt handler. 
 
#define chSchIsRescRequiredI()
Evaluates if a reschedule is required. 
 
void chSysRestoreStatusX(syssts_t sts)
Restores the specified execution status and leaves a critical zone. 
 
eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, sysinterval_t timeout)
Waits for any of the specified events. 
 
thread_t threads[CH_CFG_NUM_THREADS+1]
Thread structures for all the defined threads. 
 
void chDbgCheckClassS(void)
S-class functions context check. 
 
stkalign_t * wabase
Working area base address. 
 
#define CH_CFG_IDLE_ENTER_HOOK()
Idle thread enter hook. 
 
#define MSG_TIMEOUT
Wakeup caused by a timeout condition. 
 
void chSemReset(semaphore_t *sp, cnt_t n)
Performs a reset operation on the semaphore. 
 
void chSemResetI(semaphore_t *sp, cnt_t n)
Performs a reset operation on the semaphore. 
 
void _dbg_check_suspend(void)
Guard code for chSysSuspend(). 
 
void chThdSleepUntil(systime_t abstime)
Suspends the invoking thread until the system time arrives to the specified value. 
 
static bool port_is_isr_context(void)
Determines the current execution context. 
 
void chDbgCheckClassI(void)
I-class functions context check. 
 
#define chSysUnlock()
Leaves the kernel lock state. 
 
#define chThdSleepS(timeout)
Suspends the invoking thread for the specified time. 
 
thread_t * current
Pointer to the running thread. 
 
#define chDbgCheck(c)
Function parameters check. 
 
thread_t * next
Pointer to the next thread to be executed. 
 
#define chSysSuspend()
Raises the system interrupt priority mask to system level. 
 
stkalign_t * wend
Thread working area end. 
 
eventmask_t ewmask
Enabled events mask. 
 
#define chSysUnlockFromISR()
Leaves the kernel lock state from within an interrupt handler. 
 
void chThdSleep(sysinterval_t timeout)
Suspends the invoking thread for the specified time. 
 
#define PORT_SETUP_CONTEXT(tp, wbase, wtop, pf, arg)
Platform dependent part of the chThdCreateI() API. 
 
void chSysUnconditionalLock(void)
Unconditionally enters the kernel lock state. 
 
msg_t chThdEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout)
Enqueues the caller thread on a threads queue object. 
 
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification. 
 
#define CH_CFG_THREAD_EXT_INIT_HOOK(tr)
Threads initialization hook. 
 
void chSysPolledDelayX(rtcnt_t cycles)
Polled delay. 
 
void _dbg_check_lock(void)
Guard code for chSysLock(). 
 
#define NIL_STATE_WTQUEUE
On queue or semaph. 
 
#define CH_CFG_NUM_THREADS
Number of user threads in the application. 
 
void chSysInit(void)
Initializes the kernel. 
 
#define MSG_OK
Normal wakeup message. 
 
#define NIL_STATE_SUSP
Thread suspended. 
 
#define chSysLockFromISR()
Enters the kernel lock state from within an interrupt handler. 
 
void chThdDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the threads queue object, if any. 
 
tstate_t state
Current thread state. 
 
cnt_t isr_cnt
ISR nesting level. 
 
bool chSchIsPreemptionRequired(void)
Evaluates if preemption is required. 
 
#define CH_CFG_IDLE_LEAVE_HOOK()
Idle thread leave hook. 
 
void chSysTimerHandlerI(void)
Time management handler. 
 
void _dbg_check_lock_from_isr(void)
Guard code for chSysLockFromIsr(). 
 
const char *volatile dbg_panic_msg
Panic message. 
 
#define TIME_IMMEDIATE
Zero interval specification for some functions with a timeout specification. 
 
uint64_t stkalign_t
Type of stack and memory alignment enforcement. 
 
void _dbg_check_unlock_from_isr(void)
Guard code for chSysUnlockFromIsr(). 
 
void _dbg_check_enable(void)
Guard code for chSysEnable(). 
 
bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end)
Realtime window test. 
 
#define chThdSleepUntilS(abstime)
Suspends the invoking thread until the system time arrives to the specified value. 
 
#define chDbgAssert(c, r)
Condition assertion. 
 
void chSysUnconditionalUnlock(void)
Unconditionally leaves the kernel lock state. 
 
thread_t * chSchReadyI(thread_t *tp, msg_t msg)
Makes the specified thread ready for execution. 
 
void _dbg_check_leave_isr(void)
Guard code for CH_IRQ_EPILOGUE(). 
 
#define CH_CFG_SYSTEM_HALT_HOOK(reason)
System halt hook. 
 
syssts_t chSysGetStatusAndLockX(void)
Returns the execution status and enters a critical zone. 
 
void * arg
Thread function argument. 
 
void _factory_init(void)
Initializes the objects factory. 
 
static void port_unlock_from_isr(void)
Kernel-unlock action from an interrupt handler. 
 
void _dbg_check_enter_isr(void)
Guard code for CH_IRQ_PROLOGUE(). 
 
void chSchDoReschedule(void)
Switches to the first thread on the runnable queue. 
 
void _heap_init(void)
Initializes the default heap. 
 
msg_t chSemWaitTimeout(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification. 
 
nil_system_t nil
System data structures. 
 
static syssts_t port_get_irq_status(void)
Returns a word encoding the current interrupts status. 
 
systime_t lasttime
System time of the last tick event. 
 
msg_t chSemWaitTimeoutS(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification. 
 
void _dbg_check_unlock(void)
Guard code for chSysUnlock(). 
 
void _dbg_check_disable(void)
Guard code for chSysDisable(). 
 
#define chTimeIsInRangeX(time, start, end)
Checks if the specified time is within the specified time range. 
 
#define chVTGetSystemTimeX()
Current system time. 
 
static bool port_irq_enabled(syssts_t sts)
Checks the interrupt status. 
 
#define MSG_RESET
Wakeup caused by a reset condition. 
 
Structure representing a thread.