ChibiOS/RT 7.0.5
chschd.h File Reference

Scheduler macros and structures. More...

Go to the source code of this file.

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.
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.

Functions

void chSchObjectInit (os_instance_t *oip, const os_instance_config_t *oicp)
thread_tchSchReadyI (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_tchSchSelectFirst (void)
 Makes runnable the fist thread in the ready list, does not reschedule internally.
void ch_sch_prio_insert (ch_queue_t *qp, ch_queue_t *tp)
 Inserts a thread into a priority ordered queue.

Detailed Description

Scheduler macros and structures.

Definition in file chschd.h.