Skip to main content

Module generated

Module generated 

Source
Expand description

AUTO-GENERATED by scripts/gen-abi-bindings.sh (bindgen 0.72.1) — DO NOT EDIT.

Source of truth: packages/platform/nros-platform-api/include/nros/platform*.h (RFC-0054). Edit the headers, rerun the script, commit both.

Structs§

nros_platform_task_attr_t

Constants§

NROS_PLATFORM_CONDVAR_STORAGE_SIZE
NROS_PLATFORM_MUTEX_REC_STORAGE_SIZE
NROS_PLATFORM_MUTEX_STORAGE_SIZE
NROS_PLATFORM_PARK_EXPIRED
NROS_PLATFORM_PARK_SIGNALLED
NROS_PLATFORM_PARK_YIELDED
NROS_PLATFORM_PRIORITY_INHERIT
NROS_PLATFORM_PRIORITY_MAX
NROS_PLATFORM_PRIORITY_MIN
NROS_PLATFORM_RET_ERROR
NROS_PLATFORM_RET_INVALID
NROS_PLATFORM_RET_NOMEM
NROS_PLATFORM_RET_OK
NROS_PLATFORM_RET_TIMEOUT
NROS_PLATFORM_RET_UNSUPPORTED
NROS_PLATFORM_STORAGE_ALIGN
NROS_PLATFORM_TASK_DETACHED
NROS_PLATFORM_TASK_STORAGE_SIZE

Functions§

nros_platform_alloc⚠
Allocate size bytes; return NULL on failure. May be called from any thread.
nros_platform_clock_ns⚠
Monotonic nanoseconds since a platform-defined epoch (boot, program start, …). Never decreases. Wraps after ~584 years.
nros_platform_clock_resolution_ns⚠
Granularity of nros_platform_clock_ns, in nanoseconds: the smallest non-zero difference two successive reads can report.
nros_platform_condvar_drop⚠
nros_platform_condvar_init⚠
nros_platform_condvar_signal⚠
nros_platform_condvar_signal_all⚠
nros_platform_condvar_signal_from_isr⚠
Phase 124.B.7.a — ISR-safe signal.
nros_platform_condvar_storage_align⚠
nros_platform_condvar_storage_size⚠
nros_platform_condvar_wait_until⚠
Atomically release m and block on cv until signalled or until the absolute monotonic deadline abstime, in MILLISECONDS on the nros_platform_clock_ns() epoch — i.e. clock_ns() / 1000000. The mutex is re-acquired before this returns. Returns 0 when signalled, 1 on timeout and -1 on error, the same codes as nros_platform_wake_wait_ms (issue 1906: FreeRTOS returned -1 on timeout, so a caller could not tell a timeout from a failure). A port rounds the remaining time UP to its tick, so the wait never times out before its deadline.
nros_platform_critical_section_acquire⚠
nros_platform_critical_section_release⚠
nros_platform_dealloc⚠
Free a previously allocated block. NULL is a no-op.
nros_platform_epoch_us⚠
Microseconds since the UNIX EPOCH (1970-01-01T00:00:00Z), or 0 when this platform has no wall-clock source.
nros_platform_heap_total_bytes⚠
Total managed heap size in bytes (used + free), or 0 if unknown.
nros_platform_heap_used_bytes⚠
Bytes currently allocated from the platform heap, or 0 if the port does not instrument it. Phase 230 / RFC-0034 D7: the true unified figure where the platform owns one kernel heap shared by the C side and the Rust #[global_allocator].
nros_platform_log_flush⚠
nros_platform_log_write⚠
nros_platform_mutex_drop⚠
nros_platform_mutex_init⚠
nros_platform_mutex_lock⚠
nros_platform_mutex_rec_drop⚠
nros_platform_mutex_rec_init⚠
Initialise a recursive mutex (same-thread re-entry permitted). Required by zenoh-pico.
nros_platform_mutex_rec_lock⚠
nros_platform_mutex_rec_storage_align⚠
nros_platform_mutex_rec_storage_size⚠
nros_platform_mutex_rec_try_lock⚠
nros_platform_mutex_rec_unlock⚠
nros_platform_mutex_storage_align⚠
nros_platform_mutex_storage_size⚠
Opaque-storage sizing for the lock family, matching wake and task. Pure functions, callable before the corresponding _init.
nros_platform_mutex_try_lock⚠
nros_platform_mutex_unlock⚠
nros_platform_network_poll⚠
Pump the underlying network stack to process pending I/O. No-op on platforms with a kernel-driven socket layer (POSIX, Zephyr, lwIP, NetX Duo). Bare-metal smoltcp targets advance the stack from this entry point.
nros_platform_panic⚠
nros_platform_random_fill⚠
Fill len bytes at buf with random data.
nros_platform_random_u8⚠
Random u8. Cryptographically random where the platform has an entropy source; otherwise a seeded PRNG. Must be deterministic within a single test session for reproducibility.
nros_platform_random_u16⚠
Random u16. See random_u8 notes.
nros_platform_random_u32⚠
Random u32. See random_u8 notes.
nros_platform_random_u64⚠
Random u64. See random_u8 notes.
nros_platform_realloc⚠
Resize the block at ptr to size bytes. Equivalent to libc realloc: NULL ptr → fresh alloc; 0 size → free + return NULL. Preserves contents up to min(old, new).
nros_platform_register_log_writer⚠
nros_platform_sleep_ms⚠
Sleep at least ms milliseconds.
nros_platform_sleep_s⚠
Sleep at least s seconds.
nros_platform_sleep_us⚠
Sleep at least us microseconds. Spin if the platform clock has no sub-millisecond timer.
nros_platform_socket_accept⚠
Accept a pending connection from sock_in into sock_out.
nros_platform_socket_close⚠
Socket-layer shutdown + close. Distinct from nros_platform_tcp_close because zenoh-pico’s helper layer exposes both.
nros_platform_socket_set_non_blocking⚠
Switch a socket to non-blocking mode.
nros_platform_socket_wait_event⚠
Wait for socket events on a multi-peer set. Optional on platforms without a poll/select primitive.
nros_platform_task_attr_init⚠
Fill attr with the defaults — equivalent to passing NULL to task_init.
nros_platform_task_cancel⚠
Request task to terminate at the next cancellation point. Cooperative: a task that never reaches a cancel point will not stop.
nros_platform_task_detach⚠
Mark task as detached — its storage is reclaimed on exit without a join.
nros_platform_task_exit⚠
Terminate the calling task immediately. Does not return.
nros_platform_task_free⚠
Free task storage allocated by task_init. Called after task_join or task_detach + exit.
nros_platform_task_init⚠
Spawn a new task. task is opaque caller-provided storage (size from nros_platform_task_storage_size); attr is a nros_platform_task_attr_t *, or NULL for every default; entry is the task entry point; arg is forwarded to entry.
nros_platform_task_join⚠
Block until task exits. Cleans up task storage on success.
nros_platform_task_stack_unused_bytes⚠
Smallest number of bytes ever left unused on the CALLING task’s stack, or 0 if this port cannot report it.
nros_platform_task_stack_unused_bytes_upto⚠
The same query, capped: min(unused, limit), reading at most limit bytes of the stack (phase-436 E5).
nros_platform_task_storage_align⚠
nros_platform_task_storage_size⚠
Opaque-storage sizing for task, mirroring the wake primitive’s probes below. Both are pure functions (no global state) and may be called before nros_platform_task_init.
nros_platform_tcp_close⚠
Close a TCP socket.
nros_platform_tcp_create_endpoint⚠
Resolve (address, port) strings into the caller-allocated endpoint storage at ep. Both strings are NUL-terminated.
nros_platform_tcp_free_endpoint⚠
Release any resources held by the endpoint at ep.
nros_platform_tcp_listen⚠
Open a listening TCP socket bound to endpoint.
nros_platform_tcp_open⚠
Open a TCP client connection to endpoint.
nros_platform_tcp_read⚠
Read up to len bytes. Returns bytes received, or NROS_PLATFORM_NET_SOCKET_ERROR on error.
nros_platform_tcp_read_exact⚠
Read exactly len bytes. Returns len on success, or NROS_PLATFORM_NET_SOCKET_ERROR on error.
nros_platform_tcp_send⚠
Send len bytes. Returns bytes sent, or NROS_PLATFORM_NET_SOCKET_ERROR on error.
nros_platform_tcp_set_rx_notify⚠
phase-521 W6 (RFC-0113 D4) — install (notify != NULL) or remove the receive notification on a connected TCP socket: the stack calls notify(ctx) each time data is queued on it, from the stack’s own context (NetX’s IP thread), so notify must only signal. Data already queued at install calls it once before this returns; once a removal returns, the previous notify is never called again. A zenoh session in CALLER mode over sock reports this as NROS_RMW_READINESS_NOTIFY.
nros_platform_time_now_ns⚠
Wall-clock nanoseconds since the Unix epoch, or 0 if the platform has no real-time clock.
nros_platform_timer_cancel⚠
Cancel a previously-armed timer. Returns:
nros_platform_timer_create_oneshot⚠
Register a one-shot timer that invokes callback(user_data) once after timeout_us microseconds. Returns the platform-native handle on success, NULL on failure.
nros_platform_timer_create_periodic⚠
Register a periodic timer that invokes callback(user_data) every period_us microseconds. Returns the platform-native handle on success, NULL on failure.
nros_platform_timer_destroy⚠
Cancel + free the timer. Drains in-flight callback invocations before returning so user_data is no longer accessed. Idempotent on already-destroyed handles.
nros_platform_udp_close⚠
nros_platform_udp_create_endpoint⚠
nros_platform_udp_free_endpoint⚠
nros_platform_udp_listen⚠
Bind a UDP socket in listen / server mode. Optional — return -1 on platforms that don’t expose a UDP-server primitive.
nros_platform_udp_mcast_close⚠
nros_platform_udp_mcast_listen⚠
nros_platform_udp_mcast_open⚠
nros_platform_udp_mcast_read⚠
nros_platform_udp_mcast_read_exact⚠
nros_platform_udp_mcast_send⚠
nros_platform_udp_open⚠
nros_platform_udp_read⚠
nros_platform_udp_read_exact⚠
nros_platform_udp_readiness_handle⚠
phase-521 W4 (RFC-0113 D4) — the OS handle that becomes readable when a datagram arrives on sock: its file descriptor on POSIX and NuttX. An RMW session reports it as NROS_RMW_READINESS_WAITABLE, and the executor parks on it (nros_platform_wake_park_handles_us) instead of blocking in read. Returns -1 where the stack has no such handle (lwIP, NetX, a bare-metal stack); those report readiness as a Notify instead.
nros_platform_udp_send⚠
Send len bytes to endpoint.
nros_platform_udp_set_recv_timeout⚠
Set the recv timeout in milliseconds; 0 means block indefinitely.
nros_platform_udp_set_rx_notify⚠
phase-521 W4 (RFC-0113 D4) — install (notify != NULL) or remove the receive notification on sock: the stack calls notify(ctx) each time a datagram is queued on it, from the stack’s own context (lwIP’s tcpip thread, NetX’s IP thread), so notify must only signal. Data already queued at install calls it once before this returns; once a removal returns, the previous notify is never called again. An RMW session over sock reports this as NROS_RMW_READINESS_NOTIFY.
nros_platform_wake_drop⚠
nros_platform_wake_init⚠
nros_platform_wake_park_granularity_us⚠
The finest park nros_platform_wake_park_until_us can express, in microseconds. An RTOS tick is a coarser limit than the ABI signature and a timespec primitive a finer one, so only the port can answer (issue 1242).
nros_platform_wake_park_handles_us⚠
phase-521 W3 (RFC-0113 D3) — park on the wake object AND on OS handles.
nros_platform_wake_park_until_us⚠
phase-436 W7 — OPTIONAL microsecond park, the ParkUntilFn a port may install through nros_cpp_executor_set_park_primitive.
nros_platform_wake_signal⚠
nros_platform_wake_signal_from_isr⚠
nros_platform_wake_storage_align⚠
nros_platform_wake_storage_size⚠
Opaque-storage sizing. Both helpers are pure functions (no global state) and may be called before nros_platform_wake_init.
nros_platform_wake_wait_ms⚠
nros_platform_yield_now⚠
Voluntarily yield the current task / thread. On bare-metal, core::hint::spin_loop() is acceptable; on RTOSes use the native cooperative-yield primitive (k_yield, vPortYield, tx_thread_relinquish, sched_yield, …). RTOS yields are not ISR-safe.

Type Aliases§

nros_platform_log_flush_fn_t
nros_platform_log_writer_fn_t
nros_platform_ret_t
nros_platform_timer_callback_t
@file platform_timer.h @brief Canonical C ABI for the nros platform timer surface.