60#if (CH_CFG_USE_SEMAPHORES == TRUE) || defined(__DOXYGEN__)
78#if CH_CFG_USE_SEMAPHORES_PRIORITY == TRUE
79#define sem_insert(qp, tp) ch_sch_prio_insert(qp, &tp->hdr.queue)
81#define sem_insert(qp, tp) ch_queue_insert(qp, &tp->hdr.queue)
149 "inconsistent semaphore");
197 "inconsistent semaphore");
265 "inconsistent semaphore");
297 "inconsistent semaphore");
321 "inconsistent semaphore");
351 "inconsistent semaphore");
353 while (n > (
cnt_t)0) {
382 "inconsistent semaphore");
385 "inconsistent semaphore");
#define chThdGetSelfX()
Returns a pointer to the current thread_t.
#define chSysUnlock()
Leaves the kernel lock state.
#define chSchWakeupS(ntp, msg)
Wakes up a thread.
#define chSysLock()
Enters the kernel lock state.
#define chSchGoSleepS(newstate)
Puts the current thread to sleep into the specified state.
#define chSemWait(sp)
Performs a wait operation on a semaphore.
#define chSemWaitS(sp)
Performs a wait operation on a semaphore.
#define chSemObjectInit(sp, n)
Initializes a semaphore with the specified counter value.
#define chDbgAssert(c, r)
Condition assertion.
#define chDbgCheck(c)
Function parameters check.
#define chDbgCheckClassS()
#define chDbgCheckClassI()
static void ch_queue_init(ch_queue_t *qp)
Queue initialization.
static bool ch_queue_notempty(const ch_queue_t *qp)
Evaluates to true if the specified queue is not empty.
static bool ch_queue_isempty(const ch_queue_t *qp)
Evaluates to true if the specified queue is empty.
static ch_queue_t * ch_queue_lifo_remove(ch_queue_t *qp)
Removes the last-out element from a queue and returns it.
static ch_queue_t * ch_queue_fifo_remove(ch_queue_t *qp)
Removes the first-out element from a queue and returns it.
#define threadref(p)
Safe cast of a queue pointer to a thread pointer.
#define unlikely(x)
Marks a boolean expression as likely false.
struct ch_thread thread_t
Type of a thread structure.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
#define MSG_OK
Normal wakeup message.
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
#define MSG_TIMEOUT
Wakeup caused by a timeout condition.
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification.
#define CH_STATE_WTSEM
On a semaphore.
msg_t chSemWaitTimeout(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification.
#define sem_insert(qp, tp)
void chSemAddCounterI(semaphore_t *sp, cnt_t n)
Adds the specified value to the semaphore counter.
msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw)
Performs atomic signal and wait operations on two semaphores.
void chSemSignal(semaphore_t *sp)
Performs a signal operation on a semaphore.
struct ch_semaphore semaphore_t
Semaphore structure.
void chSemResetWithMessageI(semaphore_t *sp, cnt_t n, msg_t msg)
Performs a reset operation on the semaphore.
void chSemResetWithMessage(semaphore_t *sp, cnt_t n, msg_t msg)
Performs a reset operation on the semaphore.
msg_t chSemWaitTimeoutS(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification.
void chSemSignalI(semaphore_t *sp)
Performs a signal operation on a semaphore.
#define TIME_IMMEDIATE
Zero interval specification for some functions with a timeout specification.
uint64_t sysinterval_t
Type of time interval.
ch_queue_t queue
Queue of the threads sleeping on this semaphore.
cnt_t cnt
The semaphore counter.
msg_t rdymsg
Thread wakeup code.
struct ch_semaphore * wtsemp
Pointer to a generic semaphore object.
union ch_thread::@250330312022121344252011223135034045240103044261 u
State-specific fields.