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

Private exact-write engine for the POSIX stream adapter. More...

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

Go to the source code of this file.

Typedefs

typedef int64_t(* ra8_io_stream_posix_write_fn_t) (void *context, int fd, const uint8_t *bytes, uint32_t length, int *out_errno)
 Injected descriptor-write primitive used by the exact-write loop.

Functions

ra8_err_t priv_ra8_io_stream_posix_write_loop (int fd, const uint8_t *bytes, uint32_t length, uint32_t *out_written, ra8_io_stream_posix_write_fn_t writer, void *writer_context)
 Complete one descriptor write through an injected raw primitive.

Detailed Description

Private exact-write engine for the POSIX stream adapter.

Tag
[Ring 4 / Host Port] {World: Host}

Declares the cross-translation-unit private write loop and its injected raw syscall shape. Production supplies write(2); focused tests supply bounded deterministic results without mutable global hooks.

Since
0.1.0

Definition in file ra8_io_stream_posix_internal.h.

Typedef Documentation

◆ ra8_io_stream_posix_write_fn_t

typedef int64_t(* ra8_io_stream_posix_write_fn_t) (void *context, int fd, const uint8_t *bytes, uint32_t length, int *out_errno)

Injected descriptor-write primitive used by the exact-write loop.

Definition at line 31 of file ra8_io_stream_posix_internal.h.

Function Documentation

◆ priv_ra8_io_stream_posix_write_loop()

ra8_err_t priv_ra8_io_stream_posix_write_loop ( int fd,
const uint8_t * bytes,
uint32_t length,
uint32_t * out_written,
ra8_io_stream_posix_write_fn_t writer,
void * writer_context )

Complete one descriptor write through an injected raw primitive.

Repeats interrupted attempts up to the fixed adapter ceiling, accumulates only proven progress, and rejects zero or over-reported successful writes.

Parameters
[in]fdWritable descriptor forwarded to writer.
[in]bytesSource bytes.
[in]lengthRequested byte count.
[out]out_writtenBytes accepted before success or failure.
[in]writerRaw write primitive.
[in,out]writer_contextOpaque context forwarded to writer.
Returns
Canonical transfer status.
Return values
k_ra8_okExactly length bytes were accepted.
k_ra8_err_retry_limitThe bounded interruption ceiling was exceeded.
k_ra8_err_protocol_errorThe writer reported impossible progress.
Precondition
bytes spans length readable bytes.
out_written and writer are non-null.
Postcondition
Success publishes exactly length accepted bytes.
Failure publishes only the proven accepted prefix.
Note
Thread-safe across distinct writer contexts.
Since
0.1.0

Definition at line 146 of file ra8_io_stream_posix.c.

References internal_write_loop_step(), k_ra8_err_null_ptr, k_ra8_ok, RA8_LOOP_BOUND, and RA8_PRIV.

Referenced by internal_posix_write().