Go to the documentation of this file.
59 static void wakeup(
void *p) {
72 #if CH_CFG_USE_SEMAPHORES == TRUE
79 #if (CH_CFG_USE_CONDVARS == TRUE) && (CH_CFG_USE_CONDVARS_TIMEOUT == TRUE)
98 #if (CH_CFG_OPTIMIZE_SPEED == FALSE) || defined(__DOXYGEN__)
114 }
while ((cp != qp) &&
131 #if CH_CFG_USE_REGISTRY == TRUE
216 otp->
state = newstate;
218 #if CH_CFG_TIME_QUANTUM > 0
275 return currp->u.rdymsg;
301 (
ch.
rlist.current->hdr.pqueue.prio >=
ch.
rlist.pqueue.next->prio),
302 "priority order violation");
348 #if !defined(CH_SCH_IS_PREEMPTION_REQUIRED_HOOKED)
364 tprio_t p2 =
currp->hdr.pqueue.prio;
366 #if CH_CFG_TIME_QUANTUM > 0
371 return (
currp->ticks > (tslices_t)0) ? (p1 > p2) : (p1 >= p2);
402 #if CH_CFG_TIME_QUANTUM > 0
442 #if !defined(CH_SCH_DO_RESCHEDULE_HOOKED)
465 #if CH_CFG_TIME_QUANTUM > 0
468 if (otp->
ticks == (tslices_t)0) {
#define CH_CFG_IDLE_LEAVE_HOOK()
Idle thread leave hook.
#define IDLEPRIO
Idle priority.
void _scheduler_init(void)
Scheduler initialization.
thread_reference_t * wttrp
Pointer to a generic thread reference object.
#define CH_STATE_READY
Waiting on the ready list.
ch_queue_t * next
Next in the list/queue.
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
ch_priority_queue_t pqueue
Threads ordered queues element.
#define currp
Current thread pointer access macro.
msg_t rdymsg
Thread wakeup code.
#define CH_CFG_TIME_QUANTUM
Round robin interval.
static bool chVTIsArmedI(const virtual_timer_t *vtp)
Returns true if the specified timer is armed.
#define chDbgAssert(c, r)
Condition assertion.
#define CH_CFG_IDLE_ENTER_HOOK()
Idle thread enter hook.
#define CH_STATE_SUSPENDED
Suspended state.
#define chSysSwitch(ntp, otp)
Performs a context switch.
void ch_sch_prio_insert(ch_queue_t *tp, ch_queue_t *qp)
Inserts a thread into a priority ordered queue.
void chSchDoRescheduleBehind(void)
Switches to the first thread on the runnable queue.
#define CH_STATE_WTCOND
On a cond.variable.
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification.
static bool chSchIsRescRequiredI(void)
Determines if the current thread must reschedule.
void chSchDoReschedule(void)
Switches to the first thread on the runnable queue.
#define chDbgCheck(c)
Function parameters check.
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.
Structure representing a thread.
void chSchGoSleepS(tstate_t newstate)
Puts the current thread to sleep into the specified state.
#define CH_STATE_CURRENT
Currently running.
static void chSemFastSignalI(semaphore_t *sp)
Increases the semaphore counter.
tslices_t ticks
Number of ticks remaining to this thread.
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.
#define CH_STATE_FINAL
Thread terminated.
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.
union ch_thread::@1 u
State-specific fields.
Structure representing a generic bidirectional linked list header and element.
static void chSysLockFromISR(void)
Enters the kernel lock state from within an interrupt handler.
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
#define firstprio(rlp)
Returns the priority of the first thread on the given ready list.
void chDbgCheckClassI(void)
I-class functions context check.
Structure representing a Virtual Timer.
thread_t * chSchReadyAheadI(thread_t *tp)
Inserts a thread in the Ready List placing it ahead its peers.
bool chSchIsPreemptionRequired(void)
Evaluates if preemption is required.
ch_system_t ch
System data structures.
uint64_t sysinterval_t
Type of time interval.
void chSchDoRescheduleAhead(void)
Switches to the first thread on the runnable queue.
static void ch_pqueue_init(ch_priority_queue_t *pqp)
Priority queue initialization.
void chVTDoResetI(virtual_timer_t *vtp)
Disables a Virtual Timer.
#define CH_STATE_QUEUED
On a queue.
ch_queue_t queue
Threads queues element.
tstate_t state
Current thread state.
struct ch_semaphore * wtsemp
Pointer to a generic semaphore object.
ChibiOS/RT main include file.
#define MSG_TIMEOUT
Wakeup caused by a timeout condition.
void chVTDoSetI(virtual_timer_t *vtp, sysinterval_t delay, vtfunc_t vtfunc, void *par)
Enables a one-shot virtual timer.
ready_list_t rlist
Ready list header.
static ch_queue_t * ch_queue_dequeue(ch_queue_t *p)
Removes an element from a queue and returns it.
void chDbgCheckClassS(void)
S-class functions context check.
static void chSysUnlockFromISR(void)
Leaves the kernel lock state from within an interrupt handler.
#define CH_STATE_WTSEM
On a semaphore.
void chSchWakeupS(thread_t *ntp, msg_t msg)
Wakes up a thread.