31 #if (CH_CFG_USE_MAILBOXES == TRUE) || defined(__DOXYGEN__) 78 #define _MAILBOX_DATA(name, buffer, size) { \ 80 (msg_t *)(buffer) + size, \ 85 _THREADS_QUEUE_DATA(name.qw), \ 86 _THREADS_QUEUE_DATA(name.qr), \ 98 #define MAILBOX_DECL(name, buffer, size) \ 99 mailbox_t name = _MAILBOX_DATA(name, buffer, size) msg_t chMBPostI(mailbox_t *mbp, msg_t msg)
Posts a message into a mailbox.
size_t cnt
Messages in queue.
uint64_t sysinterval_t
Type of time interval.
static size_t chMBGetUsedCountI(const mailbox_t *mbp)
Returns the number of used message slots into a mailbox.
msg_t chMBPostAheadTimeoutS(mailbox_t *mbp, msg_t msg, sysinterval_t timeout)
Posts an high priority message into a mailbox.
Generic threads bidirectional linked list header and element.
void chMBObjectInit(mailbox_t *mbp, msg_t *buf, size_t n)
Initializes a mailbox_t object.
msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp)
Retrieves a message from a mailbox.
void chMBReset(mailbox_t *mbp)
Resets a mailbox_t object.
msg_t * top
Pointer to the location after the buffer.
msg_t chMBPostAheadTimeout(mailbox_t *mbp, msg_t msg, sysinterval_t timeout)
Posts an high priority message into a mailbox.
msg_t chMBPostTimeoutS(mailbox_t *mbp, msg_t msg, sysinterval_t timeout)
Posts a message into a mailbox.
msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg)
Posts an high priority message into a mailbox.
static size_t chMBGetFreeCountI(const mailbox_t *mbp)
Returns the number of free message slots into a mailbox.
msg_t chMBFetchTimeout(mailbox_t *mbp, msg_t *msgp, sysinterval_t timeout)
Retrieves a message from a mailbox.
msg_t * buffer
Pointer to the mailbox buffer.
static size_t chMBGetSizeI(const mailbox_t *mbp)
Returns the mailbox buffer size as number of messages.
void chMBResetI(mailbox_t *mbp)
Resets a mailbox_t object.
threads_queue_t qr
Queued readers.
msg_t * wrptr
Write pointer.
threads_queue_t qw
Queued writers.
static msg_t chMBPeekI(const mailbox_t *mbp)
Returns the next message in the queue without removing it.
void chDbgCheckClassI(void)
I-class functions context check.
bool reset
True in reset state.
static void chMBResumeX(mailbox_t *mbp)
Terminates the reset state.
msg_t chMBPostTimeout(mailbox_t *mbp, msg_t msg, sysinterval_t timeout)
Posts a message into a mailbox.
Structure representing a mailbox object.
msg_t * rdptr
Read pointer.
msg_t chMBFetchTimeoutS(mailbox_t *mbp, msg_t *msgp, sysinterval_t timeout)
Retrieves a message from a mailbox.