UbixOS  2.0
Collaboration diagram for Mailboxes:

Functions

uint32_t sys_arch_mbox_fetch (struct sys_mbox **mb, void **msg, uint32_t timeout)
 
uint32_t sys_arch_mbox_tryfetch (struct sys_mbox **mb, void **msg)
 
void sys_mbox_free (struct sys_mbox **mb)
 
err_t sys_mbox_new (struct sys_mbox **mb, int size)
 
void sys_mbox_post (struct sys_mbox **mb, void *msg)
 
void sys_mbox_set_invalid (struct sys_mbox **mb)
 
err_t sys_mbox_trypost (struct sys_mbox **mb, void *msg)
 
int sys_mbox_valid (struct sys_mbox **mb)
 

Detailed Description

Function Documentation

◆ sys_arch_mbox_fetch()

uint32_t sys_arch_mbox_fetch ( struct sys_mbox **  mb,
void **  msg,
uint32_t  timeout 
)

Wait for a new message to arrive in the mbox

Parameters
mboxmbox to get a message from
msgpointer where the message is stored
timeoutmaximum 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 286 of file sys_arch.c.

◆ sys_arch_mbox_tryfetch()

uint32_t sys_arch_mbox_tryfetch ( struct sys_mbox **  mb,
void **  msg 
)

Wait for a new message to arrive in the mbox

Parameters
mboxmbox to get a message from
msgpointer 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 335 of file sys_arch.c.

◆ sys_mbox_free()

void sys_mbox_free ( struct sys_mbox **  mb)

Delete an mbox

Parameters
mboxmbox to delete

Definition at line 193 of file sys_arch.c.

References NULL, and SYS_MBOX_NULL.

◆ sys_mbox_new()

err_t sys_mbox_new ( struct sys_mbox **  mb,
int  size 
)

Create a new mbox of specified size

Parameters
mboxpointer 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 160 of file sys_arch.c.

◆ sys_mbox_post()

void sys_mbox_post ( struct sys_mbox **  mb,
void *  msg 
)

Post a message to an mbox - may not fail -> blocks if full, only used from tasks not from ISR

Parameters
mboxmbox to posts the message
msgmessage to post (ATTENTION: can be NULL)

Definition at line 214 of file sys_arch.c.

References head.

◆ sys_mbox_set_invalid()

void sys_mbox_set_invalid ( struct sys_mbox **  mb)

Set an mbox invalid so that sys_mbox_valid returns 0

Definition at line 374 of file sys_arch.c.

◆ sys_mbox_trypost()

err_t sys_mbox_trypost ( struct sys_mbox **  mb,
void *  msg 
)

Try to post a message to an mbox - may fail if full or ISR

Parameters
mboxmbox to posts the message
msgmessage to post (ATTENTION: can be NULL)

Definition at line 250 of file sys_arch.c.

References head.

◆ sys_mbox_valid()

int sys_mbox_valid ( struct sys_mbox **  mb)

Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid

Definition at line 366 of file sys_arch.c.