|
oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
|
One-step static primitive declaration with automatic initialisation. More...

Macros | |
| #define | OVE_MUTEX_DEFINE_STATIC(name) |
| Declare and auto-initialise a static mutex. | |
| #define | OVE_RECURSIVE_MUTEX_DEFINE_STATIC(name) |
| Declare and auto-initialise a static recursive mutex. | |
| #define | OVE_SEM_DEFINE_STATIC(name, initial, max) |
| Declare and auto-initialise a static semaphore. | |
| #define | OVE_EVENT_DEFINE_STATIC(name) |
| Declare and auto-initialise a static event object. | |
| #define | OVE_CONDVAR_DEFINE_STATIC(name) |
| Declare and auto-initialise a static condition variable. | |
| #define | OVE_THREAD_DEFINE_STATIC(hname, stack_sz, fn, ctx, prio, tname) |
| Declare and auto-initialise a static thread. | |
| #define | OVE_QUEUE_DEFINE_STATIC(name, item_sz, max) |
| Declare and auto-initialise a static message queue. | |
| #define | OVE_TIMER_DEFINE_STATIC(name, cb, user_data, period_ms, one_shot) |
| Declare and auto-initialise a static timer. | |
| #define | OVE_EVENTGROUP_DEFINE_STATIC(name) |
| Declare and auto-initialise a static event group. | |
| #define | OVE_WORKQUEUE_DEFINE_STATIC(name, stack_sz, wq_name, prio) |
| Declare and auto-initialise a static work queue. | |
| #define | OVE_WORK_DEFINE_STATIC(name, handler) |
| Declare and auto-initialise a static work item. | |
| #define | OVE_STREAM_DEFINE_STATIC(name, buf_sz, trigger) |
| Declare and auto-initialise a static stream buffer. | |
| #define | OVE_WATCHDOG_DEFINE_STATIC(name, timeout_ms) |
| Declare and auto-initialise a static watchdog timer. | |
| #define | OVE_MODEL_DEFINE_STATIC(name, model_ptr, model_sz, arena_sz) |
| Declare and auto-initialise a static ML model. | |
| #define | OVE_I2C_DEFINE_STATIC(name, inst, spd) |
| Declare and auto-initialise a static I2C bus. | |
| #define | OVE_SPI_DEFINE_STATIC(name, cfg_ptr) |
| Declare and auto-initialise a static SPI bus. | |
| #define | OVE_UART_DEFINE_STATIC(name, rx_buf_sz, cfg_ptr) |
| Declare and auto-initialise a static UART. | |
| #define | OVE_I2S_DEFINE_STATIC(name, tx_dma_bytes, rx_dma_bytes, cfg_ptr) |
| Declare and auto-initialise a static I2S bus with caller-supplied DMA buffers. | |
| #define | OVE_NETIF_DEFINE_STATIC(name) |
| Declare and auto-initialise a static network interface. | |
| #define | OVE_SOCKET_DEFINE(name) static ove_socket_storage_t name |
Declare a static socket storage variable named name. | |
| #define | OVE_TLS_DEFINE_STATIC(name) |
| Declare and auto-initialise a static TLS session. | |
| #define | OVE_HTTP_CLIENT_DEFINE_STATIC(name) |
| Declare and auto-initialise a static HTTP client. | |
| #define | OVE_MQTT_CLIENT_DEFINE_STATIC(name) |
| Declare and auto-initialise a static MQTT client. | |
One-step static primitive declaration with automatic initialisation.
Each macro declares a handle, allocates the corresponding static storage, and registers a C constructor (__attribute__((constructor))) that initialises the handle before main(). No runtime init boilerplate is needed.
The constructor calls the corresponding _init() function with static storage in both heap and zero-heap modes — the macros perform a true static allocation regardless of build configuration.
Usage:
| #define OVE_MUTEX_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static mutex.
| name | Variable name for the resulting ove_mutex_t handle. |
| #define OVE_RECURSIVE_MUTEX_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static recursive mutex.
| name | Variable name for the resulting ove_mutex_t handle. |
| #define OVE_SEM_DEFINE_STATIC | ( | name, | |
| initial, | |||
| max | |||
| ) |
Declare and auto-initialise a static semaphore.
| name | Variable name for the resulting ove_sem_t handle. |
| initial | Initial semaphore count. |
| max | Maximum semaphore count. |
| #define OVE_EVENT_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static event object.
| name | Variable name for the resulting ove_event_t handle. |
| #define OVE_CONDVAR_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static condition variable.
| name | Variable name for the resulting ove_condvar_t handle. |
| #define OVE_THREAD_DEFINE_STATIC | ( | hname, | |
| stack_sz, | |||
| fn, | |||
| ctx, | |||
| prio, | |||
| tname | |||
| ) |
Declare and auto-initialise a static thread.
| hname | Variable name for the resulting ove_thread_t handle. |
| stack_sz | Thread stack size in bytes. |
| fn | Thread entry function. |
| ctx | Argument passed to fn. |
| prio | Thread priority. |
| tname | Human-readable thread name string. |
| #define OVE_QUEUE_DEFINE_STATIC | ( | name, | |
| item_sz, | |||
| max | |||
| ) |
Declare and auto-initialise a static message queue.
| name | Variable name for the resulting ove_queue_t handle. |
| item_sz | Size of each queue item in bytes. |
| max | Maximum number of items in the queue. |
| #define OVE_TIMER_DEFINE_STATIC | ( | name, | |
| cb, | |||
| user_data, | |||
| period_ms, | |||
| one_shot | |||
| ) |
Declare and auto-initialise a static timer.
| name | Variable name for the resulting ove_timer_t handle. |
| cb | Timer expiry callback. |
| user_data | Opaque pointer forwarded to cb. |
| period_ms | Timer period in milliseconds. |
| one_shot | Non-zero for a one-shot timer, zero for periodic. |
| #define OVE_EVENTGROUP_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static event group.
| name | Variable name for the resulting ove_eventgroup_t handle. |
| #define OVE_WORKQUEUE_DEFINE_STATIC | ( | name, | |
| stack_sz, | |||
| wq_name, | |||
| prio | |||
| ) |
Declare and auto-initialise a static work queue.
| name | Variable name for the resulting ove_workqueue_t handle. |
| stack_sz | Stack size in bytes for the work queue thread. |
| wq_name | Human-readable work queue name string. |
| prio | Thread priority for the work queue thread. |
| #define OVE_WORK_DEFINE_STATIC | ( | name, | |
| handler | |||
| ) |
Declare and auto-initialise a static work item.
| name | Variable name for the resulting ove_work_t handle. |
| handler | Work handler function invoked when the item is executed. |
| #define OVE_STREAM_DEFINE_STATIC | ( | name, | |
| buf_sz, | |||
| trigger | |||
| ) |
Declare and auto-initialise a static stream buffer.
| name | Variable name for the resulting ove_stream_t handle. |
| buf_sz | Stream buffer capacity in bytes. |
| trigger | Minimum bytes required before a blocked reader is unblocked. |
| #define OVE_WATCHDOG_DEFINE_STATIC | ( | name, | |
| timeout_ms | |||
| ) |
Declare and auto-initialise a static watchdog timer.
| name | Variable name for the resulting ove_watchdog_t handle. |
| timeout_ms | Watchdog timeout in milliseconds. |
| #define OVE_MODEL_DEFINE_STATIC | ( | name, | |
| model_ptr, | |||
| model_sz, | |||
| arena_sz | |||
| ) |
Declare and auto-initialise a static ML model.
| name | Variable name for the resulting ove_model_t handle. |
| model_ptr | Pointer to the .tflite FlatBuffer data. |
| model_sz | Size of the FlatBuffer in bytes. |
| arena_sz | Tensor arena size in bytes (must be compile-time constant). |
| #define OVE_I2C_DEFINE_STATIC | ( | name, | |
| inst, | |||
| spd | |||
| ) |
Declare and auto-initialise a static I2C bus.
| name | Variable name for the resulting ove_i2c_t handle. |
| inst | Peripheral instance index. |
| spd | Bus speed (ove_i2c_speed_t). |
| #define OVE_SPI_DEFINE_STATIC | ( | name, | |
| cfg_ptr | |||
| ) |
Declare and auto-initialise a static SPI bus.
| name | Variable name for the resulting ove_spi_t handle. |
| cfg_ptr | Pointer to a struct ove_spi_cfg. |
| #define OVE_UART_DEFINE_STATIC | ( | name, | |
| rx_buf_sz, | |||
| cfg_ptr | |||
| ) |
Declare and auto-initialise a static UART.
| name | Variable name for the resulting ove_uart_t handle. |
| rx_buf_sz | RX buffer size in bytes (must be compile-time constant). |
| cfg_ptr | Pointer to a struct ove_uart_cfg. |
| #define OVE_I2S_DEFINE_STATIC | ( | name, | |
| tx_dma_bytes, | |||
| rx_dma_bytes, | |||
| cfg_ptr | |||
| ) |
Declare and auto-initialise a static I2S bus with caller-supplied DMA buffers.
Emits a storage object, two 4-byte-aligned DMA byte arrays (tx_dma_bytes and rx_dma_bytes), and a handle. The constructor calls ove_i2s_init with all of them.
For a unidirectional configuration, pass 1 for the unused buffer's size — ove_i2s_init does not touch a buffer whose direction is disabled in cfg_ptr. The 1-byte placeholder keeps the array declaration valid (C does not allow zero-length arrays).
| name | Variable name for the resulting ove_i2s_t handle. |
| tx_dma_bytes | TX DMA buffer size in bytes (compile-time constant). |
| rx_dma_bytes | RX DMA buffer size in bytes (compile-time constant). |
| cfg_ptr | Pointer to a struct ove_i2s_cfg. |
| #define OVE_NETIF_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static network interface.
The constructor only allocates the ove_netif_t handle and its storage; ove_netif_up() with a config must still be called by the application to bring the link up (DHCP vs static IP is a runtime decision).
| name | Variable name for the resulting ove_netif_t handle. |
| #define OVE_SOCKET_DEFINE | ( | name | ) | static ove_socket_storage_t name |
Declare a static socket storage variable named name.
The socket family / type are decided at ove_socket_open() time, so this macro only produces the storage; the application supplies the handle and calls ove_socket_open(&handle, &storage, af, type).
| #define OVE_TLS_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static TLS session.
The mbedTLS context structures are embedded in the storage; their internal allocations come from the CONFIG_OVE_NET_TLS_HEAP_SIZE static buffer (zero-heap mode) or the system allocator (heap mode).
| name | Variable name for the resulting ove_tls_t handle. |
| #define OVE_HTTP_CLIENT_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static HTTP client.
Response body and headers borrow into a buffer of CONFIG_OVE_NET_HTTP_MAX_RESPONSE bytes embedded in the storage (zero-heap mode); the borrow is valid until the next request.
| name | Variable name for the resulting ove_http_client_t handle. |
| #define OVE_MQTT_CLIENT_DEFINE_STATIC | ( | name | ) |
Declare and auto-initialise a static MQTT client.
Per-connection RX/TX buffers (CONFIG_OVE_NET_MQTT_RX_BUF / CONFIG_OVE_NET_MQTT_TX_BUF) are embedded in the storage.
| name | Variable name for the resulting ove_mqtt_client_t handle. |