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

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

#include <ra8_io_stream_backend.h>

Data Fields

ra8_err_t(* write )(void *ctx, const uint8_t *buf, uint32_t len, uint32_t *out_written)
 Write len bytes from buf, reporting the accepted count.
ra8_err_t(* flush )(void *ctx)
 Commit any buffering.

Detailed Description

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

One immutable vtable per byte-sink backend.

Ordinary stream users never construct this table; they call a sink's _init() helper. Portable backend implementers include ra8_io_stream_backend.h, define an immutable table, and bind it into a caller-owned ra8_io_stream_t with ra8_io_stream_bind.

Since
0.1.0

write is mandatory. It must publish an accepted count no larger than len; success requires the count to equal len. flush may be NULL for an unbuffered sink, which the facade maps to success.

Invariant
write is non-NULL.
Since
0.1.0

Definition at line 45 of file ra8_io_stream_backend.h.

Field Documentation

◆ flush

ra8_err_t(* ra8_io_stream_iface::flush) (void *ctx)

Commit any buffering.

May be NULL (nothing buffered).

Definition at line 53 of file ra8_io_stream_backend.h.

Referenced by ra8_io_stream_flush().

◆ write

ra8_err_t(* ra8_io_stream_iface::write) (void *ctx, const uint8_t *buf, uint32_t len, uint32_t *out_written)

Write len bytes from buf, reporting the accepted count.

out_written receives the bytes the sink consumed (<= len).

Definition at line 50 of file ra8_io_stream_backend.h.

Referenced by ra8_io_stream_bind(), and ra8_io_stream_write().


The documentation for this struct was generated from the following file: