142#if CH_CFG_TIME_QUANTUM > 0
203#if CH_CFG_USE_SEMAPHORES == TRUE
210#if CH_CFG_USE_MESSAGES == TRUE
214#if (CH_CFG_USE_CONDVARS == TRUE) && (CH_CFG_USE_CONDVARS_TIMEOUT == TRUE)
239#if (CH_CFG_OPTIMIZE_SPEED == FALSE) || defined(__DOXYGEN__)
255 }
while ((cp != qp) &&
285#if CH_CFG_SMP_MODE == TRUE
316 otp->
state = newstate;
318#if CH_CFG_TIME_QUANTUM > 0
405 "priority order violation");
411#if CH_CFG_SMP_MODE == TRUE
412 if (ntp->
owner != oip) {
471#if !defined(CH_SCH_IS_PREEMPTION_REQUIRED_HOOKED)
492#if CH_CFG_TIME_QUANTUM > 0
506#if !defined(CH_SCH_DO_PREEMPTION_HOOKED)
532#if CH_CFG_TIME_QUANTUM > 0
560#if !defined(CH_SCH_PREEMPTION_HOOKED)
576#if CH_CFG_TIME_QUANTUM > 0
#define chSysLockFromISR()
Enters the kernel lock state from within an interrupt handler.
#define chSchWakeupS(ntp, msg)
Wakes up a thread.
#define chSchGoSleepS(newstate)
Puts the current thread to sleep into the specified state.
#define chSysUnlockFromISR()
Leaves the kernel lock state from within an interrupt handler.
#define chSemFastSignalI(sp)
Increases the semaphore counter.
#define chDbgAssert(c, r)
Condition assertion.
#define chDbgCheck(c)
Function parameters check.
#define chDbgCheckClassS()
#define chDbgCheckClassI()
#define CH_CFG_TIME_QUANTUM
Round robin interval.
#define CH_CFG_IDLE_LEAVE_HOOK()
Idle thread leave hook.
#define CH_CFG_IDLE_ENTER_HOOK()
Idle thread enter hook.
#define __instance_set_currthread(oip, tp)
Current thread pointer set macro.
#define __instance_get_currthread(oip)
Current thread pointer get macro.
static ch_priority_queue_t * ch_pqueue_insert_ahead(ch_priority_queue_t *pqp, ch_priority_queue_t *p)
Inserts an element in the priority queue placing it ahead of its peers.
static ch_priority_queue_t * ch_pqueue_remove_highest(ch_priority_queue_t *pqp)
Removes the highest priority element from a priority queue and returns it.
static ch_queue_t * ch_queue_dequeue(ch_queue_t *p)
Removes an element from a queue and returns it.
struct ch_queue ch_queue_t
Type of a generic bidirectional linked list header and element.
static ch_priority_queue_t * ch_pqueue_insert_behind(ch_priority_queue_t *pqp, ch_priority_queue_t *p)
Inserts an element in the priority queue placing it behind its peers.
#define threadref(p)
Safe cast of a queue pointer to a thread pointer.
#define likely(x)
Marks a boolean expression as likely true.
struct ch_virtual_timer virtual_timer_t
Type of a Virtual Timer.
struct ch_os_instance os_instance_t
Type of an OS instance structure.
#define unlikely(x)
Marks a boolean expression as likely false.
struct ch_thread thread_t
Type of a thread structure.
#define CH_STATE_READY
Waiting on the ready list.
#define CH_STATE_FINAL
Thread terminated.
thread_t * chSchSelectFirst(void)
Makes runnable the fist thread in the ready list, does not reschedule internally.
#define CH_STATE_CURRENT
Currently running.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
#define CH_STATE_WTCOND
On a cond.variable.
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
#define CH_STATE_QUEUED
On a queue.
static thread_t * __sch_ready_behind(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
void chSchDoYieldS(void)
Yields the time slot.
#define CH_STATE_SUSPENDED
Suspended state.
static void __sch_reschedule_behind(void)
Switches to the first thread on the runnable queue.
void chSchPreemption(void)
All-in-one preemption code.
bool chSchIsPreemptionRequired(void)
Evaluates if preemption is required.
#define firstprio(rlp)
Returns the priority of the first thread on the given ready list.
static void __sch_wakeup(virtual_timer_t *vtp, void *p)
#define MSG_TIMEOUT
Wakeup caused by a timeout condition.
void ch_sch_prio_insert(ch_queue_t *qp, ch_queue_t *tp)
Inserts a thread into a priority ordered queue.
static thread_t * __sch_ready_ahead(thread_t *tp)
Inserts a thread in the Ready List placing it ahead its peers.
#define IDLEPRIO
Idle priority.
#define CH_STATE_SNDMSGQ
Sending a message, in queue.
void chSchDoPreemption(void)
Switches to the first thread on the runnable queue.
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification.
static void __sch_reschedule_ahead(void)
Switches to the first thread on the runnable queue.
#define CH_STATE_WTSEM
On a semaphore.
#define chSysSwitch(ntp, otp)
Performs a context switch.
thread_t * chSysGetIdleThreadX(void)
Returns a pointer to the idle thread.
#define currcore
Access to current core's instance structure.
static void chSysNotifyInstance(os_instance_t *oip)
Notifies an OS instance to check for reschedule.
uint64_t sysinterval_t
Type of time interval.
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par)
Enables a one-shot virtual timer.
static bool chVTIsArmedI(const virtual_timer_t *vtp)
Returns true if the specified timer is armed.
void chVTDoResetI(virtual_timer_t *vtp)
Disables a Virtual Timer.
#define __trace_ready(tp, msg)
ready_list_t rlist
Ready list header.
ch_priority_queue_t * next
Next in the queue.
tprio_t prio
Priority of this element.
ch_queue_t * prev
Previous in the queue.
ch_queue_t * next
Next in the list/queue.
thread_t * current
The currently running thread.
ch_priority_queue_t pqueue
Threads ordered queues header.
ch_queue_t queue
Threads queues element.
union ch_thread::@065317322233202114332352372014266163076165303275 hdr
Shared list headers.
msg_t rdymsg
Thread wakeup code.
thread_reference_t * wttrp
Pointer to a generic thread reference object.
tslices_t ticks
Number of ticks remaining to this thread.
tstate_t state
Current thread state.
ch_priority_queue_t pqueue
Threads ordered queues element.
struct ch_semaphore * wtsemp
Pointer to a generic semaphore object.
union ch_thread::@250330312022121344252011223135034045240103044261 u
State-specific fields.
os_instance_t * owner
OS instance owner of this thread.