|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
RAM byte-stream sink – append into a caller-owned buffer. More...
#include "ra8_io_stream_ram.h"#include <stddef.h>#include <stdint.h>#include <string.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_io_stream_backend.h"Go to the source code of this file.
Functions | |
| static ra8_err_t | internal_ram_write (void *ctx, const uint8_t *buf, uint32_t len, uint32_t *out_written) |
| RAM sink: append bytes into the caller buffer. | |
| ra8_err_t | ra8_io_stream_ram_init (ra8_io_stream_t *s, ra8_io_stream_ram_state_t *state, uint8_t *buf, uint32_t cap) |
| Bind a RAM stream sink into a caller-owned stream handle. | |
| ra8_err_t | ra8_io_stream_ram_used (const ra8_io_stream_ram_state_t *state, uint32_t *out_used) |
| Report how many bytes have been captured into the RAM sink. | |
Variables | |
| static const char *const | s_tag = "ra8_io_stream_ram" |
| Module log tag. | |
| static const ra8_io_stream_iface_t | s_ram_iface |
| RAM stream sink vtable. | |
RAM byte-stream sink – append into a caller-owned buffer.
Reference sink implementation of ra8_io_stream_iface. Writes are a bounds-checked memcpy into the caller buffer; a full buffer reports k_ra8_err_no_mem. Pure memory access – identical on host and target.
Definition in file ra8_io_stream_ram.c.
|
static |
RAM sink: append bytes into the caller buffer.
Copies as many bytes as fit, advances the captured length, and reports the accepted count. Returns k_ra8_err_no_mem when not all bytes fit.
| [in] | ctx | RAM sink state (as a void cookie). |
| [in] | buf | Source bytes. |
| [in] | len | Number of bytes to append. |
| [out] | out_written | Accepted byte count, or NULL. |
| k_ra8_ok | All bytes appended. |
| k_ra8_err_null_ptr | ctx or buf was NULL. |
| k_ra8_err_no_mem | The buffer could not accept all bytes. |
Definition at line 58 of file ra8_io_stream_ram.c.
References ra8_io_stream_ram_state_t::buf, ra8_io_stream_ram_state_t::cap, k_ra8_err_no_mem, k_ra8_ok, ra8_io_stream_ram_state_t::len, memcpy(), RA8_CHECK_NULL_PTR, and s_tag.
|
nodiscard |
Bind a RAM stream sink into a caller-owned stream handle.
| [out] | s | Stream handle to bind (zero-initialised by the caller). |
| [out] | state | Caller-owned sink state to populate. |
| [in] | buf | Capture buffer of cap bytes. |
| [in] | cap | Buffer capacity in bytes (>= 1). |
| k_ra8_ok | Sink bound; s is usable. |
| k_ra8_err_null_ptr | s, state, or buf was NULL. |
| k_ra8_err_invalid_size | cap was zero. |
Definition at line 80 of file ra8_io_stream_ram.c.
References ra8_io_stream_ram_state_t::buf, ra8_io_stream_ram_state_t::cap, k_ra8_err_invalid_size, ra8_io_stream_ram_state_t::len, RA8_CHECK_NULL_PTR, ra8_io_stream_bind(), s_ram_iface, and s_tag.
Referenced by main().
|
nodiscard |
Report how many bytes have been captured into the RAM sink.
| [in] | state | Bound RAM sink state. |
| [out] | out_used | Number of captured bytes. |
| k_ra8_ok | *out_used populated. |
| k_ra8_err_null_ptr | state or out_used was NULL. |
Definition at line 97 of file ra8_io_stream_ram.c.
References k_ra8_ok, ra8_io_stream_ram_state_t::len, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_swap_replay_capture().
|
static |
RAM stream sink vtable.
flush is NULL: writes land in memory.
Definition at line 75 of file ra8_io_stream_ram.c.
|
static |
Module log tag.
Definition at line 29 of file ra8_io_stream_ram.c.