30static const char*
const s_tag =
"ra8_io_blockdev_ram";
38typedef enum : uint32_t {
265 uint32_t block_count,
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_supported
Requested feature not compiled in, not wired, or not supported by this MCU variant.
@ k_ra8_err_out_of_range
Sensor or peripheral output out of valid range.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
void * memset(void *dst, int value, size_t n)
Fill memory with a constant byte value.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
ra8_io block-device fabric – one LBA vtable across every storage medium.
struct ra8_io_blockdev_iface ra8_io_blockdev_iface_t
@ k_ra8_io_erase_value_zero
Block reads back as 0x00 after erase.
@ k_ra8_io_block_size_bytes
Bytes per logical block (the only size).
Backend implementation contract for the ra8_io block-device fabric.
ra8_err_t ra8_io_blockdev_ram_init(ra8_io_blockdev_t *bd, ra8_io_blockdev_ram_state_t *state, uint8_t *storage, uint32_t block_count, bool read_only)
Bind a RAM block-device backend into a caller-owned handle.
static ra8_err_t internal_ram_bounds(const ra8_io_blockdev_ram_state_t *st, uint32_t lba, uint32_t count)
Reject an out-of-range [lba, lba+count) block range.
static ra8_err_t internal_ram_get_caps(const void *ctx, ra8_io_blockdev_caps_t *out)
RAM backend: report medium capabilities.
static ra8_err_t internal_ram_read(void *ctx, uint32_t lba, uint32_t count, uint8_t *buf)
RAM backend: read count blocks at lba into buf.
static ra8_err_t internal_ram_erase(void *ctx, uint32_t lba, uint32_t count)
RAM backend: erase (zero-fill) count blocks at lba.
ra8_io_ram_const_t
RAM-backend layout constants.
@ k_ra8_io_ram_erase_unit_blocks
One logical block per erase unit.
@ k_ra8_io_ram_min_blocks
Smallest legal device size.
static ra8_err_t internal_ram_write(void *ctx, uint32_t lba, uint32_t count, const uint8_t *buf)
RAM backend: write count blocks from buf at lba.
static const ra8_io_blockdev_iface_t s_ram_iface
RAM backend vtable.
ra8_io block-device backend over a caller-owned RAM buffer.
static ra8_err_t internal_ram_write(void *context, const uint8_t *data, uint16_t length, uint16_t *written)
Append one complete transfer fragment to private RAM storage.
Static properties a backend reports about its medium.
uint32_t erase_unit_blocks
Erase granularity, in logical blocks.
uint32_t block_count
Total addressable logical blocks.
bool must_erase_before_write
true => program needs a prior erase.
bool read_only
true => writes/erases are rejected.
uint8_t erase_value
Post-erase byte (ra8_io_erase_value_t).
uint16_t logical_block_bytes
Logical block size (always 512).
uint32_t program_size_bytes
Minimum program granularity in bytes.
Caller-owned private state for a RAM block device.
uint8_t * storage
Caller-owned backing buffer (private).
bool read_only
true => writes and erases are rejected (private).
uint32_t block_count
Number of 512-byte logical blocks (private).
Caller-allocated block-device handle binding a backend to its context.
const ra8_io_blockdev_iface_t * iface
Bound backend vtable (private).
void * ctx
Backend-private context (private).