NetBurner 3.5.0
PDF Version
 
OS_FIFO Struct Reference

#include <nbrtos.h>

Inherits OS_TASK_DLY_OBJ.

Public Member Functions

 OS_FIFO ()
 Create and initialize a FIFO object.
 
uint8_t Init ()
 Sets the FIFO object to its initial state.
 
uint8_t Post (OS_FIFO_EL *pToPost)
 Post a message to the next available location in the FIFO.
 
uint8_t PostFirst (OS_FIFO_EL *pToPost)
 Post a message to the head of the FIFO.
 
OS_FIFO_ELPend (uint32_t timeoutTicks, uint8_t &result)
 Wait the specified number of time ticks for some other task to post to the FIFO.
 
OS_FIFO_ELPend (TickTimeout &t, uint8_t &result)
 Wait the specified number of TickTimeout ticks for some other task to post to the FIFO.
 
OS_FIFO_ELPend (uint32_t timeoutTicks=WAIT_FOREVER)
 Pend on a FIFO for the specified number of system TimeTicks.
 
OS_FIFO_ELPendUntil (uint32_t timeoutTime, uint8_t &result)
 Wait the specified TimeTicks value for some other task to post to the FIFO.
 
OS_FIFO_ELPendNoWait (uint8_t &result)
 Attempts to pend a structure to the FIFO, but does not wait.
 
OS_FIFO_ELPendNoWait ()
 Attempts to pend a structure to the FIFO, but does not wait.
 

Detailed Description

A FIFO is similar to a queue, but is specifically designed to pass pointers to OS_FIFO structures. The first parameter of the structure must be a (void *) element, which is used by the operating system to create a linked list of FIFOs. When initializing a FIFO, you do not specify the maximum number of entries as with a queue. Instead, your application has the ability (and responsibility) to allocate memory (static or dynamic) in which to store the structures. This can be done statically by declaring global variables, or dynamically by allocating memory from the heap. As with a queue, the first message posted to the FIFO will be the first message extracted from the queue.

Constructor & Destructor Documentation

◆ OS_FIFO()

OS_FIFO::OS_FIFO ( )
inline

Create and initialize a FIFO object.

See also
Init()

Member Function Documentation

◆ Init()

uint8_t OS_FIFO::Init ( )

Sets the FIFO object to its initial state.

Returns
OS_NO_ERR if successful, otherwise NBRTOS Error Codes
See also
NBRTOS Error Codes

◆ Pend() [1/3]

OS_FIFO_EL * OS_FIFO::Pend ( TickTimeout & t,
uint8_t & result )

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

Parameters
tThe number of system ticks to wait. A value of 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
OS_FIFO_ELPointer to OS_FIFO_EL if successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), PendUntil()

◆ Pend() [2/3]

OS_FIFO_EL * OS_FIFO::Pend ( uint32_t timeoutTicks,
uint8_t & result )
inline

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

Parameters
timeoutTicksThe number of system ticks to wait. A value of 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
OS_FIFO_ELPointer to OS_FIFO_EL if successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), Pend()

◆ Pend() [3/3]

OS_FIFO_EL * OS_FIFO::Pend ( uint32_t timeoutTicks = WAIT_FOREVER)
inline

Pend on a FIFO for the specified number of system TimeTicks.

Parameters
timeoutTicksThe number of system TimeTicks to wait. If not specified, will wait forever.
Return values
OS_FIFO_ELPointer to OS_FIFO_EL if successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), Pend(), PendUntil()

◆ PendNoWait() [1/2]

OS_FIFO_EL * OS_FIFO::PendNoWait ( )
inline

Attempts to pend a structure to the FIFO, but does not wait.

Return values
OS_FIFO_ELPointer to OS_FIFO_EL if successful
NULLIf it timed out
See also
NBRTOS Error Codes, Pend(), PendUntil()

◆ PendNoWait() [2/2]

OS_FIFO_EL * OS_FIFO::PendNoWait ( uint8_t & result)

Attempts to pend a structure to the FIFO, but does not wait.

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
OS_FIFO_ELPointer to OS_FIFO_EL if successful
NULLIf it timed out
See also
NBRTOS Error Codes, Pend(), PendUntil()

◆ PendUntil()

OS_FIFO_EL * OS_FIFO::PendUntil ( uint32_t timeoutTime,
uint8_t & result )
inline

Wait the specified TimeTicks value for some other task to post to the FIFO.

Parameters
timeoutTimeThe value of system TimeTicks to wait for
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
OS_FIFO_ELPointer to OS_FIFO_EL if successful
NULLIf it timed out
See also
NBRTOS Error Codes, PendNoWait(), Pend()

◆ Post()

uint8_t OS_FIFO::Post ( OS_FIFO_EL * pToPost)

Post a message to the next available location in the FIFO.

Parameters
pToPostA pointer to the structure cast as an OS_FIFO_EL to be posted to the FIFO.
Return values
OS_NO_ERRIf successful
OS_Q_FULLIf the queue is full, NBRTOS Error Codes
See also
PostFirst(), PostUnique(), Pend()

◆ PostFirst()

uint8_t OS_FIFO::PostFirst ( OS_FIFO_EL * pToPost)

Post a message to the head of the FIFO.

Parameters
pToPostA pointer to the user's structure cast as an OS_FIFO_EL to be posted to the FIFO.
Return values
OS_NO_ERRIf successful
OS_Q_FULLIf the queue is full, NBRTOS Error Codes
See also
Post(), PostUniqueFirst(), Pend()

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