NetBurner 3.5.0
PDF Version
 
OS_MBOX Struct Reference

Mailboxes single value storage locations used to communicate between tasks. More...

#include <nbrtos.h>

Inherits OS_TASK_DLY_OBJ.

Public Member Functions

 OS_MBOX ()
 Create and initialize a mailbox object with no defalut message.
 
 OS_MBOX (void *msg)
 Create and initialize a mailbox object with the specified message.
 
uint8_t Init (void *msg=NULL)
 Sets the mailbox object to its initial state.
 
uint8_t Post (void *msg)
 Post a message to the mailbox.
 
void * Pend (uint32_t timeoutTicks, uint8_t &result)
 Wait the specified number of time ticks for some other task to post to the mailbox.
 
void * Pend (TickTimeout &t, uint8_t &result)
 Wait the specified number of TickTimeout ticks for some other task to post to the mailbox.
 
void * Pend (uint32_t timeoutTicks=WAIT_FOREVER)
 Wait the specified number of time ticks for some other task to post to the mailbox.
 
void * PendUntil (uint32_t timeoutTime, uint8_t &result)
 Wait the specified number of TimeTicks for some other task to post to the mailbox.
 
void * PendNoWait (uint8_t &result)
 Checks if a message is available in the mailbox and returns immediately.
 
void * PendNoWait ()
 Checks if a message is available in the mailbox and returns immediately.
 

Detailed Description

Mailboxes single value storage locations used to communicate between tasks.

A mailbox is a storage location large enough to hold a single void pointer value, access to which is controlled so that it may be safely utilized by multiple tasks. If a task writes to a mailbox, it is then full and no task can send/post to it until a task does a read/pend on the mailbox or the mailbox is reset.

The void pointer can represent anything, such as a pointer to a variable, object, string, or just used as a 32-bit value. How it is used is defined by the tasks that post and pend to it.

Note
A "Message" is defined as any value other than null.

Constructor & Destructor Documentation

◆ OS_MBOX() [1/2]

OS_MBOX::OS_MBOX ( )
inline

Create and initialize a mailbox object with no defalut message.

See also
Init()

◆ OS_MBOX() [2/2]

OS_MBOX::OS_MBOX ( void * msg)
inline

Create and initialize a mailbox object with the specified message.

Parameters
msgMessage that the mailbox should be initialized with
See also
Init()

Member Function Documentation

◆ Init()

uint8_t OS_MBOX::Init ( void * msg = NULL)

Sets the mailbox object to its initial state.

If called without a msg parameter, it will default to a value of null.

Parameters
msgMessage that the mailbox should be initialized with
Returns
OS_NO_ERR on success, otherwise NBRTOS Error Codes

◆ Pend() [1/3]

void * OS_MBOX::Pend ( TickTimeout & t,
uint8_t & result )

Wait the specified number of TickTimeout ticks for some other task to post to the mailbox.

Parameters
tThe number of TicksTimeout ticks to wait. 0 will wait forever.
resultReference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out.
Return values
MessageIf successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), PendUntil()

◆ Pend() [2/3]

void * OS_MBOX::Pend ( uint32_t timeoutTicks,
uint8_t & result )
inline

Wait the specified number of time ticks for some other task to post to the mailbox.

Parameters
timeoutTicksThe number of system ticks to wait. 0 will wait forever.
resultReference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out.
Return values
MessageIf successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), PendUntil()

◆ Pend() [3/3]

void * OS_MBOX::Pend ( uint32_t timeoutTicks = WAIT_FOREVER)
inline

Wait the specified number of time ticks for some other task to post to the mailbox.

Parameters
timeoutTicksThe number of system ticks to wait. If no value is specified, it will wait forever.
Return values
MessageIf successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), PendUntil()

◆ PendNoWait() [1/2]

void * OS_MBOX::PendNoWait ( )
inline

Checks if a message is available in the mailbox and returns immediately.

Return values
MessageIf successful
NULLIf it timed out
See also
Pend(), PendUntil()

◆ PendNoWait() [2/2]

void * OS_MBOX::PendNoWait ( uint8_t & result)

Checks if a message is available in the mailbox and returns immediately.

Parameters
resultReference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out.
Return values
MessageIf successful
NULLIf it timed out
See also
NBRTOS Error Codes, Pend(), PendUntil()

◆ PendUntil()

void * OS_MBOX::PendUntil ( uint32_t timeoutTime,
uint8_t & result )
inline

Wait the specified number of TimeTicks for some other task to post to the mailbox.

Parameters
timeoutTimeThe value of system time ticks to wait
resultReference to store the status of the function call, NBRTOS Error Codes. OS_NO_ERR if successful, OS_TIMEOUT if it timed out.
Return values
MessageIf successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), Pend()

◆ Post()

uint8_t OS_MBOX::Post ( void * msg)

Post a message to the mailbox.

Parameters
msgMessage that the mailbox should post
Return values
OS_NO_ERRIf successful
OS_MBOX_FULLIf the mailbox is full
See also
NBRTOS Error Codes

The documentation for this struct was generated from the following file: