|
ChibiOS 21.11.4
|
This module provides the default portable scheduler code.

Wakeup status codes | |
| #define | MSG_OK (msg_t)0 |
| Normal wakeup message. | |
| #define | MSG_TIMEOUT (msg_t)-1 |
| Wakeup caused by a timeout condition. | |
| #define | MSG_RESET (msg_t)-2 |
| Wakeup caused by a reset condition. | |
Priority constants | |
| #define | NOPRIO (tprio_t)0 |
| Ready list header priority. | |
| #define | IDLEPRIO (tprio_t)1 |
| Idle priority. | |
| #define | LOWPRIO (tprio_t)2 |
| Lowest priority. | |
| #define | NORMALPRIO (tprio_t)128 |
| Normal priority. | |
| #define | HIGHPRIO (tprio_t)255 |
| Highest priority. | |
Thread states | |
| #define | CH_STATE_READY (tstate_t)0 |
| Waiting on the ready list. | |
| #define | CH_STATE_CURRENT (tstate_t)1 |
| Currently running. | |
| #define | CH_STATE_WTSTART (tstate_t)2 |
| Just created. | |
| #define | CH_STATE_SUSPENDED (tstate_t)3 |
| Suspended state. | |
| #define | CH_STATE_QUEUED (tstate_t)4 |
| On a queue. | |
| #define | CH_STATE_WTSEM (tstate_t)5 |
| On a semaphore. | |
| #define | CH_STATE_WTMTX (tstate_t)6 |
| On a mutex. | |
| #define | CH_STATE_WTCOND (tstate_t)7 |
| On a cond.variable. | |
| #define | CH_STATE_SLEEPING (tstate_t)8 |
| Sleeping. | |
| #define | CH_STATE_WTEXIT (tstate_t)9 |
| Waiting a thread. | |
| #define | CH_STATE_WTOREVT (tstate_t)10 |
| One event. | |
| #define | CH_STATE_WTANDEVT (tstate_t)11 |
| Several events. | |
| #define | CH_STATE_SNDMSGQ (tstate_t)12 |
| Sending a message, in queue. | |
| #define | CH_STATE_SNDMSG (tstate_t)13 |
| Sent a message, waiting answer. | |
| #define | CH_STATE_WTMSG (tstate_t)14 |
| Waiting for a message. | |
| #define | CH_STATE_FINAL (tstate_t)15 |
| Thread terminated. | |
| #define | CH_STATE_NAMES |
| Thread states as array of strings. | |
Thread flags and attributes | |
| #define | CH_FLAG_MODE_MASK (tmode_t)3U |
| Thread memory mode mask. | |
| #define | CH_FLAG_MODE_STATIC (tmode_t)0U |
| Static thread. | |
| #define | CH_FLAG_MODE_HEAP (tmode_t)1U |
| Thread allocated from a Memory Heap. | |
| #define | CH_FLAG_MODE_MPOOL (tmode_t)2U |
| Thread allocated from a Memory Pool. | |
| #define | CH_FLAG_TERMINATE (tmode_t)4U |
| Termination requested flag. | |
Macros | |
| #define | firstprio(rlp) |
| Returns the priority of the first thread on the given ready list. | |
| #define | __sch_get_currthread() |
| Current thread pointer get macro. | |
Functions | |
| static thread_t * | __sch_ready_behind (thread_t *tp) |
| Inserts a thread in the Ready List placing it behind its peers. | |
| static thread_t * | __sch_ready_ahead (thread_t *tp) |
| Inserts a thread in the Ready List placing it ahead its peers. | |
| static void | __sch_reschedule_behind (void) |
| Switches to the first thread on the runnable queue. | |
| static void | __sch_reschedule_ahead (void) |
| Switches to the first thread on the runnable queue. | |
| static void | __sch_wakeup (virtual_timer_t *vtp, void *p) |
| void | ch_sch_prio_insert (ch_queue_t *qp, ch_queue_t *tp) |
| Inserts a thread into a priority ordered queue. | |
| thread_t * | chSchReadyI (thread_t *tp) |
| Inserts a thread in the Ready List placing it behind its peers. | |
| void | chSchGoSleepS (tstate_t newstate) |
| Puts the current thread to sleep into the specified state. | |
| msg_t | chSchGoSleepTimeoutS (tstate_t newstate, sysinterval_t timeout) |
| Puts the current thread to sleep into the specified state with timeout specification. | |
| void | chSchWakeupS (thread_t *ntp, msg_t msg) |
| Wakes up a thread. | |
| void | chSchRescheduleS (void) |
| Performs a reschedule if a higher priority thread is runnable. | |
| bool | chSchIsPreemptionRequired (void) |
| Evaluates if preemption is required. | |
| void | chSchDoPreemption (void) |
| Switches to the first thread on the runnable queue. | |
| void | chSchPreemption (void) |
| All-in-one preemption code. | |
| void | chSchDoYieldS (void) |
| Yields the time slot. | |
| thread_t * | chSchSelectFirst (void) |
| Makes runnable the fist thread in the ready list, does not reschedule internally. | |
| void | chSchObjectInit (os_instance_t *oip, const os_instance_config_t *oicp) |
| #define MSG_OK (msg_t)0 |
Normal wakeup message.
Definition at line 39 of file chschd.h.
Referenced by __bsio_push_data(), __get(), __gett(), __put(), __putt(), _ctl(), _put(), _unget(), acc_read_cooked(), acc_read_cooked(), acc_read_raw(), acc_read_raw(), acc_read_raw(), acc_read_raw(), acc_read_raw(), acc_read_raw(), acc_read_raw(), acc_read_raw(), acc_reset_bias(), acc_reset_bias(), acc_reset_bias(), acc_reset_bias(), acc_reset_bias(), acc_reset_bias(), acc_reset_bias(), acc_reset_bias(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_set_bias(), acc_set_bias(), acc_set_bias(), acc_set_bias(), acc_set_bias(), acc_set_bias(), acc_set_bias(), acc_set_bias(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_sensivity(), acc_set_sensivity(), acc_set_sensivity(), acc_set_sensivity(), acc_set_sensivity(), acc_set_sensivity(), acc_set_sensivity(), acc_set_sensivity(), acquire_up(), acquire_ut(), adxl317I2CWriteRegister(), adxl317Start(), baro_read_raw(), baro_read_raw(), baro_reset_bias(), baro_reset_bias(), baro_reset_bias(), baro_reset_sensitivity(), baro_reset_sensitivity(), baro_reset_sensivity(), baro_set_bias(), baro_set_bias(), baro_set_bias(), baro_set_sensitivity(), baro_set_sensitivity(), baro_set_sensivity(), bmp085ReadCoefficient(), bsIncomingDataI(), bsRequestDataI(), canReceiveTimeout(), canTransmitTimeout(), chCondSignal(), chCondSignalI(), chDelegateDispatchTimeout(), chEvtSignalI(), chEvtWaitAllTimeout(), chEvtWaitAllTimeout(), chEvtWaitAnyTimeout(), chEvtWaitAnyTimeout(), chEvtWaitOneTimeout(), chFifoSendObject(), chFifoSendObjectAhead(), chFifoSendObjectAheadI(), chFifoSendObjectAheadS(), chFifoSendObjectI(), chFifoSendObjectS(), chGuardedPoolAllocTimeoutS(), chJobDispatch(), chJobDispatchTimeout(), chJobPost(), chJobPostAhead(), chJobPostAheadI(), chJobPostAheadS(), chJobPostI(), chJobPostS(), chMBFetchI(), chMBFetchTimeoutS(), chMBPostAheadI(), chMBPostAheadTimeoutS(), chMBPostI(), chMBPostTimeoutS(), chMsgWaitTimeoutS(), chPipeReadTimeout(), chPipeWriteTimeout(), chSemAddCounterI(), chSemSignal(), chSemSignalI(), chSemSignalWait(), chSemWaitS(), chSemWaitTimeoutS(), chThdCreate(), chThdCreateFromHeap(), chThdCreateFromMemoryPool(), chThdCreateI(), chThdCreateStatic(), chThdStart(), comp_read_raw(), comp_read_raw(), comp_read_raw(), comp_reset_bias(), comp_reset_bias(), comp_reset_bias(), comp_reset_sensivity(), comp_reset_sensivity(), comp_reset_sensivity(), comp_set_bias(), comp_set_bias(), comp_set_bias(), comp_set_full_scale(), comp_set_full_scale(), comp_set_sensivity(), comp_set_sensivity(), comp_set_sensivity(), dacSynchronizeS(), gyro_read_raw(), gyro_read_raw(), gyro_read_raw(), gyro_reset_bias(), gyro_reset_bias(), gyro_reset_bias(), gyro_reset_sensivity(), gyro_reset_sensivity(), gyro_reset_sensivity(), gyro_sample_bias(), gyro_sample_bias(), gyro_sample_bias(), gyro_set_bias(), gyro_set_bias(), gyro_set_bias(), gyro_set_full_scale(), gyro_set_full_scale(), gyro_set_full_scale(), gyro_set_sensivity(), gyro_set_sensivity(), gyro_set_sensivity(), hygro_read_raw(), hygro_reset_bias(), hygro_reset_sensitivity(), hygro_set_bias(), hygro_set_sensitivity(), i2c_lld_master_receive_timeout(), i2c_lld_master_transmit_timeout(), ibqGetFullBufferTimeoutS(), ibqGetTimeout(), ibqPostFullBufferI(), ibqReadTimeout(), iqGetTimeout(), iqPutI(), iqReadTimeout(), mac_lld_get_receive_descriptor(), mac_lld_get_transmit_descriptor(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), obqGetEmptyBufferTimeoutS(), obqPutTimeout(), obqReleaseEmptyBufferI(), obqWriteTimeout(), oqGetI(), oqPutI(), oqPutTimeout(), oqWriteTimeout(), osalThreadEnqueueTimeoutS(), osalThreadSuspendS(), osalThreadSuspendTimeoutS(), put(), sdIncomingDataI(), sdRequestDataI(), sens_read_cooked(), sens_read_raw(), sio_lld_control(), sioSynchronizeRX(), sioSynchronizeRXIdle(), sioSynchronizeTX(), sioSynchronizeTXEnd(), spiAbortI(), spiExchange(), spiIgnore(), spiReceive(), spiSend(), spiSynchronizeS(), sync_read(), sync_write(), thermo_read_raw(), thermo_read_raw(), thermo_read_raw(), thermo_reset_bias(), thermo_reset_bias(), thermo_reset_bias(), thermo_reset_bias(), thermo_reset_sensitivity(), thermo_reset_sensitivity(), thermo_reset_sensitivity(), thermo_reset_sensivity(), thermo_set_bias(), thermo_set_bias(), thermo_set_bias(), thermo_set_bias(), thermo_set_sensitivity(), thermo_set_sensitivity(), thermo_set_sensitivity(), thermo_set_sensivity(), uartReceiveTimeout(), uartSendFullTimeout(), uartSendTimeout(), unget(), wspiCommand(), wspiReceive(), and wspiSend().
| #define MSG_TIMEOUT (msg_t)-1 |
Wakeup caused by a timeout condition.
Definition at line 40 of file chschd.h.
Referenced by __sch_wakeup(), chCondWaitTimeoutS(), chDelegateDispatchTimeout(), chMBFetchI(), chMBPostAheadI(), chMBPostI(), chMsgWaitTimeoutS(), chSemWaitTimeoutS(), chSysTimerHandlerI(), chThdEnqueueTimeoutS(), chThdSuspendTimeoutS(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cSlaveReceiveTimeout(), i2cSlaveTransmitTimeout(), iqGetI(), iqPutI(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), oqGetI(), and oqPutI().
| #define MSG_RESET (msg_t)-2 |
Wakeup caused by a reset condition.
Definition at line 42 of file chschd.h.
Referenced by _get(), _put(), _unget(), _usb_reset(), _usb_suspend(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_reset_sensivity(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), acc_set_full_scale(), canStop(), chCondBroadcastI(), chMBFetchI(), chMBFetchTimeoutS(), chMBPostAheadI(), chMBPostAheadTimeoutS(), chMBPostI(), chMBPostTimeoutS(), chMBResetI(), chPipeReset(), chSemReset(), chSemResetI(), comp_reset_sensivity(), comp_reset_sensivity(), comp_set_full_scale(), comp_set_full_scale(), gyro_reset_sensivity(), gyro_reset_sensivity(), gyro_reset_sensivity(), gyro_set_full_scale(), gyro_set_full_scale(), gyro_set_full_scale(), ibqGetFullBufferTimeoutS(), ibqResetI(), iqResetI(), obqGetEmptyBufferTimeoutS(), obqResetI(), oqResetI(), sioStop(), spiStopTransferI(), usbDisableEndpointsI(), usbReceive(), usbStop(), and usbTransmit().
| #define IDLEPRIO (tprio_t)1 |
Idle priority.
Definition at line 52 of file chschd.h.
Referenced by __sch_reschedule_ahead(), __sch_reschedule_behind(), chInstanceObjectInit(), chSchDoPreemption(), chSchGoSleepS(), chSchSelectFirst(), chSchWakeupS(), and chSysGetIdleThreadX().
| #define NORMALPRIO (tprio_t)128 |
| #define HIGHPRIO (tprio_t)255 |
Highest priority.
Definition at line 55 of file chschd.h.
Referenced by chThdCreateStatic(), chThdCreateSuspendedI(), and chThdSetPriority().
| #define CH_STATE_READY (tstate_t)0 |
Waiting on the ready list.
Definition at line 62 of file chschd.h.
Referenced by __sch_ready_ahead(), __sch_ready_behind(), __sch_wakeup(), and chMtxLockS().
| #define CH_STATE_CURRENT (tstate_t)1 |
Currently running.
Definition at line 64 of file chschd.h.
Referenced by __sch_reschedule_ahead(), __sch_reschedule_behind(), chInstanceObjectInit(), chMtxLockS(), chSchDoPreemption(), chSchGoSleepS(), chSchSelectFirst(), and chSchWakeupS().
| #define CH_STATE_WTSTART (tstate_t)2 |
Just created.
Definition at line 65 of file chschd.h.
Referenced by __thd_object_init(), chThdStart(), and chThdStartI().
| #define CH_STATE_SUSPENDED (tstate_t)3 |
Suspended state.
Definition at line 66 of file chschd.h.
Referenced by __sch_wakeup(), chThdResumeI(), chThdResumeS(), chThdSuspendS(), and chThdSuspendTimeoutS().
| #define CH_STATE_QUEUED (tstate_t)4 |
On a queue.
Definition at line 67 of file chschd.h.
Referenced by __sch_wakeup(), chThdDoDequeueNextI(), and chThdEnqueueTimeoutS().
| #define CH_STATE_WTSEM (tstate_t)5 |
On a semaphore.
Definition at line 68 of file chschd.h.
Referenced by __sch_wakeup(), chMtxLockS(), chSemSignalWait(), chSemWaitS(), and chSemWaitTimeoutS().
| #define CH_STATE_WTMTX (tstate_t)6 |
| #define CH_STATE_WTCOND (tstate_t)7 |
On a cond.variable.
Definition at line 70 of file chschd.h.
Referenced by __sch_wakeup(), chCondWaitS(), chCondWaitTimeoutS(), and chMtxLockS().
| #define CH_STATE_SLEEPING (tstate_t)8 |
| #define CH_STATE_WTEXIT (tstate_t)9 |
| #define CH_STATE_WTOREVT (tstate_t)10 |
One event.
Definition at line 73 of file chschd.h.
Referenced by chEvtSignalI(), chEvtWaitAny(), chEvtWaitAnyTimeout(), chEvtWaitOne(), and chEvtWaitOneTimeout().
| #define CH_STATE_WTANDEVT (tstate_t)11 |
Several events.
Definition at line 74 of file chschd.h.
Referenced by chEvtSignalI(), chEvtWaitAll(), and chEvtWaitAllTimeout().
| #define CH_STATE_SNDMSGQ (tstate_t)12 |
Sending a message, in queue.
Definition at line 75 of file chschd.h.
Referenced by __sch_wakeup(), chMsgSend(), and chMtxLockS().
| #define CH_STATE_SNDMSG (tstate_t)13 |
Sent a message, waiting answer.
Definition at line 77 of file chschd.h.
Referenced by chMsgGet(), chMsgPollS(), chMsgRelease(), chMsgWaitS(), and chMsgWaitTimeoutS().
| #define CH_STATE_WTMSG (tstate_t)14 |
Waiting for a message.
Definition at line 79 of file chschd.h.
Referenced by chMsgSend(), chMsgWaitS(), and chMsgWaitTimeoutS().
| #define CH_STATE_FINAL (tstate_t)15 |
Thread terminated.
Definition at line 81 of file chschd.h.
Referenced by __sch_ready_ahead(), __sch_ready_behind(), chThdExitS(), chThdRelease(), chThdTerminatedX(), and chThdWait().
| #define CH_STATE_NAMES |
Thread states as array of strings.
Each element in an array initialized with this macro can be indexed using the numeric thread state values.
| #define CH_FLAG_MODE_MASK (tmode_t)3U |
Thread memory mode mask.
Definition at line 98 of file chschd.h.
Referenced by chThdExitS(), and chThdRelease().
| #define CH_FLAG_MODE_STATIC (tmode_t)0U |
Static thread.
Definition at line 100 of file chschd.h.
Referenced by __thd_object_init(), and chThdExitS().
| #define CH_FLAG_MODE_HEAP (tmode_t)1U |
Thread allocated from a Memory Heap.
Definition at line 101 of file chschd.h.
Referenced by chThdCreateFromHeap(), and chThdRelease().
| #define CH_FLAG_MODE_MPOOL (tmode_t)2U |
Thread allocated from a Memory Pool.
Definition at line 103 of file chschd.h.
Referenced by chThdCreateFromMemoryPool(), and chThdRelease().
| #define CH_FLAG_TERMINATE (tmode_t)4U |
Termination requested flag.
Definition at line 105 of file chschd.h.
Referenced by chThdShouldTerminateX(), and chThdTerminate().
| #define firstprio | ( | rlp | ) |
Returns the priority of the first thread on the given ready list.
Definition at line 130 of file chschd.h.
Referenced by chSchDoYieldS(), chSchIsPreemptionRequired(), chSchPreemption(), and chSchRescheduleS().
| #define __sch_get_currthread | ( | ) |
Current thread pointer get macro.
chThdGetSelfX() instead. Definition at line 137 of file chschd.h.
Referenced by chEvtAddEventsI(), chEvtGetEventsX(), chRegSetThreadName(), and chThdGetSelfX().
Inserts a thread in the Ready List placing it behind its peers.
The thread is positioned behind all threads with higher or equal priority.
next and prev or list corruption would occur. | [in] | tp | the thread to be made ready |
Definition at line 67 of file chschd.c.
References __trace_ready, ch_pqueue_insert_behind(), CH_STATE_FINAL, CH_STATE_READY, chDbgAssert, ch_thread::hdr, ch_thread::owner, ch_ready_list::pqueue, ch_thread::pqueue, ch_thread::rdymsg, ch_os_instance::rlist, ch_thread::state, threadref, and ch_thread::u.
Referenced by __sch_reschedule_behind(), __sch_wakeup(), chSchDoPreemption(), chSchReadyI(), and chSchWakeupS().

Inserts a thread in the Ready List placing it ahead its peers.
The thread is positioned ahead all threads with higher or equal priority.
next and prev or list corruption would occur. | [in] | tp | the thread to be made ready |
Definition at line 100 of file chschd.c.
References __trace_ready, ch_pqueue_insert_ahead(), CH_STATE_FINAL, CH_STATE_READY, chDbgAssert, ch_thread::hdr, ch_thread::owner, ch_ready_list::pqueue, ch_thread::pqueue, ch_thread::rdymsg, ch_os_instance::rlist, ch_thread::state, threadref, and ch_thread::u.
Referenced by __sch_reschedule_ahead(), chSchDoPreemption(), chSchSelectFirst(), and chSchWakeupS().

|
static |
Switches to the first thread on the runnable queue.
The current thread is positioned in the ready list behind all threads having the same priority. The thread regains its time quantum.
Definition at line 127 of file chschd.c.
References __instance_get_currthread, __instance_set_currthread, __sch_ready_behind(), CH_CFG_IDLE_LEAVE_HOOK, CH_CFG_TIME_QUANTUM, ch_pqueue_remove_highest(), CH_STATE_CURRENT, chSysSwitch, currcore, ch_thread::hdr, IDLEPRIO, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_os_instance::rlist, ch_thread::state, threadref, and ch_thread::ticks.
Referenced by chSchDoYieldS(), and chSchPreemption().

|
static |
Switches to the first thread on the runnable queue.
The current thread is positioned in the ready list ahead of all threads having the same priority.
Definition at line 163 of file chschd.c.
References __instance_get_currthread, __instance_set_currthread, __sch_ready_ahead(), CH_CFG_IDLE_LEAVE_HOOK, ch_pqueue_remove_highest(), CH_STATE_CURRENT, chSysSwitch, currcore, ch_thread::hdr, IDLEPRIO, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_os_instance::rlist, ch_thread::state, and threadref.
Referenced by chSchPreemption(), and chSchRescheduleS().

|
static |
Definition at line 188 of file chschd.c.
References __sch_ready_behind(), ch_queue_dequeue(), CH_STATE_QUEUED, CH_STATE_READY, CH_STATE_SNDMSGQ, CH_STATE_SUSPENDED, CH_STATE_WTCOND, CH_STATE_WTSEM, chSemFastSignalI, chSysLockFromISR, chSysUnlockFromISR, ch_thread::hdr, MSG_TIMEOUT, ch_thread::queue, ch_thread::rdymsg, ch_thread::state, threadref, ch_thread::u, ch_thread::wtsemp, and ch_thread::wttrp.
Referenced by chSchGoSleepTimeoutS().

|
inline |
Inserts a thread into a priority ordered queue.
| [in] | qp | the pointer to the threads list header |
| [in] | tp | the pointer to the thread to be inserted in the list |
Definition at line 250 of file chschd.c.
References ch_queue::next, ch_queue::prev, and threadref.
Referenced by chCondWaitS(), chCondWaitTimeoutS(), and chMtxLockS().
Inserts a thread in the Ready List placing it behind its peers.
The thread is positioned behind all threads with higher or equal priority.
next and prev or list corruption would occur. | [in] | tp | the thread to be made ready |
Definition at line 280 of file chschd.c.
References __sch_ready_behind(), chDbgCheck, chDbgCheckClassI, chSysNotifyInstance(), currcore, and ch_thread::owner.
Referenced by chCondBroadcastI(), chCondSignalI(), chEvtSignalI(), chMsgSend(), chMtxLockS(), chMtxUnlock(), chMtxUnlockAllS(), chMtxUnlockS(), chSemAddCounterI(), chSemResetWithMessageI(), chSemSignalI(), chSemSignalWait(), chThdCreateI(), chThdDoDequeueNextI(), chThdExitS(), chThdResumeI(), and chThdStartI().

| void chSchGoSleepS | ( | tstate_t | newstate | ) |
Puts the current thread to sleep into the specified state.
The thread goes into a sleeping state. The possible Thread States are defined into chschd.h.
| [in] | newstate | the new thread state |
Definition at line 305 of file chschd.c.
References __instance_get_currthread, __instance_set_currthread, CH_CFG_IDLE_ENTER_HOOK, CH_CFG_TIME_QUANTUM, ch_pqueue_remove_highest(), CH_STATE_CURRENT, chDbgAssert, chDbgCheckClassS, chSysGetIdleThreadX(), chSysSwitch, currcore, ch_thread::hdr, IDLEPRIO, ch_thread::owner, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_os_instance::rlist, ch_thread::state, threadref, and ch_thread::ticks.

| 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 timeout then it is forcibly awakened with a MSG_TIMEOUT low level message. The possible Thread States are defined into chschd.h.
| [in] | newstate | the new thread state |
| [in] | timeout | the number of ticks before the operation timeouts, the special values are handled as follow:
|
| MSG_TIMEOUT | if a timeout occurs. |
Definition at line 359 of file chschd.c.
References __instance_get_currthread, __sch_wakeup(), chDbgCheckClassS, chSchGoSleepS, chVTDoResetI(), chVTDoSetI(), chVTIsArmedI(), currcore, ch_thread::rdymsg, TIME_INFINITE, and ch_thread::u.
Referenced by chCondWaitTimeoutS(), chEvtWaitAllTimeout(), chEvtWaitAllTimeout(), chEvtWaitAnyTimeout(), chEvtWaitAnyTimeout(), chEvtWaitOneTimeout(), chMsgSend(), chMsgWaitTimeoutS(), chSemWaitTimeoutS(), chThdEnqueueTimeoutS(), chThdSleepS(), and chThdSuspendTimeoutS().

Wakes up a thread.
The thread is inserted into the ready list or immediately made running depending on its relative priority compared to the current thread.
next and prev or list corruption would occur. chSchReadyI() followed by a chSchRescheduleS() but much more efficient. | [in] | ntp | the thread to be made ready |
| [in] | msg | the wakeup message |
Definition at line 397 of file chschd.c.
References __instance_get_currthread, __instance_set_currthread, __sch_ready_ahead(), __sch_ready_behind(), CH_CFG_IDLE_LEAVE_HOOK, CH_STATE_CURRENT, chDbgAssert, chDbgCheckClassS, chSysNotifyInstance(), chSysSwitch, currcore, ch_ready_list::current, ch_thread::hdr, IDLEPRIO, ch_priority_queue::next, ch_thread::owner, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_thread::rdymsg, ch_os_instance::rlist, ch_thread::state, ch_thread::u, and unlikely.

| void chSchRescheduleS | ( | void | ) |
Performs a reschedule if a higher priority thread is runnable.
If a thread with a higher priority than the current thread is in the ready list then make the higher priority thread running.
Definition at line 458 of file chschd.c.
References __instance_get_currthread, __sch_reschedule_ahead(), chDbgCheckClassS, currcore, firstprio, ch_thread::hdr, likely, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, and ch_os_instance::rlist.
Referenced by chBSemSignal(), chCacheReleaseObject(), chCondBroadcast(), chEvtBroadcastFlags(), chEvtSignal(), chGuardedPoolFree(), chGuardedPoolFreeS(), chMBFetchTimeoutS(), chMBPostAheadTimeoutS(), chMBPostTimeoutS(), chMBReset(), chMtxUnlock(), chMtxUnlockAllS(), chPipeReset(), chSemResetWithMessage(), chSemSignal(), chSemSignalWait(), chSysRestoreStatusX(), and chThdSetPriority().

| 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 485 of file chschd.c.
References __instance_get_currthread, currcore, firstprio, ch_thread::hdr, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_os_instance::rlist, and ch_thread::ticks.
| void chSchDoPreemption | ( | void | ) |
Switches to the first thread on the runnable queue.
The current thread is positioned in the ready list behind or ahead of all threads having the same priority depending on if it used its whole time slice.
Definition at line 517 of file chschd.c.
References __instance_get_currthread, __instance_set_currthread, __sch_ready_ahead(), __sch_ready_behind(), CH_CFG_IDLE_LEAVE_HOOK, CH_CFG_TIME_QUANTUM, ch_pqueue_remove_highest(), CH_STATE_CURRENT, chSysSwitch, currcore, ch_thread::hdr, IDLEPRIO, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_os_instance::rlist, ch_thread::state, threadref, and ch_thread::ticks.

| void chSchPreemption | ( | void | ) |
All-in-one preemption code.
Definition at line 568 of file chschd.c.
References __instance_get_currthread, __sch_reschedule_ahead(), __sch_reschedule_behind(), currcore, firstprio, ch_thread::hdr, likely, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_os_instance::rlist, and ch_thread::ticks.

| void chSchDoYieldS | ( | void | ) |
Yields the time slot.
Yields the CPU control to the next thread in the ready list with equal or higher priority, if any.
Definition at line 602 of file chschd.c.
References __instance_get_currthread, __sch_reschedule_behind(), chDbgCheckClassS, currcore, firstprio, ch_thread::hdr, likely, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, and ch_os_instance::rlist.
Referenced by chThdYield().

| thread_t * chSchSelectFirst | ( | void | ) |
Makes runnable the fist thread in the ready list, does not reschedule internally.
The current thread is positioned in the ready list ahead of all threads having the same priority.
Definition at line 627 of file chschd.c.
References __instance_get_currthread, __instance_set_currthread, __sch_ready_ahead(), CH_CFG_IDLE_LEAVE_HOOK, ch_pqueue_remove_highest(), CH_STATE_CURRENT, currcore, ch_thread::hdr, IDLEPRIO, ch_ready_list::pqueue, ch_thread::pqueue, ch_priority_queue::prio, ch_os_instance::rlist, ch_thread::state, and threadref.

| void chSchObjectInit | ( | os_instance_t * | oip, |
| const os_instance_config_t * | oicp ) |