One-step static primitive declaration with automatic initialisation.
More...
|
| #define | OVE_MUTEX_DEFINE_STATIC(name) |
| | Declare and auto-initialise a static mutex (heap mode).
|
| |
| #define | OVE_RECURSIVE_MUTEX_DEFINE_STATIC(name) |
| | Declare and auto-initialise a static recursive mutex (heap mode).
|
| |
| #define | OVE_SEM_DEFINE_STATIC(name, initial, max) |
| | Declare and auto-initialise a static semaphore (heap mode).
|
| |
| #define | OVE_EVENT_DEFINE_STATIC(name) |
| | Declare and auto-initialise a static event object (heap mode).
|
| |
| #define | OVE_CONDVAR_DEFINE_STATIC(name) |
| | Declare and auto-initialise a static condition variable (heap mode).
|
| |
| #define | OVE_THREAD_DEFINE_STATIC(hname, stack_sz, fn, ctx, prio, tname) |
| | Declare and auto-initialise a static thread (heap mode).
|
| |
| #define | OVE_QUEUE_DEFINE_STATIC(name, item_sz, max) |
| | Declare and auto-initialise a static message queue (heap mode).
|
| |
| #define | OVE_TIMER_DEFINE_STATIC(name, cb, user_data, period_ms, one_shot) |
| | Declare and auto-initialise a static timer (heap mode).
|
| |
| #define | OVE_EVENTGROUP_DEFINE_STATIC(name) |
| | Declare and auto-initialise a static event group (heap mode).
|
| |
| #define | OVE_WORKQUEUE_DEFINE_STATIC(name, stack_sz, wq_name, prio) |
| | Declare and auto-initialise a static work queue (heap mode).
|
| |
| #define | OVE_WORK_DEFINE_STATIC(name, handler) |
| | Declare and auto-initialise a static work item (heap mode).
|
| |
| #define | OVE_STREAM_DEFINE_STATIC(name, buf_sz, trigger) |
| | Declare and auto-initialise a static stream buffer (heap mode).
|
| |
| #define | OVE_WATCHDOG_DEFINE_STATIC(name, timeout_ms) |
| | Declare and auto-initialise a static watchdog timer (heap mode).
|
| |
One-step static primitive declaration with automatic initialisation.
Each macro declares a handle and a C constructor (__attribute__((constructor))) that initialises the handle before main(). No runtime init boilerplate or #ifdef guards are needed.
- In zero-heap mode (
CONFIG_OVE_ZERO_HEAP) the constructor calls the corresponding _init() function with static storage.
- In heap mode the constructor calls
_create() so the macros work on every backend without modification.
Usage:
#define OVE_QUEUE_DEFINE_STATIC(name, item_sz, max)
Declare and auto-initialise a static message queue (heap mode).
Definition storage.h:839
◆ OVE_MUTEX_DEFINE_STATIC
| #define OVE_MUTEX_DEFINE_STATIC |
( |
|
name | ) |
|
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_mutex_create(&name); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_mutex * ove_mutex_t
Opaque handle for a mutex object.
Definition types.h:85
Declare and auto-initialise a static mutex (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_mutex_t handle. |
◆ OVE_RECURSIVE_MUTEX_DEFINE_STATIC
| #define OVE_RECURSIVE_MUTEX_DEFINE_STATIC |
( |
|
name | ) |
|
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_recursive_mutex_create(&name); \
OVE_DEFINE_STATIC_CTOR_END_(name)
Declare and auto-initialise a static recursive mutex (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_mutex_t handle. |
◆ OVE_SEM_DEFINE_STATIC
| #define OVE_SEM_DEFINE_STATIC |
( |
|
name, |
|
|
|
initial, |
|
|
|
max |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_sem_create(&name, (initial), (max)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_sem * ove_sem_t
Opaque handle for a counting semaphore object.
Definition types.h:88
Declare and auto-initialise a static semaphore (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_sem_t handle. |
| initial | Initial semaphore count. |
| max | Maximum semaphore count. |
◆ OVE_EVENT_DEFINE_STATIC
| #define OVE_EVENT_DEFINE_STATIC |
( |
|
name | ) |
|
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_event_create(&name); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_event * ove_event_t
Opaque handle for a binary event (signal/wait) object.
Definition types.h:91
Declare and auto-initialise a static event object (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_event_t handle. |
◆ OVE_CONDVAR_DEFINE_STATIC
| #define OVE_CONDVAR_DEFINE_STATIC |
( |
|
name | ) |
|
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
int _err = ove_condvar_create(&name); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_condvar * ove_condvar_t
Opaque handle for a condition variable object.
Definition types.h:94
Declare and auto-initialise a static condition variable (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_condvar_t handle. |
◆ OVE_THREAD_DEFINE_STATIC
| #define OVE_THREAD_DEFINE_STATIC |
( |
|
hname, |
|
|
|
stack_sz, |
|
|
|
fn, |
|
|
|
ctx, |
|
|
|
prio, |
|
|
|
tname |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(hname) \
.arg = (ctx), \
.stack_size = (stack_sz), \
}; \
OVE_DEFINE_STATIC_CTOR_END_(hname)
int ove_thread_create_(ove_thread_t *handle, const struct ove_thread_desc *desc)
Internal heap-backed thread creation function.
struct ove_thread * ove_thread_t
Opaque handle for a thread object.
Definition types.h:82
Thread creation descriptor passed to ove_thread_init() / ove_thread_create().
Definition thread.h:81
ove_thread_fn entry
Thread entry-point function. Must not be NULL.
Definition thread.h:83
const char * name
Human-readable thread name (may be truncated by backend).
Definition thread.h:82
ove_prio_t priority
Scheduling priority.
Definition thread.h:85
Declare and auto-initialise a static thread (heap mode).
- Parameters
-
| 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. |
◆ OVE_QUEUE_DEFINE_STATIC
| #define OVE_QUEUE_DEFINE_STATIC |
( |
|
name, |
|
|
|
item_sz, |
|
|
|
max |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_queue * ove_queue_t
Opaque handle for a message queue object.
Definition queue.h:39
int ove_queue_create(ove_queue_t *q, size_t item_size, unsigned int max_items)
Allocate and initialise a queue from the heap.
Declare and auto-initialise a static message queue (heap mode).
- Parameters
-
| 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. |
◆ OVE_TIMER_DEFINE_STATIC
| #define OVE_TIMER_DEFINE_STATIC |
( |
|
name, |
|
|
|
cb, |
|
|
|
user_data, |
|
|
|
period_ms, |
|
|
|
one_shot |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
(cb), (user_data), (period_ms), (one_shot)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_timer_create(ove_timer_t *timer, ove_timer_fn callback, void *user_data, uint32_t period_ms, int one_shot)
Allocate and initialise a software timer from the heap.
struct ove_timer * ove_timer_t
Opaque handle for a software timer object.
Definition timer.h:37
Declare and auto-initialise a static timer (heap mode).
- Parameters
-
| 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. |
◆ OVE_EVENTGROUP_DEFINE_STATIC
| #define OVE_EVENTGROUP_DEFINE_STATIC |
( |
|
name | ) |
|
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_eventgroup_create(ove_eventgroup_t *eg)
Allocate and initialise a heap-backed event group.
struct ove_eventgroup * ove_eventgroup_t
Opaque handle for an event-group (bit-field) object.
Definition types.h:97
Declare and auto-initialise a static event group (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_eventgroup_t handle. |
◆ OVE_WORKQUEUE_DEFINE_STATIC
| #define OVE_WORKQUEUE_DEFINE_STATIC |
( |
|
name, |
|
|
|
stack_sz, |
|
|
|
wq_name, |
|
|
|
prio |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
(wq_name), (prio), (stack_sz)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_workqueue * ove_workqueue_t
Opaque handle for a work queue object.
Definition types.h:100
int ove_workqueue_create(ove_workqueue_t *wq, const char *name, ove_prio_t priority, size_t stack_size)
Allocate a heap-backed work queue.
Declare and auto-initialise a static work queue (heap mode).
- Parameters
-
| 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. |
◆ OVE_WORK_DEFINE_STATIC
| #define OVE_WORK_DEFINE_STATIC |
( |
|
name, |
|
|
|
handler |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_work * ove_work_t
Opaque handle for a deferred work item.
Definition types.h:103
int ove_work_init(ove_work_t *work, ove_work_fn handler)
Allocate and initialise a heap-backed work item.
Declare and auto-initialise a static work item (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_work_t handle. |
| handler | Work handler function invoked when the item is executed. |
◆ OVE_STREAM_DEFINE_STATIC
| #define OVE_STREAM_DEFINE_STATIC |
( |
|
name, |
|
|
|
buf_sz, |
|
|
|
trigger |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
(buf_sz), (trigger)); \
OVE_DEFINE_STATIC_CTOR_END_(name)
int ove_stream_create(ove_stream_t *stream, size_t size, size_t trigger)
Allocate and initialise a heap-backed stream.
struct ove_stream * ove_stream_t
Opaque handle for a byte-stream (ring-buffer) object.
Definition types.h:106
Declare and auto-initialise a static stream buffer (heap mode).
- Parameters
-
| 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. |
◆ OVE_WATCHDOG_DEFINE_STATIC
| #define OVE_WATCHDOG_DEFINE_STATIC |
( |
|
name, |
|
|
|
timeout_ms |
|
) |
| |
Value:
OVE_DEFINE_STATIC_CTOR_BEGIN_(name) \
OVE_DEFINE_STATIC_CTOR_END_(name)
struct ove_watchdog * ove_watchdog_t
Opaque handle for a software watchdog object.
Definition types.h:109
int ove_watchdog_create(ove_watchdog_t *wdt, uint32_t timeout_ms)
Allocate and initialise a heap-backed watchdog timer.
Declare and auto-initialise a static watchdog timer (heap mode).
- Parameters
-
| name | Variable name for the resulting ove_watchdog_t handle. |
| timeout_ms | Watchdog timeout in milliseconds. |