oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Macros
OVE_*_DEFINE Macros

File-scope static storage object declarations. More...

Collaboration diagram for OVE_*_DEFINE Macros:

Macros

#define OVE_MUTEX_DEFINE(name)    static ove_mutex_storage_t name
 Declare a static mutex storage variable named name.
 
#define OVE_SEM_DEFINE(name)    static ove_sem_storage_t name
 Declare a static semaphore storage variable named name.
 
#define OVE_EVENT_DEFINE(name)    static ove_event_storage_t name
 Declare a static event storage variable named name.
 
#define OVE_CONDVAR_DEFINE(name)    static ove_condvar_storage_t name
 Declare a static condition variable storage variable named name.
 
#define OVE_THREAD_STACK_DEFINE_(name, size)    static uint8_t name[(size)]
 Declare a static thread stack array named name with size size.
 
#define OVE_THREAD_STACK_MEMBER_(name, size)   uint8_t name[size]
 Declare a non-static (class-member) thread stack array.
 
#define OVE_THREAD_DEFINE(name, stack_size_bytes)
 Declare a static thread storage variable and its stack.
 
#define OVE_QUEUE_DEFINE(name, item_sz, max)
 Declare a static queue storage variable and its backing buffer.
 
#define OVE_TIMER_DEFINE(name)    static ove_timer_storage_t name
 Declare a static timer storage variable named name.
 
#define OVE_EVENTGROUP_DEFINE(name)    static ove_eventgroup_storage_t name
 Declare a static event group storage variable named name.
 
#define OVE_WORKQUEUE_DEFINE(name, stack_size_bytes)
 Declare a static work queue storage variable and its stack.
 
#define OVE_STREAM_DEFINE(name, buf_size)
 Declare a static stream buffer storage variable and its backing buffer.
 
#define OVE_WATCHDOG_DEFINE(name)    static ove_watchdog_storage_t name
 Declare a static watchdog storage variable named name.
 

Detailed Description

File-scope static storage object declarations.

Each macro declares a static storage variable of the correct backend type. Pass its address to the corresponding _init() function:

OVE_MUTEX_DEFINE(my_mutex_storage);
ove_mutex_t my_mutex;
ove_mutex_init(&my_mutex, &my_mutex_storage);
#define OVE_MUTEX_DEFINE(name)
Declare a static mutex storage variable named name.
Definition storage.h:279
int ove_mutex_init(ove_mutex_t *mtx, ove_mutex_storage_t *storage)
Initialise a non-recursive mutex using caller-supplied static storage.
struct ove_mutex * ove_mutex_t
Opaque handle for a mutex object.
Definition types.h:85

Macro Definition Documentation

◆ OVE_THREAD_STACK_DEFINE_

#define OVE_THREAD_STACK_DEFINE_ (   name,
  size 
)     static uint8_t name[(size)]

Declare a static thread stack array named name with size size.

Note
Overridden by backends that require special alignment (e.g. Zephyr MPU).

◆ OVE_THREAD_STACK_MEMBER_

#define OVE_THREAD_STACK_MEMBER_ (   name,
  size 
)    uint8_t name[size]

Declare a non-static (class-member) thread stack array.

Use inside a C++ struct or class body where static is not applicable.

Note
Overridden by backends that require special alignment (e.g. Zephyr MPU).

◆ OVE_THREAD_DEFINE

#define OVE_THREAD_DEFINE (   name,
  stack_size_bytes 
)
Value:
static ove_thread_storage_t name; \
OVE_THREAD_STACK_DEFINE_(name##_stack, stack_size_bytes)

Declare a static thread storage variable and its stack.

Parameters
nameVariable name for the thread storage.
stack_size_bytesStack size in bytes.

◆ OVE_QUEUE_DEFINE

#define OVE_QUEUE_DEFINE (   name,
  item_sz,
  max 
)
Value:
static ove_queue_storage_t name; \
static uint8_t name##_buffer[(item_sz) * (max)]

Declare a static queue storage variable and its backing buffer.

Parameters
nameVariable name for the queue storage.
item_szSize of each queue item in bytes.
maxMaximum number of items in the queue.

◆ OVE_WORKQUEUE_DEFINE

#define OVE_WORKQUEUE_DEFINE (   name,
  stack_size_bytes 
)
Value:
static ove_workqueue_storage_t name; \
static uint8_t name##_stack[stack_size_bytes]

Declare a static work queue storage variable and its stack.

Parameters
nameVariable name for the work queue storage.
stack_size_bytesStack size in bytes for the work queue thread.

◆ OVE_STREAM_DEFINE

#define OVE_STREAM_DEFINE (   name,
  buf_size 
)
Value:
static ove_stream_storage_t name; \
static uint8_t name##_buffer[(buf_size) + 1]

Declare a static stream buffer storage variable and its backing buffer.

Parameters
nameVariable name for the stream storage.
buf_sizeStream buffer capacity in bytes.