52 #if (CH_CFG_USE_SEMAPHORES == TRUE) || defined(__DOXYGEN__) 91 #define _BSEMAPHORE_DATA(name, taken) \ 92 {_SEMAPHORE_DATA(name.sem, ((taken) ? 0 : 1))} 102 #define BSEMAPHORE_DECL(name, taken) \ 103 binary_semaphore_t name = _BSEMAPHORE_DATA(name, taken) 236 chSemResetI(&bsp->sem, taken ? (cnt_t)0 : (cnt_t)1);
255 chSemReset(&bsp->sem, taken ? (cnt_t)0 : (cnt_t)1);
270 if (bsp->sem.
cnt < (cnt_t)1) {
304 return (bsp->sem.
cnt > (cnt_t)0) ?
false :
true;
static bool chBSemGetStateI(const binary_semaphore_t *bsp)
Returns the binary semaphore current state.
static void chBSemObjectInit(binary_semaphore_t *bsp, bool taken)
Initializes a binary semaphore.
void chSchRescheduleS(void)
Reschedules if needed.
#define chSysLock()
Enters the kernel lock state.
volatile cnt_t cnt
Threads Queue counter.
static void chBSemSignal(binary_semaphore_t *bsp)
Performs a signal operation on a binary semaphore.
static void chBSemReset(binary_semaphore_t *bsp, bool taken)
Reset operation on the binary semaphore.
static void chBSemResetI(binary_semaphore_t *bsp, bool taken)
Reset operation on the binary semaphore.
void chSemSignalI(semaphore_t *sp)
Performs a signal operation on a semaphore.
#define chSemWait(sp)
Performs a wait operation on a semaphore.
void chDbgCheckClassS(void)
S-class functions context check.
struct ch_binary_semaphore binary_semaphore_t
Binary semaphore type.
void chSemReset(semaphore_t *sp, cnt_t n)
Performs a reset operation on the semaphore.
void chSemResetI(semaphore_t *sp, cnt_t n)
Performs a reset operation on the semaphore.
void chDbgCheckClassI(void)
I-class functions context check.
#define chSemObjectInit(sp, n)
Initializes a semaphore with the specified counter value.
#define chSysUnlock()
Leaves the kernel lock state.
static msg_t chBSemWaitS(binary_semaphore_t *bsp)
Wait operation on the binary semaphore.
static msg_t chBSemWaitTimeoutS(binary_semaphore_t *bsp, sysinterval_t timeout)
Wait operation on the binary semaphore.
uint32_t sysinterval_t
Type of time interval.
static void chBSemSignalI(binary_semaphore_t *bsp)
Performs a signal operation on a binary semaphore.
static msg_t chBSemWait(binary_semaphore_t *bsp)
Wait operation on the binary semaphore.
static msg_t chBSemWaitTimeout(binary_semaphore_t *bsp, sysinterval_t timeout)
Wait operation on the binary semaphore.
Structure representing a queue of threads.
msg_t chSemWaitTimeout(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification.
msg_t chSemWaitTimeoutS(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification.
#define chSemWaitS(sp)
Performs a wait operation on a semaphore.