Go to the documentation of this file.
42 #if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
61 #if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
79 port_wait_for_interrupt();
107 #if CH_DBG_SYSTEM_STATE_CHECK == TRUE
111 #if CH_CFG_USE_TM == TRUE
114 #if CH_DBG_STATISTICS == TRUE
118 #if CH_CFG_NO_IDLE_THREAD == FALSE
120 #if CH_CFG_USE_REGISTRY == TRUE
130 #if CH_DBG_ENABLE_STACK_CHECK == TRUE
134 extern stkalign_t __main_thread_stack_base__;
135 currp->wabase = &__main_thread_stack_base__;
137 #elif CH_CFG_USE_DYNAMIC == TRUE
138 currp->wabase = NULL;
148 #if CH_DBG_STATISTICS == TRUE
159 #if CH_CFG_NO_IDLE_THREAD == FALSE
238 if ((testmask & CH_INTEGRITY_RLIST) != 0U) {
244 while (pqp != &
ch.
rlist.pqueue) {
251 while (pqp != &
ch.
rlist.pqueue) {
263 if ((testmask & CH_INTEGRITY_VTLIST) != 0U) {
287 #if CH_CFG_USE_REGISTRY == TRUE
288 if ((testmask & CH_INTEGRITY_REGISTRY) != 0U) {
313 #if defined(PORT_INTEGRITY_CHECK)
314 if ((testmask & CH_INTEGRITY_PORT) != 0U) {
315 PORT_INTEGRITY_CHECK();
337 #if CH_CFG_TIME_QUANTUM > 0
339 if (
currp->ticks > (tslices_t)0) {
344 #if CH_DBG_THREADS_PROFILING == TRUE
366 syssts_t sts = port_get_irq_status();
367 if (port_irq_enabled(sts)) {
368 if (port_is_isr_context()) {
389 if (port_irq_enabled(sts)) {
390 if (port_is_isr_context()) {
400 #if (PORT_SUPPORTS_RT == TRUE) || defined(__DOXYGEN__)
421 return (
bool)(((rtcnt_t)cnt - (rtcnt_t)start) <
422 ((rtcnt_t)end - (rtcnt_t)start));
438 rtcnt_t end = start + cycles;
#define IDLEPRIO
Idle priority.
void _scheduler_init(void)
Scheduler initialization.
void chVTDoTickI(void)
Virtual timers ticker.
void chSysRestoreStatusX(syssts_t sts)
Restores the specified execution status and leaves a critical zone.
void chSysHalt(const char *reason)
Halts the system.
bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end)
Realtime window test.
static void chSysLock(void)
Enters the kernel lock state.
#define currp
Current thread pointer access macro.
thread_t * newer
Newer registry element.
#define CH_CFG_SYSTEM_HALT_HOOK(reason)
System halt hook.
void chSysTimerHandlerI(void)
Handles time ticks for round robin preemption and timer increments.
virtual_timers_list_t vtlist
Virtual timers delta list header.
bool chSysIntegrityCheckI(unsigned testmask)
System integrity check.
void _trace_init(void)
Trace circular buffer subsystem initialization.
static void chSysEnable(void)
Lowers the system interrupt priority mask to user level.
#define CH_CFG_SYSTEM_TICK_HOOK()
System tick event hook.
#define CH_CFG_SYSTEM_INIT_HOOK()
System initialization hook.
#define chSysGetRealtimeCounterX()
Returns the current value of the system real time counter.
Structure representing a thread.
void chSysPolledDelayX(rtcnt_t cycles)
Polled delay.
#define CH_STATE_CURRENT
Currently running.
cnt_t isr_cnt
ISR nesting level.
void _vt_init(void)
Virtual Timers initialization.
#define THD_WORKING_AREA_BASE(s)
Base of a working area casted to the correct type.
#define CH_CFG_IDLE_LOOP_HOOK()
Idle Loop hook.
delta_list_t * prev
Previous timer in the list.
void _tm_init(void)
Initializes the time measurement unit.
#define THD_WORKING_AREA_END(s)
End of a working area casted to the correct type.
thread_t mainthread
Main thread descriptor.
Type of a thread descriptor.
static void chSysLockFromISR(void)
Enters the kernel lock state from within an interrupt handler.
delta_list_t dlist
Delta list header.
syssts_t chSysGetStatusAndLockX(void)
Returns the execution status and enters a critical zone.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
thread_t * older
Older registry element.
void _trace_halt(const char *reason)
Inserts in the circular debug trace buffer an halt record.
void chDbgCheckClassI(void)
I-class functions context check.
thread_t * _thread_init(thread_t *tp, const char *name, tprio_t prio)
Initializes a thread structure.
const char *volatile panic_msg
Pointer to the panic message.
static void _oslib_init(void)
Initialization of all library modules.
cnt_t lock_cnt
Lock nesting level.
ch_system_t ch
System data structures.
static void _idle_thread(void *p)
This function implements the idle thread infinite loop.
ch_priority_queue_t * next
Next in the list/queue.
thread_t * chThdCreate(const thread_descriptor_t *tdp)
Creates a new thread into a static memory area.
void chSysInit(void)
ChibiOS/RT initialization.
THD_WORKING_AREA(ch_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE)
Idle thread working area.
ChibiOS/RT main include file.
static void chSysUnlock(void)
Leaves the kernel lock state.
ch_priority_queue_t * prev
Previous in the queue.
ready_list_t rlist
Ready list header.
delta_list_t * next
Next timer in the list.
void _stats_init(void)
Initializes the statistics module.
Structure representing a generic priority-ordered bidirectional linked list header and element.
Virtual Timer delta list element and header structure.
static void chSysUnlockFromISR(void)
Leaves the kernel lock state from within an interrupt handler.
system_debug_t dbg
System debug.
NOINLINE void chTMStartMeasurementX(time_measurement_t *tmp)
Starts a measurement.
#define NORMALPRIO
Normal priority.