NetBurner 3.5.0
PDF Version
 
Loading...
Searching...
No Matches
OS_FLAGS Struct Reference

OSFlags enables a function or task to pend on multiple flags or events. More...

#include <nbrtos.h>

Public Member Functions

 OS_FLAGS ()
 Create and initialize an OS_FLAG object.
 
void Init ()
 Initialize an OS_FLAG object to its default value.
 
void Set (uint32_t bits_to_set)
 Sets the specified flag bits.
 
void Clear (uint32_t bits_to_clr)
 Clear the specified flag bits.
 
void Write (uint32_t bits_to_force)
 Set the flag bits to match the specified value.
 
uint32_t State ()
 Returns the current values of the flags stored in the OS_FLAGS object.
 
uint8_t PendAny (uint32_t bit_mask, uint16_t timeout=WAIT_FOREVER)
 Wait the specified number of system TimeTicks for any of the flags in the bit mask to be set.
 
uint8_t PendAny (uint32_t bit_mask, TickTimeout &timeout)
 Wait the specified number of TickTimeout time ticks for any of the flags in the bit mask to be set.
 
uint8_t PendAnyUntil (uint32_t bit_mask, uint32_t end_time)
 Wait until the specified system TimeTicks value for any of the flags in the bit mask to be set.
 
uint8_t PendAnyNoWait (uint32_t bit_mask)
 Check for the specified flags and return immediately.
 
uint8_t PendAll (uint32_t bit_mask, uint16_t timeout=WAIT_FOREVER)
 Wait the specified number of system time ticks until all the specified flags are set.
 
uint8_t PendAll (uint32_t bit_mask, TickTimeout &timeout)
 Wait the specified number of TickTimeout time ticks until all the specified flags are set.
 
uint8_t PendAllUntil (uint32_t bit_mask, uint32_t end_time)
 Wait until the specified system TimeTicks value for all of the flags in the bit mask to be set.
 
uint8_t PendAllNoWait (uint32_t bit_mask)
 Wait the specified number of system time ticks until all the specified flags are set.
 

Detailed Description

OSFlags enables a function or task to pend on multiple flags or events.

In contrast to a OSSemaphore which can pend on only a single event. The OSFlag implementation is essentially a 32-bit bitmap in which each bit position represents a flag. You create a OSFlag object with OSFlagCreate(), then set, clean and read the flags with the appropriate function. There are a number of functions used to monitor or pend on the flags, and provide the ability to pend on any one or more of the flags being set, or pending on all of flags being set at one time.

Constructor & Destructor Documentation

◆ OS_FLAGS()

OS_FLAGS::OS_FLAGS ( )

Create and initialize an OS_FLAG object.

See also
Init()

Member Function Documentation

◆ Clear()

void OS_FLAGS::Clear ( uint32_t  bits_to_clr)

Clear the specified flag bits.

Parameters
bits_to_clrA bit or set of bits to be cleared
See also
Set(), State()

◆ Init()

void OS_FLAGS::Init ( )

Initialize an OS_FLAG object to its default value.

See also
OS_FLAGS()

◆ PendAll() [1/2]

uint8_t OS_FLAGS::PendAll ( uint32_t  bit_mask,
TickTimeout timeout 
)

Wait the specified number of TickTimeout time ticks until all the specified flags are set.

Parameters
bit_maskA bit or set of bits to wait on.
timeoutNumber of time ticks to wait for all specified flag bits to be set. A value of 0 waits forever.
Return values
OS_NO_ERRIf the flags condition is satisfied
OS_TIMEOUTIf the timeout expired
See also
PendAllNoWait(), PendAny()

◆ PendAll() [2/2]

uint8_t OS_FLAGS::PendAll ( uint32_t  bit_mask,
uint16_t  timeout = WAIT_FOREVER 
)
inline

Wait the specified number of system time ticks until all the specified flags are set.

Parameters
bit_maskA bit or set of bits to wait on.
timeoutNumber of time ticks to wait for all specified flag bits to be set. A value of 0 waits forever.
Return values
OS_NO_ERRIf the flags condition is satisfied
OS_TIMEOUTIf the timeout expired
See also
PendAllNoWait(), PendAny()

◆ PendAllNoWait()

uint8_t OS_FLAGS::PendAllNoWait ( uint32_t  bit_mask)

Wait the specified number of system time ticks until all the specified flags are set.

Parameters
bit_maskA bit or set of bits to wait on.
Returns
OS_NO_ERR on success, otherwise NBRTOS Error Codes
See also
PendAll(), PendAnyNoWait()

◆ PendAllUntil()

uint8_t OS_FLAGS::PendAllUntil ( uint32_t  bit_mask,
uint32_t  end_time 
)
inline

Wait until the specified system TimeTicks value for all of the flags in the bit mask to be set.

Parameters
bit_maskA bit or set of bits to wait on.
end_timeSystem TimeTick value to wait for.
Return values
OS_NO_ERRAt least one of the flag bits are set before end_time.
OS_TIMEOUTNone of the flag bits are set before end_time.
See also
NBRTOS Error Codes, PendAnyNoWait(), PendAll()

◆ PendAny() [1/2]

uint8_t OS_FLAGS::PendAny ( uint32_t  bit_mask,
TickTimeout timeout 
)

Wait the specified number of TickTimeout time ticks for any of the flags in the bit mask to be set.

Parameters
bit_maskA bit or set of bits to wait on.
timeoutNumber of time ticks to wait for all specified flag bits to be set. If not specified or 0 will wait forever.
Return values
OS_NO_ERRAt least one of the flag bits are set before timeout expires. A value of 0 waits forever.
OS_TIMEOUTNone of the flag bits are set before timeout expires.
See also
NBRTOS Error Codes, PendAnyNoWait(), PendAll()

◆ PendAny() [2/2]

uint8_t OS_FLAGS::PendAny ( uint32_t  bit_mask,
uint16_t  timeout = WAIT_FOREVER 
)
inline

Wait the specified number of system TimeTicks for any of the flags in the bit mask to be set.

Parameters
bit_maskA bit or set of bits to wait on.
timeoutNumber of time ticks to wait for all specified flag bits to be set. If not specified or 0 will wait forever.
Return values
OS_NO_ERRAt least one of the flag bits are set before timeout expires. A value of 0 waits forever.
OS_TIMEOUTNone of the flag bits are set before timeout expires.
See also
NBRTOS Error Codes, PendAnyNoWait(), PendAll()

◆ PendAnyNoWait()

uint8_t OS_FLAGS::PendAnyNoWait ( uint32_t  bit_mask)

Check for the specified flags and return immediately.

Parameters
bit_maskA bit or set of bits to wait on.
Returns
OS_NO_ERR on success, otherwise NBRTOS Error Codes
See also
PendAny(), PendAll()

◆ PendAnyUntil()

uint8_t OS_FLAGS::PendAnyUntil ( uint32_t  bit_mask,
uint32_t  end_time 
)
inline

Wait until the specified system TimeTicks value for any of the flags in the bit mask to be set.

Parameters
bit_maskA bit or set of bits to wait on.
end_timeSystem TimeTick value to wait for.
Return values
OS_NO_ERRAt least one of the flag bits are set before end_time.
OS_TIMEOUTNone of the flag bits are set before end_time.
See also
NBRTOS Error Codes, PendAnyNoWait(), PendAll()

◆ Set()

void OS_FLAGS::Set ( uint32_t  bits_to_set)

Sets the specified flag bits.

Parameters
bits_to_setA bit or set of bits to be set
See also
Clear(), State()

◆ State()

uint32_t OS_FLAGS::State ( )

Returns the current values of the flags stored in the OS_FLAGS object.

Returns
The state of the OS_FLAGS object
See also
Set(), Clear(), Write()

◆ Write()

void OS_FLAGS::Write ( uint32_t  bits_to_force)

Set the flag bits to match the specified value.

Parameters
bits_to_forceValue to set all flags to
See also
Set(), Clear(), State()

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