ChibiOS
21.6.0
|
Macros | |
#define | __CHIBIOS_NIL__ |
ChibiOS/NIL identification macro. More... | |
#define | CH_KERNEL_STABLE 0 |
Stable release flag. More... | |
#define | THD_IDLE_BASE (&__main_thread_stack_base__) |
#define | __CH_STRINGIFY(a) #a |
Utility to make the parameter a quoted string. More... | |
#define | THD_WORKING_AREA_END(wa) ((wa) + ((sizeof wa) / sizeof (stkalign_t))) |
Returns the top address of a working area. More... | |
ChibiOS/NIL version identification | |
#define | CH_KERNEL_VERSION "4.1.0" |
Kernel version string. More... | |
#define | CH_KERNEL_MAJOR 4 |
Kernel version major number. More... | |
#define | CH_KERNEL_MINOR 1 |
Kernel version minor number. More... | |
#define | CH_KERNEL_PATCH 0 |
Kernel version patch number. More... | |
Constants for configuration options | |
#define | FALSE 0 |
Generic 'false' preprocessor boolean constant. More... | |
#define | TRUE 1 |
Generic 'true' preprocessor boolean constant. More... | |
Wakeup messages | |
#define | MSG_OK (msg_t)0 |
OK wakeup message. More... | |
#define | MSG_TIMEOUT (msg_t)-1 |
Wake-up caused by a timeout condition. More... | |
#define | MSG_RESET (msg_t)-2 |
Wake-up caused by a reset condition. More... | |
Special time constants | |
#define | TIME_IMMEDIATE ((sysinterval_t)-1) |
Zero time specification for some functions with a timeout specification. More... | |
#define | TIME_INFINITE ((sysinterval_t)0) |
Infinite time specification for all functions with a timeout specification. More... | |
#define | TIME_MAX_INTERVAL ((sysinterval_t)-2) |
Maximum interval constant usable as timeout. More... | |
#define | TIME_MAX_SYSTIME ((systime_t)-1) |
Maximum system of system time before it wraps. More... | |
Thread state related macros | |
#define | NIL_STATE_WTSTART (tstate_t)0 |
Thread not yet started or terminated. More... | |
#define | NIL_STATE_READY (tstate_t)1 |
Thread ready or executing. More... | |
#define | NIL_STATE_SLEEPING (tstate_t)2 |
Thread sleeping. More... | |
#define | NIL_STATE_SUSPENDED (tstate_t)3 |
Thread suspended. More... | |
#define | NIL_STATE_WTEXIT (tstate_t)4 |
Waiting a thread. More... | |
#define | NIL_STATE_WTQUEUE (tstate_t)5 |
On queue or semaph. More... | |
#define | NIL_STATE_WTOREVT (tstate_t)6 |
Waiting for events. More... | |
#define | NIL_STATE_WTANDEVT (tstate_t)7 |
Waiting for events. More... | |
#define | NIL_STATE_SNDMSGQ (tstate_t)8 |
Sending a message, in queue. More... | |
#define | NIL_STATE_WTMSG (tstate_t)10 |
Waiting for a message. More... | |
#define | NIL_STATE_FINAL (tstate_t)11 |
Thread terminated. More... | |
#define | NIL_THD_IS_WTSTART(tp) ((tp)->state == NIL_STATE_WTSTART) |
#define | NIL_THD_IS_READY(tp) ((tp)->state == NIL_STATE_READY) |
#define | NIL_THD_IS_SLEEPING(tp) ((tp)->state == NIL_STATE_SLEEPING) |
#define | NIL_THD_IS_SUSPENDED(tp) ((tp)->state == NIL_STATE_SUSPENDED) |
#define | NIL_THD_IS_WTEXIT(tp) ((tp)->state == NIL_STATE_WTEXIT) |
#define | NIL_THD_IS_WTQUEUE(tp) ((tp)->state == NIL_STATE_WTQUEUE) |
#define | NIL_THD_IS_WTOREVT(tp) ((tp)->state == NIL_STATE_WTOREVT) |
#define | NIL_THD_IS_WTANDEVT(tp) ((tp)->state == NIL_STATE_WTANDEVT) |
#define | NIL_THD_IS_SNDMSGQ(tp) ((tp)->state == NIL_STATE_SNDMSGQ) |
#define | NIL_THD_IS_WTMSG(tp) ((tp)->state == NIL_STATE_WTMSG) |
#define | NIL_THD_IS_FINAL(tp) ((tp)->state == NIL_STATE_FINAL) |
#define | CH_STATE_NAMES |
RT options not existing in NIL | |
#define | CH_CFG_USE_REGISTRY FALSE |
Kernel types | |
typedef port_rtcnt_t | rtcnt_t |
typedef port_syssts_t | syssts_t |
typedef port_stkalign_t | stkalign_t |
typedef uint8_t | tstate_t |
typedef uint32_t | tprio_t |
typedef int32_t | msg_t |
typedef int32_t | eventid_t |
typedef uint32_t | eventmask_t |
typedef uint32_t | eventflags_t |
typedef int32_t | cnt_t |
typedef uint32_t | ucnt_t |
Threads tables definition macros | |
#define | THD_TABLE_BEGIN const thread_descriptor_t nil_thd_configs[] = { |
Start of user threads table. More... | |
#define | THD_TABLE_THREAD(_prio, _name, _wap, _funcp, _arg) |
Entry of user threads table. More... | |
#define | THD_TABLE_END |
End of user threads table. More... | |
Memory alignment support macros | |
#define | MEM_ALIGN_MASK(a) ((size_t)(a) - 1U) |
Alignment mask constant. More... | |
#define | MEM_ALIGN_PREV(p, a) ((size_t)(p) & ~MEM_ALIGN_MASK(a)) |
Aligns to the previous aligned memory address. More... | |
#define | MEM_ALIGN_NEXT(p, a) |
Aligns to the new aligned memory address. More... | |
#define | MEM_IS_ALIGNED(p, a) (((size_t)(p) & MEM_ALIGN_MASK(a)) == 0U) |
Returns whatever a pointer or memory size is aligned. More... | |
#define | MEM_IS_VALID_ALIGNMENT(a) (((size_t)(a) != 0U) && (((size_t)(a) & ((size_t)(a) - 1U)) == 0U)) |
Returns whatever a constant is a valid alignment. More... | |
Working Areas | |
#define | THD_WORKING_AREA_SIZE(n) |
Calculates the total Working Area size. More... | |
#define | THD_WORKING_AREA(s, n) PORT_WORKING_AREA(s, n) |
Static working area allocation. More... | |
Threads abstraction macros | |
#define | THD_FUNCTION(tname, arg) PORT_THD_FUNCTION(tname, arg) |
Thread declaration macro. More... | |
ISRs abstraction macros | |
#define | CH_IRQ_IS_VALID_PRIORITY(prio) PORT_IRQ_IS_VALID_PRIORITY(prio) |
Priority level validation macro. More... | |
#define | CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) PORT_IRQ_IS_VALID_KERNEL_PRIORITY(prio) |
Priority level validation macro. More... | |
#define | CH_IRQ_PROLOGUE() |
IRQ handler enter code. More... | |
#define | CH_IRQ_EPILOGUE() |
IRQ handler exit code. More... | |
#define | CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id) |
Standard normal IRQ handler declaration. More... | |
Fast ISRs abstraction macros | |
#define | CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id) |
Standard fast IRQ handler declaration. More... | |
Time conversion utilities | |
#define | TIME_S2I(secs) ((sysinterval_t)((time_conv_t)(secs) * (time_conv_t)CH_CFG_ST_FREQUENCY)) |
Seconds to time interval. More... | |
#define | TIME_MS2I(msecs) |
Milliseconds to time interval. More... | |
#define | TIME_US2I(usecs) |
Microseconds to time interval. More... | |
#define | TIME_I2S(interval) |
Time interval to seconds. More... | |
#define | TIME_I2MS(interval) |
Time interval to milliseconds. More... | |
#define | TIME_I2US(interval) |
Time interval to microseconds. More... | |
Threads queues | |
#define | __THREADS_QUEUE_DATA(name) {(cnt_t)0} |
Data part of a static threads queue object initializer. More... | |
#define | THREADS_QUEUE_DECL(name) threads_queue_t name = __THREADS_QUEUE_DATA(name) |
Static threads queue object initializer. More... | |
Macro Functions | |
#define | chSysGetRealtimeCounterX() (rtcnt_t)port_rt_get_counter_value() |
Returns the current value of the system real time counter. More... | |
#define | chSysDisable() |
Raises the system interrupt priority mask to the maximum level. More... | |
#define | chSysSuspend() |
Raises the system interrupt priority mask to system level. More... | |
#define | chSysEnable() |
Lowers the system interrupt priority mask to user level. More... | |
#define | chSysLock() |
Enters the kernel lock state. More... | |
#define | chSysUnlock() |
Leaves the kernel lock state. More... | |
#define | chSysLockFromISR() |
Enters the kernel lock state from within an interrupt handler. More... | |
#define | chSysUnlockFromISR() |
Leaves the kernel lock state from within an interrupt handler. More... | |
#define | chSchGoSleepS(newstate) chSchGoSleepTimeoutS(newstate, TIME_INFINITE) |
Puts the current thread to sleep into the specified state. More... | |
#define | chSchWakeupS(ntp, msg) |
Wakes up a thread. More... | |
#define | chSchIsRescRequiredI() ((bool)(nil.current != nil.next)) |
Evaluates if a reschedule is required. More... | |
#define | chThdGetSelfX() nil.current |
Returns a pointer to the current thread_t . More... | |
#define | chThdGetPriorityX(void) (tprio_t)(nil.current - &nil.threads[0]) |
Returns the current thread priority. More... | |
#define | chThdResumeS(trp, msg) |
Wakes up a thread waiting on a thread reference object. More... | |
#define | chThdSleepSeconds(secs) chThdSleep(TIME_S2I(secs)) |
Delays the invoking thread for the specified number of seconds. More... | |
#define | chThdSleepMilliseconds(msecs) chThdSleep(TIME_MS2I(msecs)) |
Delays the invoking thread for the specified number of milliseconds. More... | |
#define | chThdSleepMicroseconds(usecs) chThdSleep(TIME_US2I(usecs)) |
Delays the invoking thread for the specified number of microseconds. More... | |
#define | chThdSleepS(timeout) (void) chSchGoSleepTimeoutS(NIL_STATE_SLEEPING, timeout) |
Suspends the invoking thread for the specified time. More... | |
#define | chThdSleepUntilS(abstime) |
Suspends the invoking thread until the system time arrives to the specified value. More... | |
#define | chThdQueueObjectInit(tqp) ((tqp)->cnt = (cnt_t)0) |
Initializes a threads queue object. More... | |
#define | chThdQueueIsEmptyI(tqp) ((bool)(tqp->cnt >= (cnt_t)0)) |
Evaluates to true if the specified queue is empty. More... | |
#define | chVTGetSystemTimeX() (nil.systime) |
Current system time. More... | |
#define | chVTTimeElapsedSinceX(start) chTimeDiffX((start), chVTGetSystemTimeX()) |
Returns the elapsed time since the specified start time. More... | |
#define | chVTIsSystemTimeWithinX(start, end) chTimeIsInRangeX(chVTGetSystemTimeX(), start, end) |
Checks if the current system time is within the specified time window. More... | |
#define | chTimeAddX(systime, interval) ((systime_t)(systime) + (systime_t)(interval)) |
Adds an interval to a system time returning a system time. More... | |
#define | chTimeDiffX(start, end) ((sysinterval_t)((systime_t)((systime_t)(end) - (systime_t)(start)))) |
Subtracts two system times returning an interval. More... | |
#define | chDbgCheck(c) |
Function parameters check. More... | |
#define | chDbgAssert(c, r) |
Condition assertion. More... | |
Typedefs | |
typedef uint32_t | systime_t |
Type of system time. More... | |
typedef uint32_t | sysinterval_t |
Type of time interval. More... | |
typedef uint64_t | time_conv_t |
Type of time conversion variable. More... | |
typedef struct nil_os_instance | os_instance_t |
Type of a structure representing the system. More... | |
typedef void(* | tfunc_t) (void *p) |
Thread function. More... | |
typedef struct nil_thread_descriptor | thread_descriptor_t |
Type of a thread descriptor. More... | |
typedef struct nil_thread | thread_t |
Type of a structure representing a thread. More... | |
typedef thread_t * | thread_reference_t |
Type of a thread reference. More... | |
typedef struct nil_threads_queue | threads_queue_t |
Type of a queue of threads. More... | |
typedef threads_queue_t | semaphore_t |
Type of a structure representing a semaphore. More... | |
Data Structures | |
struct | nil_threads_queue |
Structure representing a queue of threads. More... | |
struct | nil_thread_descriptor |
Structure representing a thread descriptor. More... | |
struct | nil_thread |
Structure representing a thread. More... | |
struct | nil_os_instance |
System data structure. More... | |
Functions | |
thread_t * | nil_find_thread (tstate_t state, void *p) |
Retrieves the highest priority thread in the specified state and associated to the specified object. More... | |
cnt_t | nil_ready_all (void *p, cnt_t cnt, msg_t msg) |
Puts in ready state all thread matching the specified status and associated object. More... | |
void | __dbg_check_disable (void) |
Guard code for chSysDisable() . More... | |
void | __dbg_check_suspend (void) |
Guard code for chSysSuspend() . More... | |
void | __dbg_check_enable (void) |
Guard code for chSysEnable() . More... | |
void | __dbg_check_lock (void) |
Guard code for chSysLock() . More... | |
void | __dbg_check_unlock (void) |
Guard code for chSysUnlock() . More... | |
void | __dbg_check_lock_from_isr (void) |
Guard code for chSysLockFromIsr() . More... | |
void | __dbg_check_unlock_from_isr (void) |
Guard code for chSysUnlockFromIsr() . More... | |
void | __dbg_check_enter_isr (void) |
Guard code for CH_IRQ_PROLOGUE() . More... | |
void | __dbg_check_leave_isr (void) |
Guard code for CH_IRQ_EPILOGUE() . More... | |
void | chDbgCheckClassI (void) |
I-class functions context check. More... | |
void | chDbgCheckClassS (void) |
S-class functions context check. More... | |
void | chSysInit (void) |
Initializes the kernel. More... | |
void | chSysHalt (const char *reason) |
Halts the system. More... | |
void | chSysTimerHandlerI (void) |
Time management handler. More... | |
void | chSysUnconditionalLock (void) |
Unconditionally enters the kernel lock state. More... | |
void | chSysUnconditionalUnlock (void) |
Unconditionally leaves the kernel lock state. More... | |
syssts_t | chSysGetStatusAndLockX (void) |
Returns the execution status and enters a critical zone. More... | |
void | chSysRestoreStatusX (syssts_t sts) |
Restores the specified execution status and leaves a critical zone. More... | |
bool | chSysIsCounterWithinX (rtcnt_t cnt, rtcnt_t start, rtcnt_t end) |
Realtime window test. More... | |
void | chSysPolledDelayX (rtcnt_t cycles) |
Polled delay. More... | |
thread_t * | chSchReadyI (thread_t *tp, msg_t msg) |
Makes the specified thread ready for execution. More... | |
bool | chSchIsPreemptionRequired (void) |
Evaluates if preemption is required. More... | |
void | chSchDoPreemption (void) |
Switches to the first thread on the runnable queue. More... | |
void | chSchRescheduleS (void) |
Reschedules if needed. More... | |
msg_t | chSchGoSleepTimeoutS (tstate_t newstate, sysinterval_t timeout) |
Puts the current thread to sleep into the specified state with timeout specification. More... | |
bool | chTimeIsInRangeX (systime_t time, systime_t start, systime_t end) |
Checks if the specified time is within the specified time range. More... | |
thread_t * | chThdCreateI (const thread_descriptor_t *tdp) |
Creates a new thread into a static memory area. More... | |
thread_t * | chThdCreate (const thread_descriptor_t *tdp) |
Creates a new thread into a static memory area. More... | |
void | chThdExit (msg_t msg) |
Terminates the current thread. More... | |
msg_t | chThdWait (thread_t *tp) |
Blocks the execution of the invoking thread until the specified thread terminates then the exit code is returned. More... | |
msg_t | chThdSuspendTimeoutS (thread_reference_t *trp, sysinterval_t timeout) |
Sends the current thread sleeping and sets a reference variable. More... | |
void | chThdResumeI (thread_reference_t *trp, msg_t msg) |
Wakes up a thread waiting on a thread reference object. More... | |
void | chThdResume (thread_reference_t *trp, msg_t msg) |
Wakes up a thread waiting on a thread reference object. More... | |
void | chThdSleep (sysinterval_t timeout) |
Suspends the invoking thread for the specified time. More... | |
void | chThdSleepUntil (systime_t abstime) |
Suspends the invoking thread until the system time arrives to the specified value. More... | |
msg_t | chThdEnqueueTimeoutS (threads_queue_t *tqp, sysinterval_t timeout) |
Enqueues the caller thread on a threads queue object. More... | |
void | chThdDoDequeueNextI (threads_queue_t *tqp, msg_t msg) |
Dequeues and wakes up one thread from the threads queue object. More... | |
void | chThdDequeueNextI (threads_queue_t *tqp, msg_t msg) |
Dequeues and wakes up one thread from the threads queue object, if any. More... | |
void | chThdDequeueAllI (threads_queue_t *tqp, msg_t msg) |
Dequeues and wakes up all threads from the threads queue object. More... | |
Variables | |
os_instance_t | nil |
System data structures. More... | |
#define __CHIBIOS_NIL__ |
ChibiOS/NIL identification macro.
Definition at line 42 of file nil/include/ch.h.
#define CH_KERNEL_STABLE 0 |
Stable release flag.
Definition at line 47 of file nil/include/ch.h.
#define CH_KERNEL_VERSION "4.1.0" |
Kernel version string.
Definition at line 56 of file nil/include/ch.h.
#define CH_KERNEL_MAJOR 4 |
Kernel version major number.
Definition at line 61 of file nil/include/ch.h.
#define CH_KERNEL_MINOR 1 |
Kernel version minor number.
Definition at line 66 of file nil/include/ch.h.
#define CH_KERNEL_PATCH 0 |
Kernel version patch number.
Definition at line 71 of file nil/include/ch.h.
#define FALSE 0 |
Generic 'false' preprocessor boolean constant.
Definition at line 83 of file nil/include/ch.h.
#define TRUE 1 |
Generic 'true' preprocessor boolean constant.
Definition at line 91 of file nil/include/ch.h.
#define MSG_OK (msg_t)0 |
OK wakeup message.
Definition at line 99 of file nil/include/ch.h.
#define MSG_TIMEOUT (msg_t)-1 |
Wake-up caused by a timeout condition.
Definition at line 100 of file nil/include/ch.h.
#define MSG_RESET (msg_t)-2 |
Wake-up caused by a reset condition.
Definition at line 102 of file nil/include/ch.h.
#define TIME_IMMEDIATE ((sysinterval_t)-1) |
Zero time specification for some functions with a timeout specification.
TIME_IMMEDIATE
as timeout parameter, see the specific function documentation. Definition at line 116 of file nil/include/ch.h.
#define TIME_INFINITE ((sysinterval_t)0) |
Infinite time specification for all functions with a timeout specification.
Definition at line 122 of file nil/include/ch.h.
#define TIME_MAX_INTERVAL ((sysinterval_t)-2) |
Maximum interval constant usable as timeout.
Definition at line 127 of file nil/include/ch.h.
#define TIME_MAX_SYSTIME ((systime_t)-1) |
Maximum system of system time before it wraps.
Definition at line 132 of file nil/include/ch.h.
#define NIL_STATE_WTSTART (tstate_t)0 |
Thread not yet started or terminated.
Definition at line 139 of file nil/include/ch.h.
#define NIL_STATE_READY (tstate_t)1 |
Thread ready or executing.
Definition at line 141 of file nil/include/ch.h.
#define NIL_STATE_SLEEPING (tstate_t)2 |
Thread sleeping.
Definition at line 143 of file nil/include/ch.h.
#define NIL_STATE_SUSPENDED (tstate_t)3 |
Thread suspended.
Definition at line 144 of file nil/include/ch.h.
#define NIL_STATE_WTEXIT (tstate_t)4 |
Waiting a thread.
Definition at line 145 of file nil/include/ch.h.
#define NIL_STATE_WTQUEUE (tstate_t)5 |
On queue or semaph.
Definition at line 146 of file nil/include/ch.h.
#define NIL_STATE_WTOREVT (tstate_t)6 |
Waiting for events.
Definition at line 147 of file nil/include/ch.h.
#define NIL_STATE_WTANDEVT (tstate_t)7 |
Waiting for events.
Definition at line 148 of file nil/include/ch.h.
#define NIL_STATE_SNDMSGQ (tstate_t)8 |
Sending a message, in queue.
Definition at line 149 of file nil/include/ch.h.
#define NIL_STATE_WTMSG (tstate_t)10 |
Waiting for a message.
Definition at line 151 of file nil/include/ch.h.
#define NIL_STATE_FINAL (tstate_t)11 |
Thread terminated.
Definition at line 153 of file nil/include/ch.h.
#define THD_IDLE_BASE (&__main_thread_stack_base__) |
Boundaries of the idle thread boundaries, only required if stack checking is enabled.
Definition at line 370 of file nil/include/ch.h.
#define __CH_STRINGIFY | ( | a | ) | #a |
Utility to make the parameter a quoted string.
Definition at line 618 of file nil/include/ch.h.
#define THD_TABLE_BEGIN const thread_descriptor_t nil_thd_configs[] = { |
Start of user threads table.
Definition at line 627 of file nil/include/ch.h.
#define THD_TABLE_THREAD | ( | _prio, | |
_name, | |||
_wap, | |||
_funcp, | |||
_arg | |||
) |
Entry of user threads table.
Definition at line 633 of file nil/include/ch.h.
#define THD_TABLE_END |
End of user threads table.
Definition at line 646 of file nil/include/ch.h.
#define MEM_ALIGN_MASK | ( | a | ) | ((size_t)(a) - 1U) |
Alignment mask constant.
[in] | a | alignment, must be a power of two |
Definition at line 667 of file nil/include/ch.h.
#define MEM_ALIGN_PREV | ( | p, | |
a | |||
) | ((size_t)(p) & ~MEM_ALIGN_MASK(a)) |
Aligns to the previous aligned memory address.
[in] | p | variable to be aligned |
[in] | a | alignment, must be a power of two |
Definition at line 675 of file nil/include/ch.h.
#define MEM_ALIGN_NEXT | ( | p, | |
a | |||
) |
Aligns to the new aligned memory address.
[in] | p | variable to be aligned |
[in] | a | alignment, must be a power of two |
Definition at line 683 of file nil/include/ch.h.
#define MEM_IS_ALIGNED | ( | p, | |
a | |||
) | (((size_t)(p) & MEM_ALIGN_MASK(a)) == 0U) |
Returns whatever a pointer or memory size is aligned.
[in] | p | variable to be aligned |
[in] | a | alignment, must be a power of two |
Definition at line 692 of file nil/include/ch.h.
#define MEM_IS_VALID_ALIGNMENT | ( | a | ) | (((size_t)(a) != 0U) && (((size_t)(a) & ((size_t)(a) - 1U)) == 0U)) |
Returns whatever a constant is a valid alignment.
Valid alignments are powers of two.
[in] | a | alignment to be checked, must be a constant |
Definition at line 700 of file nil/include/ch.h.
#define THD_WORKING_AREA_SIZE | ( | n | ) |
Calculates the total Working Area size.
[in] | n | the stack size to be assigned to the thread |
Definition at line 716 of file nil/include/ch.h.
#define THD_WORKING_AREA | ( | s, | |
n | |||
) | PORT_WORKING_AREA(s, n) |
Static working area allocation.
This macro is used to allocate a static thread working area aligned as both position and size.
[in] | s | the name to be assigned to the stack array |
[in] | n | the stack size to be assigned to the thread |
Definition at line 729 of file nil/include/ch.h.
#define THD_WORKING_AREA_END | ( | wa | ) | ((wa) + ((sizeof wa) / sizeof (stkalign_t))) |
Returns the top address of a working area.
stkalign_t
. The macros is invalid for anything else.[in] | wa | working area array |
Definition at line 741 of file nil/include/ch.h.
#define THD_FUNCTION | ( | tname, | |
arg | |||
) | PORT_THD_FUNCTION(tname, arg) |
Thread declaration macro.
Definition at line 753 of file nil/include/ch.h.
#define CH_IRQ_IS_VALID_PRIORITY | ( | prio | ) | PORT_IRQ_IS_VALID_PRIORITY(prio) |
Priority level validation macro.
This macro determines if the passed value is a valid priority level for the underlying architecture.
[in] | prio | the priority level |
false | if the priority is invalid or if the architecture does not support priorities. |
true | if the priority is valid. |
Definition at line 772 of file nil/include/ch.h.
#define CH_IRQ_IS_VALID_KERNEL_PRIORITY | ( | prio | ) | PORT_IRQ_IS_VALID_KERNEL_PRIORITY(prio) |
Priority level validation macro.
This macro determines if the passed value is a valid priority level that cannot preempt the kernel critical zone.
[in] | prio | the priority level |
false | if the priority is invalid or if the architecture does not support priorities. |
true | if the priority is valid. |
Definition at line 790 of file nil/include/ch.h.
#define CH_IRQ_PROLOGUE | ( | ) |
IRQ handler enter code.
Definition at line 803 of file nil/include/ch.h.
#define CH_IRQ_EPILOGUE | ( | ) |
IRQ handler exit code.
Definition at line 813 of file nil/include/ch.h.
#define CH_IRQ_HANDLER | ( | id | ) | PORT_IRQ_HANDLER(id) |
Standard normal IRQ handler declaration.
id
can be a function name or a vector number depending on the port implementation.Definition at line 824 of file nil/include/ch.h.
#define CH_FAST_IRQ_HANDLER | ( | id | ) | PORT_FAST_IRQ_HANDLER(id) |
Standard fast IRQ handler declaration.
id
can be a function name or a vector number depending on the port implementation. Definition at line 839 of file nil/include/ch.h.
#define TIME_S2I | ( | secs | ) | ((sysinterval_t)((time_conv_t)(secs) * (time_conv_t)CH_CFG_ST_FREQUENCY)) |
Seconds to time interval.
Converts from seconds to system ticks number.
[in] | secs | number of seconds |
Definition at line 859 of file nil/include/ch.h.
#define TIME_MS2I | ( | msecs | ) |
Milliseconds to time interval.
Converts from milliseconds to system ticks number.
[in] | msecs | number of milliseconds |
Definition at line 875 of file nil/include/ch.h.
#define TIME_US2I | ( | usecs | ) |
Microseconds to time interval.
Converts from microseconds to system ticks number.
[in] | usecs | number of microseconds |
Definition at line 893 of file nil/include/ch.h.
#define TIME_I2S | ( | interval | ) |
Time interval to seconds.
Converts from system ticks number to seconds.
[in] | interval | interval in ticks |
Definition at line 911 of file nil/include/ch.h.
#define TIME_I2MS | ( | interval | ) |
Time interval to milliseconds.
Converts from system ticks number to milliseconds.
[in] | interval | interval in ticks |
Definition at line 929 of file nil/include/ch.h.
#define TIME_I2US | ( | interval | ) |
Time interval to microseconds.
Converts from system ticks number to microseconds.
[in] | interval | interval in ticks |
Definition at line 947 of file nil/include/ch.h.
#define __THREADS_QUEUE_DATA | ( | name | ) | {(cnt_t)0} |
Data part of a static threads queue object initializer.
This macro should be used when statically initializing a threads queue that is part of a bigger structure.
[in] | name | the name of the threads queue variable |
Definition at line 964 of file nil/include/ch.h.
#define THREADS_QUEUE_DECL | ( | name | ) | threads_queue_t name = __THREADS_QUEUE_DATA(name) |
Static threads queue object initializer.
Statically initialized threads queues require no explicit initialization using queue_init()
.
[in] | name | the name of the threads queue variable |
Definition at line 973 of file nil/include/ch.h.
#define chSysGetRealtimeCounterX | ( | ) | (rtcnt_t)port_rt_get_counter_value() |
Returns the current value of the system real time counter.
PORT_SUPPORTS_RT
.Definition at line 992 of file nil/include/ch.h.
#define chSysDisable | ( | ) |
Raises the system interrupt priority mask to the maximum level.
All the maskable interrupt sources are disabled regardless their hardware priority.
Definition at line 1003 of file nil/include/ch.h.
#define chSysSuspend | ( | ) |
Raises the system interrupt priority mask to system level.
The interrupt sources that should not be able to preempt the kernel are disabled, interrupt sources with higher priority are still enabled.
chSysLock()
, the chSysLock()
could do more than just disable the interrupts.Definition at line 1019 of file nil/include/ch.h.
#define chSysEnable | ( | ) |
Lowers the system interrupt priority mask to user level.
All the interrupt sources are enabled.
chSysUnlock()
, the chSysUnlock()
could do more than just enable the interrupts.Definition at line 1033 of file nil/include/ch.h.
#define chSysLock | ( | ) |
Enters the kernel lock state.
Definition at line 1043 of file nil/include/ch.h.
#define chSysUnlock | ( | ) |
Leaves the kernel lock state.
Definition at line 1053 of file nil/include/ch.h.
#define chSysLockFromISR | ( | ) |
Enters the kernel lock state from within an interrupt handler.
Definition at line 1070 of file nil/include/ch.h.
#define chSysUnlockFromISR | ( | ) |
Leaves the kernel lock state from within an interrupt handler.
Definition at line 1088 of file nil/include/ch.h.
#define chSchGoSleepS | ( | newstate | ) | chSchGoSleepTimeoutS(newstate, TIME_INFINITE) |
Puts the current thread to sleep into the specified state.
[in] | newstate | the new thread state or a semaphore pointer |
Definition at line 1101 of file nil/include/ch.h.
#define chSchWakeupS | ( | ntp, | |
msg | |||
) |
Wakes up a thread.
[in] | ntp | the thread to be made ready |
[in] | msg | the wakeup message |
Definition at line 1111 of file nil/include/ch.h.
#define chSchIsRescRequiredI | ( | ) | ((bool)(nil.current != nil.next)) |
Evaluates if a reschedule is required.
true | if there is a thread that must go in running state immediately. |
false | if preemption is not required. |
Definition at line 1125 of file nil/include/ch.h.
#define chThdGetSelfX | ( | ) | nil.current |
Returns a pointer to the current thread_t
.
Definition at line 1132 of file nil/include/ch.h.
#define chThdGetPriorityX | ( | void | ) | (tprio_t)(nil.current - &nil.threads[0]) |
Returns the current thread priority.
Definition at line 1142 of file nil/include/ch.h.
#define chThdResumeS | ( | trp, | |
msg | |||
) |
Wakes up a thread waiting on a thread reference object.
[in] | trp | a pointer to a thread reference object |
[in] | msg | the message code |
Definition at line 1154 of file nil/include/ch.h.
#define chThdSleepSeconds | ( | secs | ) | chThdSleep(TIME_S2I(secs)) |
Delays the invoking thread for the specified number of seconds.
[in] | secs | time in seconds, must be different from zero |
Definition at line 1169 of file nil/include/ch.h.
#define chThdSleepMilliseconds | ( | msecs | ) | chThdSleep(TIME_MS2I(msecs)) |
Delays the invoking thread for the specified number of milliseconds.
[in] | msecs | time in milliseconds, must be different from zero |
Definition at line 1182 of file nil/include/ch.h.
#define chThdSleepMicroseconds | ( | usecs | ) | chThdSleep(TIME_US2I(usecs)) |
Delays the invoking thread for the specified number of microseconds.
[in] | usecs | time in microseconds, must be different from zero |
Definition at line 1195 of file nil/include/ch.h.
#define chThdSleepS | ( | timeout | ) | (void) chSchGoSleepTimeoutS(NIL_STATE_SLEEPING, timeout) |
Suspends the invoking thread for the specified time.
[in] | timeout | the delay in system ticks |
Definition at line 1204 of file nil/include/ch.h.
#define chThdSleepUntilS | ( | abstime | ) |
Suspends the invoking thread until the system time arrives to the specified value.
[in] | abstime | absolute system time |
Definition at line 1215 of file nil/include/ch.h.
#define chThdQueueObjectInit | ( | tqp | ) | ((tqp)->cnt = (cnt_t)0) |
Initializes a threads queue object.
[out] | tqp | pointer to the threads queue object |
Definition at line 1226 of file nil/include/ch.h.
#define chThdQueueIsEmptyI | ( | tqp | ) | ((bool)(tqp->cnt >= (cnt_t)0)) |
Evaluates to true
if the specified queue is empty.
[out] | tqp | pointer to the threads queue object |
false | if the queue is not empty. |
true | if the queue is empty. |
Definition at line 1238 of file nil/include/ch.h.
#define chVTGetSystemTimeX | ( | ) | (nil.systime) |
Current system time.
Returns the number of system ticks since the chSysInit()
invocation.
systime_t
size.Definition at line 1254 of file nil/include/ch.h.
#define chVTTimeElapsedSinceX | ( | start | ) | chTimeDiffX((start), chVTGetSystemTimeX()) |
Returns the elapsed time since the specified start time.
[in] | start | start time |
Definition at line 1267 of file nil/include/ch.h.
#define chVTIsSystemTimeWithinX | ( | start, | |
end | |||
) | chTimeIsInRangeX(chVTGetSystemTimeX(), start, end) |
Checks if the current system time is within the specified time window.
[in] | start | the start of the time window (inclusive) |
[in] | end | the end of the time window (non inclusive) |
true | current time within the specified time window. |
false | current time not within the specified time window. |
Definition at line 1283 of file nil/include/ch.h.
Adds an interval to a system time returning a system time.
[in] | systime | base system time |
[in] | interval | interval to be added |
Definition at line 1295 of file nil/include/ch.h.
#define chTimeDiffX | ( | start, | |
end | |||
) | ((sysinterval_t)((systime_t)((systime_t)(end) - (systime_t)(start)))) |
Subtracts two system times returning an interval.
[in] | start | first system time |
[in] | end | second system time |
Definition at line 1307 of file nil/include/ch.h.
#define chDbgCheck | ( | c | ) |
Function parameters check.
If the condition check fails then the kernel panics and halts.
CH_DBG_ENABLE_CHECKS
switch is specified in chconf.h
else the macro does nothing.[in] | c | the condition to be verified to be true |
Definition at line 1321 of file nil/include/ch.h.
#define chDbgAssert | ( | c, | |
r | |||
) |
Condition assertion.
If the condition check fails then the kernel panics with a message and halts.
CH_DBG_ENABLE_ASSERTS
switch is specified in chconf.h
else the macro does nothing. [in] | c | the condition to be verified to be true |
[in] | r | a remark string |
Definition at line 1347 of file nil/include/ch.h.
typedef port_rtcnt_t rtcnt_t |
Realtime counter.
Definition at line 386 of file nil/include/ch.h.
typedef port_syssts_t syssts_t |
System status word.
Definition at line 387 of file nil/include/ch.h.
typedef port_stkalign_t stkalign_t |
Stack alignment type.
Definition at line 388 of file nil/include/ch.h.
typedef uint8_t tstate_t |
Thread state.
Definition at line 391 of file nil/include/ch.h.
typedef uint32_t tprio_t |
Thread priority.
Definition at line 392 of file nil/include/ch.h.
typedef int32_t msg_t |
Inter-thread message.
Definition at line 393 of file nil/include/ch.h.
typedef int32_t eventid_t |
Numeric event identifier.
Definition at line 394 of file nil/include/ch.h.
typedef uint32_t eventmask_t |
Mask of event identifiers.
Definition at line 395 of file nil/include/ch.h.
typedef uint32_t eventflags_t |
Mask of event flags.
Definition at line 396 of file nil/include/ch.h.
typedef int32_t cnt_t |
Generic signed counter.
Definition at line 397 of file nil/include/ch.h.
typedef uint32_t ucnt_t |
Generic unsigned counter.
Definition at line 398 of file nil/include/ch.h.
typedef uint32_t systime_t |
Type of system time.
Definition at line 428 of file nil/include/ch.h.
typedef uint32_t sysinterval_t |
Type of time interval.
Definition at line 434 of file nil/include/ch.h.
typedef uint64_t time_conv_t |
Type of time conversion variable.
Definition at line 441 of file nil/include/ch.h.
typedef struct nil_os_instance os_instance_t |
Type of a structure representing the system.
Definition at line 452 of file nil/include/ch.h.
typedef void(* tfunc_t) (void *p) |
Thread function.
Definition at line 457 of file nil/include/ch.h.
typedef struct nil_thread_descriptor thread_descriptor_t |
Type of a thread descriptor.
Definition at line 462 of file nil/include/ch.h.
typedef struct nil_thread thread_t |
Type of a structure representing a thread.
Definition at line 468 of file nil/include/ch.h.
typedef thread_t* thread_reference_t |
Type of a thread reference.
Definition at line 473 of file nil/include/ch.h.
typedef struct nil_threads_queue threads_queue_t |
Type of a queue of threads.
Definition at line 478 of file nil/include/ch.h.
typedef threads_queue_t semaphore_t |
Type of a structure representing a semaphore.
Definition at line 486 of file nil/include/ch.h.
Retrieves the highest priority thread in the specified state and associated to the specified object.
[in] | state | thread state |
[in] | p | object pointer |
NULL | if the thread is not found. |
Definition at line 70 of file ch.c.
References CH_CFG_MAX_THREADS, nil, and ch_thread::state.
Referenced by chThdDoDequeueNextI().
Puts in ready state all thread matching the specified status and associated object.
[in] | p | object pointer |
[in] | cnt | number of threads to be readied as a negative number, non negative numbers are ignored |
[in] | msg | the wakeup message |
Definition at line 95 of file ch.c.
References CH_CFG_MAX_THREADS, chDbgAssert, chSchReadyI(), nil, NIL_STATE_WTQUEUE, and ch_thread::state.
Referenced by chThdDequeueAllI().
void __dbg_check_disable | ( | void | ) |
Guard code for chSysDisable()
.
Definition at line 120 of file ch.c.
References chSysHalt(), and nil.
void __dbg_check_suspend | ( | void | ) |
Guard code for chSysSuspend()
.
Definition at line 132 of file ch.c.
References chSysHalt(), and nil.
void __dbg_check_enable | ( | void | ) |
Guard code for chSysEnable()
.
Definition at line 144 of file ch.c.
References chSysHalt(), and nil.
void __dbg_check_lock | ( | void | ) |
Guard code for chSysLock()
.
Definition at line 156 of file ch.c.
References chSysHalt(), and nil.
void __dbg_check_unlock | ( | void | ) |
Guard code for chSysUnlock()
.
Definition at line 169 of file ch.c.
References chSysHalt(), and nil.
void __dbg_check_lock_from_isr | ( | void | ) |
Guard code for chSysLockFromIsr()
.
Definition at line 182 of file ch.c.
References chSysHalt(), and nil.
void __dbg_check_unlock_from_isr | ( | void | ) |
Guard code for chSysUnlockFromIsr()
.
Definition at line 195 of file ch.c.
References chSysHalt(), and nil.
void __dbg_check_enter_isr | ( | void | ) |
Guard code for CH_IRQ_PROLOGUE()
.
Definition at line 208 of file ch.c.
References chSysHalt(), nil, port_lock_from_isr(), and port_unlock_from_isr().
void __dbg_check_leave_isr | ( | void | ) |
Guard code for CH_IRQ_EPILOGUE()
.
Definition at line 223 of file ch.c.
References chSysHalt(), nil, port_lock_from_isr(), and port_unlock_from_isr().
void chDbgCheckClassI | ( | void | ) |
I-class functions context check.
Verifies that the system is in an appropriate state for invoking an I-class API function. A panic is generated if the state is not compatible.
Definition at line 241 of file ch.c.
References chSysHalt(), and nil.
Referenced by chSchReadyI(), chSysTimerHandlerI(), chThdCreateI(), chThdDequeueAllI(), and chThdDequeueNextI().
void chDbgCheckClassS | ( | void | ) |
S-class functions context check.
Verifies that the system is in an appropriate state for invoking an S-class API function. A panic is generated if the state is not compatible.
Definition at line 256 of file ch.c.
References chSysHalt(), and nil.
Referenced by chSchGoSleepTimeoutS(), chSchRescheduleS(), and chThdEnqueueTimeoutS().
void chSysInit | ( | void | ) |
Initializes the kernel.
Initializes the kernel structures, the current instructions flow becomes the idle thread upon return. The idle thread must not invoke any kernel primitive able to change state to not runnable.
nil
global variable has been zeroed by the runtime environment. If this is not the case then make sure to clear it before calling this function.Definition at line 275 of file ch.c.
References __oslib_init(), CH_CFG_MAX_THREADS, CH_CFG_SYSTEM_INIT_HOOK, chSchRescheduleS(), chSysSuspend, chSysUnlock, chThdCreateI(), thread_descriptor_t::funcp, nil, NIL_STATE_READY, and THD_IDLE_BASE.
void chSysHalt | ( | const char * | reason | ) |
Halts the system.
This function is invoked by the operating system when an unrecoverable error is detected, for example because a programming error in the application code that triggers an assertion while in debug mode.
[in] | reason | pointer to an error string |
Definition at line 330 of file ch.c.
References __trace_halt(), CH_CFG_SYSTEM_HALT_HOOK, currcore, nil, port_disable(), and ch_system::state.
Referenced by __dbg_check_disable(), __dbg_check_enable(), __dbg_check_enter_isr(), __dbg_check_leave_isr(), __dbg_check_lock(), __dbg_check_lock_from_isr(), __dbg_check_suspend(), __dbg_check_unlock(), __dbg_check_unlock_from_isr(), chDbgCheckClassI(), and chDbgCheckClassS().
void chSysTimerHandlerI | ( | void | ) |
Time management handler.
Definition at line 355 of file ch.c.
References chDbgAssert, chDbgCheckClassI(), and nil.
void chSysUnconditionalLock | ( | void | ) |
Unconditionally enters the kernel lock state.
Definition at line 458 of file ch.c.
References chSysLock, port_get_irq_status(), and port_irq_enabled().
void chSysUnconditionalUnlock | ( | void | ) |
Unconditionally leaves the kernel lock state.
Definition at line 472 of file ch.c.
References chSysUnlock, port_get_irq_status(), and port_irq_enabled().
syssts_t chSysGetStatusAndLockX | ( | void | ) |
Returns the execution status and enters a critical zone.
This functions enters into a critical zone and can be called from any context. Because its flexibility it is less efficient than chSysLock()
which is preferable when the calling context is known.
Definition at line 492 of file ch.c.
References chSysLock, chSysLockFromISR, port_get_irq_status(), port_irq_enabled(), and port_is_isr_context().
void chSysRestoreStatusX | ( | syssts_t | sts | ) |
Restores the specified execution status and leaves a critical zone.
chSchRescheduleS()
is automatically performed if exiting the critical zone and if not in ISR context.[in] | sts | the system status to be restored. |
Definition at line 515 of file ch.c.
References chSchRescheduleS(), chSysUnlock, chSysUnlockFromISR, port_irq_enabled(), and port_is_isr_context().
Realtime window test.
This function verifies if the current realtime counter value lies within the specified range or not. The test takes care of the realtime counter wrapping to zero on overflow.
PORT_SUPPORTS_RT
.[in] | cnt | the counter value to be tested |
[in] | start | the start of the time window (inclusive) |
[in] | end | the end of the time window (non inclusive) |
true | current time within the specified time window. |
false | current time not within the specified time window. |
Definition at line 547 of file ch.c.
Referenced by chSysPolledDelayX().
void chSysPolledDelayX | ( | rtcnt_t | cycles | ) |
Polled delay.
PORT_SUPPORTS_RT
.[in] | cycles | number of cycles |
Definition at line 564 of file ch.c.
References chSysGetRealtimeCounterX, and chSysIsCounterWithinX().
Makes the specified thread ready for execution.
[in] | tp | pointer to the thread_t object |
[in] | msg | the wakeup message |
Definition at line 581 of file ch.c.
References CH_CFG_MAX_THREADS, chDbgAssert, chDbgCheck, chDbgCheckClassI(), and nil.
Referenced by chThdDoDequeueNextI(), chThdExit(), and nil_ready_all().
bool chSchIsPreemptionRequired | ( | void | ) |
Evaluates if preemption is required.
The decision is taken by comparing the relative priorities and depending on the state of the round robin timeout counter.
true | if there is a thread that must go in running state immediately. |
false | if preemption is not required. |
Definition at line 610 of file ch.c.
References chSchIsRescRequiredI.
void chSchDoPreemption | ( | void | ) |
Switches to the first thread on the runnable queue.
Definition at line 622 of file ch.c.
References CH_CFG_IDLE_LEAVE_HOOK, CH_CFG_MAX_THREADS, nil, and port_switch.
Referenced by chSchRescheduleS().
void chSchRescheduleS | ( | void | ) |
Reschedules if needed.
Definition at line 637 of file ch.c.
References chDbgCheckClassS(), chSchDoPreemption(), and chSchIsRescRequiredI.
Referenced by chSysInit(), chSysRestoreStatusX(), and chThdCreate().
msg_t chSchGoSleepTimeoutS | ( | tstate_t | newstate, |
sysinterval_t | timeout | ||
) |
Puts the current thread to sleep into the specified state with timeout specification.
The thread goes into a sleeping state, if it is not awakened explicitly within the specified system time then it is forcibly awakened with a MSG_TIMEOUT
low level message.
[in] | newstate | the new thread state or a semaphore pointer |
[in] | timeout | the number of ticks before the operation timeouts. the following special values are allowed:
|
MSG_TIMEOUT | if a timeout occurred. |
Definition at line 663 of file ch.c.
References CH_CFG_MAX_THREADS, chDbgAssert, chDbgCheckClassS(), nil, ch_thread::state, and TIME_INFINITE.
Referenced by chThdEnqueueTimeoutS(), chThdExit(), and chThdSuspendTimeoutS().
Checks if the specified time is within the specified time range.
[in] | time | the time to be verified |
[in] | start | the start of the time window (inclusive) |
[in] | end | the end of the time window (non inclusive) |
true | current time within the specified time window. |
false | current time not within the specified time window. |
Definition at line 743 of file ch.c.
Referenced by chThdSleepUntilWindowed(), chVTIsSystemTimeWithin(), and chVTIsSystemTimeWithinX().
thread_t* chThdCreateI | ( | const thread_descriptor_t * | tdp | ) |
Creates a new thread into a static memory area.
The new thread is initialized and make ready to execute.
chThdExit()
or by simply returning from its main function.[out] | tdp | pointer to the thread descriptor structure |
thread_t
structure allocated for the thread.Definition at line 761 of file ch.c.
References CH_CFG_MAX_THREADS, chDbgAssert, chDbgCheck, chDbgCheckClassI(), thread_descriptor_t::funcp, MEM_IS_ALIGNED, nil, PORT_STACK_ALIGN, PORT_WORKING_AREA_ALIGN, thread_descriptor_t::prio, thread_descriptor_t::wbase, and thread_descriptor_t::wend.
Referenced by chSysInit(), and chThdCreate().
thread_t* chThdCreate | ( | const thread_descriptor_t * | tdp | ) |
Creates a new thread into a static memory area.
The new thread is initialized and make ready to execute.
chThdExit()
or by simply returning from its main function.[out] | tdp | pointer to the thread descriptor structure |
thread_t
structure allocated for the thread.Definition at line 807 of file ch.c.
References chSchRescheduleS(), chSysLock, chSysUnlock, and chThdCreateI().
void chThdExit | ( | msg_t | msg | ) |
Terminates the current thread.
The thread goes in the CH_STATE_FINAL
state holding the specified exit status code, other threads can retrieve the exit status code by invoking the function chThdWait()
.
[in] | msg | thread exit code |
Definition at line 835 of file ch.c.
References CH_CFG_MAX_THREADS, CH_CFG_THREAD_EXIT_HOOK, chDbgAssert, chSchGoSleepTimeoutS(), chSchReadyI(), chSysLock, nil, NIL_STATE_FINAL, NIL_STATE_WTEXIT, ch_thread::state, and TIME_INFINITE.
Blocks the execution of the invoking thread until the specified thread terminates then the exit code is returned.
[in] | tp | pointer to the thread |
Definition at line 873 of file ch.c.
References chSysLock.
msg_t chThdSuspendTimeoutS | ( | thread_reference_t * | trp, |
sysinterval_t | timeout | ||
) |
Sends the current thread sleeping and sets a reference variable.
[in] | trp | a pointer to a thread reference object |
[in] | timeout | the number of ticks before the operation timeouts, the following special values are allowed:
|
Definition at line 904 of file ch.c.
References chDbgAssert, chSchGoSleepTimeoutS(), MSG_TIMEOUT, nil, NIL_STATE_SUSPENDED, and TIME_IMMEDIATE.
void chThdResumeI | ( | thread_reference_t * | trp, |
msg_t | msg | ||
) |
Wakes up a thread waiting on a thread reference object.
[in] | trp | a pointer to a thread reference object |
[in] | msg | the message code |
Definition at line 927 of file ch.c.
References chDbgAssert.
void chThdResume | ( | thread_reference_t * | trp, |
msg_t | msg | ||
) |
Wakes up a thread waiting on a thread reference object.
[in] | trp | a pointer to a thread reference object |
[in] | msg | the message code |
Definition at line 949 of file ch.c.
References chSysLock, chSysUnlock, and chThdResumeS().
void chThdSleep | ( | sysinterval_t | timeout | ) |
Suspends the invoking thread for the specified time.
[in] | timeout | the delay in system ticks |
Definition at line 963 of file ch.c.
References chSysLock, chSysUnlock, and chThdSleepS.
void chThdSleepUntil | ( | systime_t | abstime | ) |
Suspends the invoking thread until the system time arrives to the specified value.
[in] | abstime | absolute system time |
Definition at line 978 of file ch.c.
References chSysLock, chSysUnlock, and chThdSleepUntilS.
msg_t chThdEnqueueTimeoutS | ( | threads_queue_t * | tqp, |
sysinterval_t | timeout | ||
) |
Enqueues the caller thread on a threads queue object.
The caller thread is enqueued and put to sleep until it is dequeued or the specified timeouts expires.
[in] | tqp | pointer to the threads queue object |
[in] | timeout | the timeout in system ticks, the special values are handled as follow:
|
osalQueueWakeupOneI()
or osalQueueWakeupAllI()
functions. MSG_TIMEOUT | if the thread has not been dequeued within the specified timeout or if the function has been invoked with TIME_IMMEDIATE as timeout specification. |
Definition at line 1005 of file ch.c.
References chDbgAssert, chDbgCheck, chDbgCheckClassS(), chSchGoSleepTimeoutS(), MSG_TIMEOUT, nil, NIL_STATE_WTQUEUE, and TIME_IMMEDIATE.
void chThdDoDequeueNextI | ( | threads_queue_t * | tqp, |
msg_t | msg | ||
) |
Dequeues and wakes up one thread from the threads queue object.
Dequeues one thread from the queue without checking if the queue is empty.
[in] | tqp | pointer to the threads queue object |
[in] | msg | the message code |
Definition at line 1032 of file ch.c.
References chDbgAssert, chSchReadyI(), nil_find_thread(), and NIL_STATE_WTQUEUE.
Referenced by chThdDequeueAllI(), and chThdDequeueNextI().
void chThdDequeueNextI | ( | threads_queue_t * | tqp, |
msg_t | msg | ||
) |
Dequeues and wakes up one thread from the threads queue object, if any.
[in] | tqp | pointer to the threads queue object |
[in] | msg | the message code |
Definition at line 1054 of file ch.c.
References chDbgCheck, chDbgCheckClassI(), and chThdDoDequeueNextI().
void chThdDequeueAllI | ( | threads_queue_t * | tqp, |
msg_t | msg | ||
) |
Dequeues and wakes up all threads from the threads queue object.
[in] | tqp | pointer to the threads queue object |
[in] | msg | the message code |
Definition at line 1072 of file ch.c.
References chDbgCheck, chDbgCheckClassI(), and nil_ready_all().
os_instance_t nil |
System data structures.
Definition at line 41 of file ch.c.
Referenced by __dbg_check_disable(), __dbg_check_enable(), __dbg_check_enter_isr(), __dbg_check_leave_isr(), __dbg_check_lock(), __dbg_check_lock_from_isr(), __dbg_check_suspend(), __dbg_check_unlock(), __dbg_check_unlock_from_isr(), chDbgCheckClassI(), chDbgCheckClassS(), chEvtWaitAllTimeout(), chEvtWaitAnyTimeout(), chEvtWaitOneTimeout(), chMsgSend(), chSchDoPreemption(), chSchGoSleepTimeoutS(), chSchReadyI(), chSysHalt(), chSysInit(), chSysTimerHandlerI(), chThdCreateI(), chThdEnqueueTimeoutS(), chThdExit(), chThdSuspendTimeoutS(), nil_find_thread(), and nil_ready_all().