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_can_frame_t
One CAN or CAN FD frame. len is the payload in BYTES, never a DLC: the backend maps bytes to the wire DLC, and a length that is not a valid size is refused, never padded (padding is payload layout, the application’s).
nros_platform_can_t
A CAN handle: caller storage, the backend’s state lives inside it.
nros_platform_task_attr_t
nros_wall_clock_state_t
What the wall-clock stamps mean right now.

Constants§

NROS_PLATFORM_CAN_CLASSIC_MAX_LEN
NROS_PLATFORM_CAN_EAGAIN
NROS_PLATFORM_CAN_EBUSOFF
NROS_PLATFORM_CAN_EINVAL
NROS_PLATFORM_CAN_EIO
NROS_PLATFORM_CAN_ENODEV
NROS_PLATFORM_CAN_ENOFD
NROS_PLATFORM_CAN_ENOTOPEN
NROS_PLATFORM_CAN_ENOTSUP
NROS_PLATFORM_CAN_EXT_ID_MAX
NROS_PLATFORM_CAN_FD_MAX_LEN
NROS_PLATFORM_CAN_FLAGS_KNOWN
NROS_PLATFORM_CAN_FLAG_BRS
NROS_PLATFORM_CAN_FLAG_EXT
NROS_PLATFORM_CAN_FLAG_FD
NROS_PLATFORM_CAN_OK
NROS_PLATFORM_CAN_OPAQUE_U64S
NROS_PLATFORM_CAN_SEND_WAIT_TX
NROS_PLATFORM_CAN_STD_ID_MAX
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_can_close⚠
Close the handle. Idempotent; a closed or never-opened handle is a no-op.
nros_platform_can_fd_active⚠
Non-zero when the handle was opened with want_fd and the device carries CAN FD; zero otherwise, a closed handle included.
nros_platform_can_open⚠
Open device into the caller’s handle storage. device NULL opens the image’s device (the one its board stack names); a non-NULL name opens that device instead. want_fd non-zero asks for CAN FD: afterwards nros_platform_can_fd_active says whether FD is active. A backend that can tell at open that the device does not carry FD (SocketCAN: the interface MTU) fails here with NROS_PLATFORM_CAN_ENOFD; one that learns it from the device’s mode (Zephyr: the controller’s CAN_MODE_FD, set at bring-up) opens and reports it through fd_active. Either way an FD send on a handle whose FD is not active returns NROS_PLATFORM_CAN_ENOFD.
nros_platform_can_recv⚠
Receive one frame, waiting at most timeout_us (0: poll). NROS_PLATFORM_CAN_EAGAIN when nothing arrived; NROS_PLATFORM_CAN_ENOTSUP on a backend without receive.
nros_platform_can_send⚠
Send one frame, waiting at most timeout_us for the controller to take it (0: do not wait). See the file comment for what 0 means.
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⚠
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. 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.
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_open_within⚠
nros_platform_tcp_open whose connect gives up after connect_timeout_ms. timeout_ms keeps its meaning in nros_platform_tcp_open. A negative connect_timeout_ms states no bound: the call then behaves exactly as nros_platform_tcp_open, connect limit included. zenoh-pico passes what is left of a client’s connect budget ([knobs.zenoh.limits] connect_timeout_ms), so a peer that drops the SYN ends the attempt at the budget instead of at the stack’s own SYN-retry limit. A port that cannot bound its connect says so in its implementation and keeps its own limit.
nros_platform_tcp_read⚠
Read up to len bytes. Returns bytes received (0: nothing yet), NROS_PLATFORM_NET_SOCKET_EOF when the peer closed the stream, or NROS_PLATFORM_NET_SOCKET_ERROR on error.
nros_platform_tcp_read_exact⚠
Read exactly len bytes. Returns len on success, NROS_PLATFORM_NET_SOCKET_EOF when the peer closed the stream first, or NROS_PLATFORM_NET_SOCKET_ERROR on error.
nros_platform_tcp_send⚠
Send up to len bytes, waiting at most about the socket’s timeout (the timeout_ms it was opened with) for the stack to take them. Returns the bytes taken, which may be fewer than len and is 0 when the stack took none in that time, or NROS_PLATFORM_NET_SOCKET_ERROR when the connection is broken. It never waits for a peer that has stopped reading: a caller that needs every byte loops, and decides how long a stall it tolerates (zenoh-pico: Z_TRANSPORT_TX_WAIT_BEFORE_CLOSE). A socket opened with timeout_ms == 0 states no bound.
nros_platform_tcp_set_rx_notify⚠
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⚠
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⚠
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.
nros_platform_wake_park_handles_us⚠
Park on the wake object AND on OS handles.
nros_platform_wake_park_until_us⚠
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_wall_clock_state⚠
The wall clock’s state, for an application that must not publish unstamped data: ask before publishing, rather than a board hook deciding by exiting.
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.