µOS++ IIIe Reference  v6.3.15
“Perfekt ist nicht gut genug”
The third edition of µOS++, a POSIX inspired open source system, written in C++.

C API event flags definitions. More...

Classes

struct  os_evflags_attr_s
 Event flags attributes. More...
 
struct  os_evflags_s
 Event flags object storage. More...
 

Types

typedef struct os_evflags_attr_s os_evflags_attr_t
 Event flags attributes. More...
 
typedef struct os_evflags_s os_evflags_t
 Event flags object storage. More...
 

Compatibility Macros

#define os_evflags_create   os_evflags_construct
 
#define os_evflags_destroy   os_evflags_destruct
 

Event Flags Attributes Functions

void os_evflags_attr_init (os_evflags_attr_t *attr)
 Initialise the event flags attributes. More...
 

Event Flags Creation Functions

void os_evflags_construct (os_evflags_t *evflags, const char *name, const os_evflags_attr_t *attr)
 Construct a statically allocated event flags object instance. More...
 
void os_evflags_destruct (os_evflags_t *evflags)
 Destruct the statically allocated event flags object instance. More...
 
os_evflags_tos_evflags_new (const char *name, const os_evflags_attr_t *attr)
 Allocate an event flags object instance and construct it. More...
 
void os_evflags_delete (os_evflags_t *evflags)
 Destruct the event flags object instance and deallocate it. More...
 

Event Flags Functions

const char * os_evflags_get_name (os_evflags_t *evflags)
 Get the event flags name. More...
 
os_result_t os_evflags_wait (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags, os_flags_mode_t mode)
 Wait for event flags. More...
 
os_result_t os_evflags_try_wait (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags, os_flags_mode_t mode)
 Try to wait for event flags. More...
 
os_result_t os_evflags_timed_wait (os_evflags_t *evflags, os_flags_mask_t mask, os_clock_duration_t timeout, os_flags_mask_t *oflags, os_flags_mode_t mode)
 Timed wait for event flags. More...
 
os_result_t os_evflags_raise (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags)
 Raise event flags. More...
 
os_result_t os_evflags_clear (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags)
 Clear event flags. More...
 
os_flags_mask_t os_evflags_get (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mode_t mode)
 Get (and possibly clear) event flags. More...
 
bool os_evflags_are_waiting (os_evflags_t *evflags)
 Check if there are threads waiting. More...
 

Detailed Description

C API event flags definitions.

For the complete definition, see
RTOS C++ API
Examples
int
os_main (int argc, char* argv[])
{
{
os_evflags_construct (&ev1, "ev1", NULL);
// Clear all flags.
os_evflags_clear (&ev1, 0x0, NULL);
os_evflags_raise (&ev1, 0x1, NULL);
os_evflags_wait (&ev1, 0x1, NULL,
os_evflags_raise (&ev1, 0x1, NULL);
os_evflags_try_wait (&ev1, 0x1, NULL,
os_evflags_raise (&ev1, 0x1, NULL);
os_evflags_timed_wait (&ev1, 0x1, 1, NULL,
name = os_evflags_get_name (&ev1);
}
{
// Initialise custom event flags with a specific clock.
os_evflags_construct (&ev2, "ev2", &aev2);
}
}

Macro Definition Documentation

◆ os_evflags_create

#define os_evflags_create   os_evflags_construct

Definition at line 2620 of file os-c-api.h.

◆ os_evflags_destroy

#define os_evflags_destroy   os_evflags_destruct

Definition at line 2621 of file os-c-api.h.

Types

◆ os_evflags_attr_t

Event flags attributes.

Initialise this structure with os_evflags_attr_init() and then set any of the individual members directly.

See also
os::rtos::event_flags::attributes

◆ os_evflags_t

typedef struct os_evflags_s os_evflags_t

Event flags object storage.

This C structure has the same size as the C++ os::rtos::event_flags object and must be initialised with os_evflags_create().

Later on a pointer to it can be used both in C and C++ to refer to the event flags object instance.

The members of this structure are hidden and should not be used directly, but only through specific functions.

See also
os::rtos::event_flags

Function Documentation

◆ os_evflags_are_waiting()

bool os_evflags_are_waiting ( os_evflags_t evflags)

Check if there are threads waiting.

Parameters
[in]evflagsPointer to event flags object instance.
Return values
trueThere are threads waiting.
falseThere are no threads waiting.
Note
Can be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::raise()

Definition at line 3293 of file os-c-wrapper.cpp.

◆ os_evflags_attr_init()

void os_evflags_attr_init ( os_evflags_attr_t attr)

Initialise the event flags attributes.

Parameters
[in]attrPointer to event flags attributes object instance.
Returns
Nothing.
Warning
Cannot be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::attributes

Definition at line 3074 of file os-c-wrapper.cpp.

◆ os_evflags_clear()

os_result_t os_evflags_clear ( os_evflags_t evflags,
os_flags_mask_t  mask,
os_flags_mask_t oflags 
)

Clear event flags.

Parameters
[in]evflagsPointer to event flags object instance.
[in]maskThe OR-ed flags to clear. Zero means 'all'.
[out]oflagsOptional pointer where to store the previous value of the flags; may be NULL.
Return values
os_okThe flags were cleared.
EINVALThe mask is zero.
Note
Can be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::clear()

Definition at line 3259 of file os-c-wrapper.cpp.

◆ os_evflags_construct()

void os_evflags_construct ( os_evflags_t evflags,
const char *  name,
const os_evflags_attr_t attr 
)

Construct a statically allocated event flags object instance.

Parameters
[in]evflagsPointer to event flags object instance storage.
[in]namePointer to name (may be NULL).
[in]attrPointer to attributes (may be NULL).
Returns
Nothing.
Note
Must be paired with os_evflags_destruct().
Warning
Cannot be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags

Definition at line 3091 of file os-c-wrapper.cpp.

◆ os_evflags_delete()

void os_evflags_delete ( os_evflags_t evflags)

Destruct the event flags object instance and deallocate it.

Parameters
[in]evflagsPointer to dynamically allocated event flags object instance.
Returns
Nothing.

Destruct the event flags and deallocate the dynamically allocated space using the RTOS system allocator.

Note
Equivalent of C++ delete ptr_evflags.
Must be paired with os_evflags_new().
Warning
Cannot be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags

Definition at line 3159 of file os-c-wrapper.cpp.

◆ os_evflags_destruct()

void os_evflags_destruct ( os_evflags_t evflags)

Destruct the statically allocated event flags object instance.

Parameters
[in]evflagsPointer to event flags object instance.
Returns
Nothing.
Note
Must be paired with os_evflags_construct().
Warning
Cannot be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags

Definition at line 3113 of file os-c-wrapper.cpp.

◆ os_evflags_get()

os_flags_mask_t os_evflags_get ( os_evflags_t evflags,
os_flags_mask_t  mask,
os_flags_mode_t  mode 
)

Get (and possibly clear) event flags.

Parameters
[in]evflagsPointer to event flags object instance.
[in]maskThe OR-ed flags to get/clear; may be zero.
[in]modeMode bits to select if the flags should be cleared (the other bits are ignored).
Returns
The selected bits from the flags mask.
Note
Can be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::get()

Definition at line 3276 of file os-c-wrapper.cpp.

◆ os_evflags_get_name()

const char* os_evflags_get_name ( os_evflags_t evflags)

Get the event flags name.

Parameters
[in]evflagsPointer to event flags object instance.
Returns
Null terminated string.
Note
Can be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::name()

Definition at line 3174 of file os-c-wrapper.cpp.

◆ os_evflags_new()

os_evflags_t* os_evflags_new ( const char *  name,
const os_evflags_attr_t attr 
)

Allocate an event flags object instance and construct it.

Parameters
[in]namePointer to name (may be NULL).
[in]attrPointer to attributes (may be NULL).
Returns
Pointer to new event flags object instance.

Dynamically allocate the event flags object instance using the RTOS system allocator and construct it.

Note
Equivalent of C++ new event_flags(...).
Must be paired with os_evflags_delete().
Warning
Cannot be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags

Definition at line 3134 of file os-c-wrapper.cpp.

◆ os_evflags_raise()

os_result_t os_evflags_raise ( os_evflags_t evflags,
os_flags_mask_t  mask,
os_flags_mask_t oflags 
)

Raise event flags.

Parameters
[in]evflagsPointer to event flags object instance.
[in]maskThe OR-ed flags to raise.
[out]oflagsOptional pointer where to store the new value of the flags; may be NULL.
Return values
os_okThe flags were raised.
EINVALThe mask is zero.
ENOTRECOVERABLERaise failed.
Note
Can be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::raise()

Definition at line 3242 of file os-c-wrapper.cpp.

◆ os_evflags_timed_wait()

os_result_t os_evflags_timed_wait ( os_evflags_t evflags,
os_flags_mask_t  mask,
os_clock_duration_t  timeout,
os_flags_mask_t oflags,
os_flags_mode_t  mode 
)

Timed wait for event flags.

Parameters
[in]evflagsPointer to event flags object instance.
[in]maskThe expected flags (OR-ed bit-mask); may be zero.
[out]oflagsPointer where to store the current flags; may be NULL.
[in]modeMode bits to select if either all or any flags are expected, and if the flags should be cleared.
[in]timeoutTimeout to wait.
Return values
os_okAll expected flags are raised.
EPERMCannot be invoked from an Interrupt Service Routines.
ETIMEDOUTThe expected condition did not occur during the entire timeout duration.
EINVALThe mask is outside of the permitted range.
EINTRThe operation was interrupted.
ENOTRECOVERABLEWait failed.
Warning
Cannot be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::timed_wait()

Definition at line 3224 of file os-c-wrapper.cpp.

◆ os_evflags_try_wait()

os_result_t os_evflags_try_wait ( os_evflags_t evflags,
os_flags_mask_t  mask,
os_flags_mask_t oflags,
os_flags_mode_t  mode 
)

Try to wait for event flags.

Parameters
[in]evflagsPointer to event flags object instance.
[in]maskThe expected flags (OR-ed bit-mask); may be zero.
[out]oflagsPointer where to store the current flags; may be NULL.
[in]modeMode bits to select if either all or any flags are expected, and if the flags should be cleared.
Return values
os_okAll expected flags were raised.
EINVALThe mask is outside of the permitted range.
EWOULDBLOCKThe expected condition did not occur.
ENOTRECOVERABLEWait failed.
Note
Can be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::try_wait()

Definition at line 3207 of file os-c-wrapper.cpp.

◆ os_evflags_wait()

os_result_t os_evflags_wait ( os_evflags_t evflags,
os_flags_mask_t  mask,
os_flags_mask_t oflags,
os_flags_mode_t  mode 
)

Wait for event flags.

Parameters
[in]evflagsPointer to event flags object instance.
[in]maskThe expected flags (OR-ed bit-mask); may be zero.
[out]oflagsPointer where to store the current flags; may be NULL.
[in]modeMode bits to select if either all or any flags are expected, and if the flags should be cleared.
Return values
os_okAll expected flags were raised.
EPERMCannot be invoked from an Interrupt Service Routines.
EINVALThe mask is outside of the permitted range.
EINTRThe operation was interrupted.
ENOTRECOVERABLEWait failed.
Warning
Cannot be invoked from Interrupt Service Routines.
For the complete definition, see
os::rtos::event_flags::wait()

Definition at line 3189 of file os-c-wrapper.cpp.