ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_stream_backend.h File Reference

Public implementer contract for ra8_io byte-stream backends. More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_io_stream.h"
Include dependency graph for ra8_io_stream_backend.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ra8_io_stream_iface
 Opaque to stream users; backend implementers use the public backend contract in ra8_io_stream_backend.h. More...

Functions

ra8_err_t ra8_io_stream_bind (ra8_io_stream_t *stream, const ra8_io_stream_iface_t *iface, void *context)
 Bind a backend vtable and caller-owned state into a stream handle.

Detailed Description

Public implementer contract for ra8_io byte-stream backends.

Tag
[Ring 4 / PAL] {World: NS}

Defines the narrow backend vtable and binding helper needed by an out-of-tree or platform adapter. Consumers continue to include only ra8_io_stream.h; implementers include this header, define one immutable vtable, and bind it to caller-owned state. Publishing this seam prevents a POSIX, RTOS, or board adapter from reaching into a sibling library's private src/ directory.

Since
0.1.0

Definition in file ra8_io_stream_backend.h.

Function Documentation

◆ ra8_io_stream_bind()

ra8_err_t ra8_io_stream_bind ( ra8_io_stream_t * stream,
const ra8_io_stream_iface_t * iface,
void * context )
nodiscard

Bind a backend vtable and caller-owned state into a stream handle.

Parameters
[out]streamStream handle to initialize.
[in]ifaceImmutable backend operations.
[in,out]contextBackend-owned state retained by the handle.
Returns
Canonical binding status.
Return values
k_ra8_okThe handle is bound and ready.
k_ra8_err_null_ptrA required pointer is null.
k_ra8_err_invalid_argThe mandatory write operation is absent.
Precondition
iface and context outlive every operation through stream.
The caller exclusively owns stream while binding it.
Postcondition
Success replaces stream with the requested binding.
Failure leaves stream unchanged.
Note
Thread-safe across distinct handles and backend states.
Since
0.1.0

Definition at line 81 of file ra8_io_stream.c.

References k_ra8_err_invalid_arg, k_ra8_err_null_ptr, k_ra8_ok, and ra8_io_stream_iface::write.

Referenced by ra8_io_stream_blockdev_init(), ra8_io_stream_posix_init(), ra8_io_stream_ram_init(), ra8_io_stream_uart_init(), and ra8_io_stream_usbcdc_init().