Rtos API example
Mailboxes
[OS abstraction layer]
Functions | |
err_t | sys_mbox_new (sys_mbox_t *mbox, int size) |
Create a new mbox of specified size. | |
void | sys_mbox_post (sys_mbox_t *mbox, void *msg) |
Post a message to an mbox - may not fail -> blocks if full, only used from tasks not from ISR. | |
err_t | sys_mbox_trypost (sys_mbox_t *mbox, void *msg) |
Try to post a message to an mbox - may fail if full or ISR. | |
u32_t | sys_arch_mbox_fetch (sys_mbox_t *mbox, void **msg, u32_t timeout) |
Wait for a new message to arrive in the mbox. | |
u32_t | sys_arch_mbox_tryfetch (sys_mbox_t *mbox, void **msg) |
Wait for a new message to arrive in the mbox. | |
void | sys_mbox_free (sys_mbox_t *mbox) |
Delete an mbox. | |
int | sys_mbox_valid (sys_mbox_t *mbox) |
Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid. | |
void | sys_mbox_set_invalid (sys_mbox_t *mbox) |
Set an mbox invalid so that sys_mbox_valid returns 0. |
Function Documentation
u32_t sys_arch_mbox_fetch | ( | sys_mbox_t * | mbox, |
void ** | msg, | ||
u32_t | timeout | ||
) |
Wait for a new message to arrive in the mbox.
- Parameters:
-
mbox mbox to get a message from msg pointer where the message is stored timeout maximum time (in milliseconds) to wait for a message (0 = wait forever)
- Returns:
- time (in milliseconds) waited for a message, may be 0 if not waited or SYS_ARCH_TIMEOUT on timeout The returned time has to be accurate to prevent timer jitter!
Definition at line 239 of file lwip_sys_arch.c.
u32_t sys_arch_mbox_tryfetch | ( | sys_mbox_t * | mbox, |
void ** | msg | ||
) |
Wait for a new message to arrive in the mbox.
- Parameters:
-
mbox mbox to get a message from msg pointer where the message is stored
- Returns:
- 0 (milliseconds) if a message has been received or SYS_MBOX_EMPTY if the mailbox is empty
Definition at line 274 of file lwip_sys_arch.c.
void sys_mbox_free | ( | sys_mbox_t * | mbox ) |
err_t sys_mbox_new | ( | sys_mbox_t * | mbox, |
int | size | ||
) |
Create a new mbox of specified size.
- Parameters:
-
mbox pointer to the mbox to create size (minimum) number of messages in this mbox
- Returns:
- ERR_OK if successful, another err_t otherwise
Definition at line 125 of file lwip_sys_arch.c.
void sys_mbox_post | ( | sys_mbox_t * | mbox, |
void * | msg | ||
) |
Post a message to an mbox - may not fail -> blocks if full, only used from tasks not from ISR.
- Parameters:
-
mbox mbox to posts the message msg message to post (ATTENTION: can be NULL)
Definition at line 166 of file lwip_sys_arch.c.
void sys_mbox_set_invalid | ( | sys_mbox_t * | mbox ) |
Set an mbox invalid so that sys_mbox_valid returns 0.
err_t sys_mbox_trypost | ( | sys_mbox_t * | mbox, |
void * | msg | ||
) |
Try to post a message to an mbox - may fail if full or ISR.
- Parameters:
-
mbox mbox to posts the message msg message to post (ATTENTION: can be NULL)
Definition at line 195 of file lwip_sys_arch.c.
int sys_mbox_valid | ( | sys_mbox_t * | mbox ) |
Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid.
Generated on Sun Jul 17 2022 08:25:37 by 1.7.2