ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_stream.h
Go to the documentation of this file.
1
38
39#pragma once
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#include <stdint.h>
46
47#include "ra8_err.h"
48
63
78typedef struct {
80 void* ctx;
82
115[[nodiscard]] ra8_err_t
116ra8_io_stream_write(ra8_io_stream_t* s, const uint8_t* buf, uint32_t len, uint32_t* out_written);
117
138
160[[nodiscard]] ra8_err_t ra8_io_stream_putc(ra8_io_stream_t* s, char c);
161
190[[nodiscard]] ra8_err_t ra8_io_stream_puts(ra8_io_stream_t* s, const char* str);
191
213[[nodiscard]] ra8_err_t ra8_io_stream_put_u32(ra8_io_stream_t* s, uint32_t value);
214
230[[nodiscard]] ra8_err_t ra8_io_stream_put_u64(ra8_io_stream_t* s, uint64_t value);
231
255[[nodiscard]] ra8_err_t
256ra8_io_stream_put_hex(ra8_io_stream_t* s, uint32_t value, uint8_t min_digits);
257
258#ifdef __cplusplus
259}
260#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t ra8_io_stream_write(ra8_io_stream_t *s, const uint8_t *buf, uint32_t len, uint32_t *out_written)
Write len bytes to the bound sink.
ra8_err_t ra8_io_stream_puts(ra8_io_stream_t *s, const char *str)
Write a NUL-terminated string (without the NUL) to the bound sink.
ra8_err_t ra8_io_stream_put_u32(ra8_io_stream_t *s, uint32_t value)
Write value as unsigned decimal ASCII (no leading zeros).
ra8_err_t ra8_io_stream_flush(ra8_io_stream_t *s)
Flush any sink-side buffering to its destination.
struct ra8_io_stream_iface ra8_io_stream_iface_t
ra8_err_t ra8_io_stream_put_u64(ra8_io_stream_t *s, uint64_t value)
Write value as unsigned 64-bit decimal ASCII without leading zeros.
ra8_err_t ra8_io_stream_putc(ra8_io_stream_t *s, char c)
Write a single byte to the bound sink.
ra8_err_t ra8_io_stream_put_hex(ra8_io_stream_t *s, uint32_t value, uint8_t min_digits)
Write value as lowercase hex ASCII, zero-padded to min_digits.
Opaque to stream users; backend implementers use the public backend contract in ra8_io_stream_backend...
Caller-allocated byte-stream handle binding a sink to its context.
const ra8_io_stream_iface_t * iface
Bound sink vtable (private).
void * ctx
Sink-private context (private).