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 __attribute__((aligned(8))) name[(size)]
 Declare a static thread stack array named name with size size.
 
#define OVE_THREAD_STACK_DEFINE_STATIC_(name, size)    static uint8_t __attribute__((aligned(8))) name[(size)]
 
#define OVE_THREAD_STACK_MEMBER_(name, size)   uint8_t __attribute__((aligned(8))) 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.
 
#define OVE_MODEL_DEFINE(name)   static ove_model_storage_t name
 Declare a static model storage variable named name.
 
#define OVE_MODEL_ARENA_DEFINE(name, size)   static uint8_t __attribute__((aligned(16))) name[(size)]
 Declare a 16-byte-aligned static tensor arena of size bytes.
 
#define OVE_UART_DEFINE(name, rx_buf_size)
 Declare a static UART storage variable and its RX buffer.
 
#define OVE_SPI_DEFINE(name)   static ove_spi_storage_t name
 Declare a static SPI storage variable named name.
 
#define OVE_I2C_DEFINE(name)   static ove_i2c_storage_t name
 Declare a static I2C storage variable named name.
 
#define OVE_I2S_DEFINE(name)   static ove_i2s_storage_t name
 Declare a static I2S 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:373
OVE_NODISCARD int ove_mutex_init(ove_mutex_t *mtx, ove_mutex_storage_t *storage) OVE_NONNULL(1
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:211

Macro Definition Documentation

◆ OVE_THREAD_STACK_DEFINE_

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

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

Note
Always 8-byte aligned (ARM AAPCS); the runtime backstop in ove_thread_init() rejects misaligned stacks with OVE_ERR_INVALID_PARAM, which would silently take down a caller that hand-rolled a stack at file scope without the attribute (the C++ NuttX bench used to fail at runtime here: BSS placement put <...>_stack at a 1-byte-aligned offset).
Overridden by backends that require special alignment (e.g. Zephyr MPU).

◆ OVE_THREAD_STACK_MEMBER_

#define OVE_THREAD_STACK_MEMBER_ (   name,
  size 
)    uint8_t __attribute__((aligned(8))) 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
The 8-byte alignment matches OVE_THREAD_STACK_BLOCK_STATIC_ and satisfies the ARM AAPCS requirement that the stack pointer be 8-byte aligned at public function boundaries; a misaligned stack faults immediately on the first thread entry. The runtime backstop in ove_thread_init() returns OVE_ERR_INVALID_PARAM if a caller bypasses this macro with a hand-rolled array.
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; \
OVE_THREAD_STACK_DEFINE_(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.

◆ OVE_UART_DEFINE

#define OVE_UART_DEFINE (   name,
  rx_buf_size 
)
Value:
static ove_uart_storage_t name; \
static uint8_t name##_rx_buf[(rx_buf_size)]

Declare a static UART storage variable and its RX buffer.

Parameters
nameVariable name for the UART storage.
rx_buf_sizeRX ring buffer capacity in bytes.

◆ OVE_I2S_DEFINE

#define OVE_I2S_DEFINE (   name)    static ove_i2s_storage_t name

Declare a static I2S storage variable named name.

Note
DMA buffers are not declared by this macro — pass them as separate caller-supplied arrays to ove_i2s_init.