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.
lenis 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
sizebytes; returnNULLon 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_fdand the device carries CAN FD; zero otherwise, a closed handle included. - nros_
platform_ ⚠can_ open - Open
deviceinto the caller’s handle storage.deviceNULL opens the image’s device (the one its board stack names); a non-NULL name opens that device instead.want_fdnon-zero asks for CAN FD: afterwardsnros_platform_can_fd_activesays whether FD is active. A backend that can tell at open that the device does not carry FD (SocketCAN: the interface MTU) fails here withNROS_PLATFORM_CAN_ENOFD; one that learns it from the device’s mode (Zephyr: the controller’sCAN_MODE_FD, set at bring-up) opens and reports it throughfd_active. Either way an FD send on a handle whose FD is not active returnsNROS_PLATFORM_CAN_ENOFD. - nros_
platform_ ⚠can_ recv - Receive one frame, waiting at most
timeout_us(0: poll).NROS_PLATFORM_CAN_EAGAINwhen nothing arrived;NROS_PLATFORM_CAN_ENOTSUPon a backend without receive. - nros_
platform_ ⚠can_ send - Send one frame, waiting at most
timeout_usfor the controller to take it (0: do not wait). See the file comment for what0means. - 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
mand block oncvuntil signalled or until the absolute monotonic deadlineabstime, in MILLISECONDS on thenros_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 asnros_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.
NULLis a no-op. - nros_
platform_ ⚠epoch_ us - Microseconds since the UNIX EPOCH (1970-01-01T00:00:00Z), or
0when this platform has no wall-clock source. - nros_
platform_ ⚠heap_ total_ bytes - Total managed heap size in bytes (used + free), or
0if unknown. - nros_
platform_ ⚠heap_ used_ bytes - Bytes currently allocated from the platform heap, or
0if 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
wakeandtask. 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
lenbytes atbufwith 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. Seerandom_u8notes. - nros_
platform_ ⚠random_ u32 - Random
u32. Seerandom_u8notes. - nros_
platform_ ⚠random_ u64 - Random
u64. Seerandom_u8notes. - nros_
platform_ ⚠realloc - Resize the block at
ptrtosizebytes. Equivalent to libcrealloc:NULLptr → fresh alloc;0size → free + returnNULL. Preserves contents up tomin(old, new). - nros_
platform_ ⚠register_ log_ writer - nros_
platform_ ⚠sleep_ ms - Sleep at least
msmilliseconds. - nros_
platform_ ⚠sleep_ s - Sleep at least
sseconds. - nros_
platform_ ⚠sleep_ us - Sleep at least
usmicroseconds. Spin if the platform clock has no sub-millisecond timer. - nros_
platform_ ⚠socket_ accept - Accept a pending connection from
sock_inintosock_out. - nros_
platform_ ⚠socket_ close - Socket-layer shutdown + close. Distinct from
nros_platform_tcp_closebecause 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
attrwith the defaults — equivalent to passingNULLtotask_init. - nros_
platform_ ⚠task_ cancel - Request
taskto terminate at the next cancellation point. Cooperative: a task that never reaches a cancel point will not stop. - nros_
platform_ ⚠task_ detach - Mark
taskas 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 aftertask_joinortask_detach + exit. - nros_
platform_ ⚠task_ init - Spawn a new task.
taskis opaque caller-provided storage (size fromnros_platform_task_storage_size);attris anros_platform_task_attr_t *, orNULLfor every default;entryis the task entry point;argis forwarded toentry. - nros_
platform_ ⚠task_ join - Block until
taskexits. 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
0if this port cannot report it. - nros_
platform_ ⚠task_ stack_ unused_ bytes_ upto - The same query, capped:
min(unused, limit), reading at mostlimitbytes 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 beforenros_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 atep. 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_openwhose connect gives up afterconnect_timeout_ms.timeout_mskeeps its meaning innros_platform_tcp_open. A negativeconnect_timeout_msstates no bound: the call then behaves exactly asnros_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
lenbytes. Returns bytes received (0: nothing yet),NROS_PLATFORM_NET_SOCKET_EOFwhen the peer closed the stream, orNROS_PLATFORM_NET_SOCKET_ERRORon error. - nros_
platform_ ⚠tcp_ read_ exact - Read exactly
lenbytes. Returnslenon success,NROS_PLATFORM_NET_SOCKET_EOFwhen the peer closed the stream first, orNROS_PLATFORM_NET_SOCKET_ERRORon error. - nros_
platform_ ⚠tcp_ send - Send up to
lenbytes, waiting at most about the socket’s timeout (thetimeout_msit was opened with) for the stack to take them. Returns the bytes taken, which may be fewer thanlenand is0when the stack took none in that time, orNROS_PLATFORM_NET_SOCKET_ERRORwhen 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 withtimeout_ms == 0states no bound. - nros_
platform_ ⚠tcp_ set_ rx_ notify - Install (
notify != NULL) or remove the receive notification on a connected TCP socket: the stack callsnotify(ctx)each time data is queued on it, from the stack’s own context (NetX’s IP thread), sonotifymust only signal. Data already queued at install calls it once before this returns; once a removal returns, the previousnotifyis never called again. A zenoh session in CALLER mode oversockreports this asNROS_RMW_READINESS_NOTIFY. - nros_
platform_ ⚠time_ now_ ns - Wall-clock nanoseconds since the Unix epoch, or
0if 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 aftertimeout_usmicroseconds. Returns the platform-native handle on success, NULL on failure. - nros_
platform_ ⚠timer_ create_ periodic - Register a periodic timer that invokes
callback(user_data)everyperiod_usmicroseconds. 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_datais 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 asNROS_RMW_READINESS_WAITABLE, and the executor parks on it (nros_platform_wake_park_handles_us) instead of blocking inread. 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
lenbytes toendpoint. - nros_
platform_ ⚠udp_ set_ recv_ timeout - Set the recv timeout in milliseconds;
0means block indefinitely. - nros_
platform_ ⚠udp_ set_ rx_ notify - Install (
notify != NULL) or remove the receive notification onsock: the stack callsnotify(ctx)each time a datagram is queued on it, from the stack’s own context (lwIP’s tcpip thread, NetX’s IP thread), sonotifymust only signal. Data already queued at install calls it once before this returns; once a removal returns, the previousnotifyis never called again. An RMW session oversockreports this asNROS_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_uscan 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
ParkUntilFna port may install throughnros_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.