36typedef enum : uint32_t {
49typedef enum : uint32_t {
62typedef enum : uint8_t {
76typedef enum : uint32_t {
103 for (uint32_t i = 0U; i < len; i++) {
104 buf[i] = (uint8_t)(seed + (uint8_t)i);
127 if (buf ==
nullptr) {
133 for (uint32_t i = 0U; i < len; i++) {
134 if (buf[i] != (uint8_t)(seed + (uint8_t)i)) {
172 .overprovision_pct = 0U,
488 .evicted_stayed_gone =
false,
489 .pin_survived =
false,
static ra8_err_t internal_demo_put_and_verify(ra8_cache_store_t *st, uint32_t key, uint8_t seed, uint32_t len, const cache_store_demo_cfg_t *cfg)
Put a blob, then read it back whole and verify it byte-identical.
static ra8_err_t internal_demo_phase_remount(const cache_store_demo_cfg_t *cfg, cache_store_demo_result_t *out)
Simulate a reboot: re-mount over the same media and confirm survival.
static ra8_err_t internal_demo_get_and_verify(const ra8_cache_store_t *st, uint32_t key, uint8_t seed, uint32_t len, const cache_store_demo_cfg_t *cfg)
Read a sealed blob back and verify it byte-identical (no put).
demo_key_t
Content keys for the demo's cached blobs (source CRC-32 stand-ins).
@ k_demo_key_tile_c
Render tile C (survivor).
@ k_demo_key_tile_a
Render tile A (survivor).
@ k_demo_key_cover
Open-book cover glyph atlas (pinned).
@ k_demo_key_tile_d
Render tile D (re-put after eviction).
@ k_demo_key_tile_b
Render tile B (forcibly evicted).
demo_count_t
Expected live-entry count after the remount.
@ k_demo_survivors
Entries expected live after the remount.
static ra8_err_t internal_demo_phase_evict(ra8_cache_store_t *st)
Pin one entry, force an eviction, and prove the invariants hold.
static ra8_err_t internal_demo_build_cfg(const cache_store_demo_cfg_t *in, bool format, ra8_cache_store_cfg_t *out)
Build an ra8_cache_store init config from the demo config.
static ra8_err_t internal_demo_verify_survivors(const ra8_cache_store_t *st, const cache_store_demo_cfg_t *cfg)
Read-verify the four entries expected to survive the remount.
ra8_err_t cache_store_demo_run(const cache_store_demo_cfg_t *cfg, cache_store_demo_result_t *out)
Run the full ra8_cache_store on-media cache demonstration, end to end.
static void internal_demo_fill(uint8_t *buf, uint32_t len, uint8_t seed)
Fill buf with the demo's deterministic byte ramp.
static bool internal_demo_matches(const uint8_t *buf, uint32_t len, uint8_t seed)
Test whether buf holds the demo's deterministic byte ramp.
static ra8_err_t internal_demo_phase_seed(ra8_cache_store_t *st, const cache_store_demo_cfg_t *cfg)
Seed the store: put + read-verify the four demo blobs.
demo_len_t
Payload lengths (bytes) for the demo blobs; several cross a sector.
@ k_demo_len_tile_a
Tile A length.
@ k_demo_len_tile_d
Tile D length.
@ k_demo_len_tile_c
Tile C length.
@ k_demo_len_tile_b
Tile B length.
@ k_demo_len_cover
Cover atlas length.
demo_seed_t
Per-blob deterministic fill seeds (a distinct byte ramp per key).
@ k_demo_seed_tile_b
Tile B seed.
@ k_demo_seed_tile_c
Tile C seed.
@ k_demo_seed_cover
Cover atlas seed.
@ k_demo_seed_tile_d
Tile D seed.
@ k_demo_seed_tile_a
Tile A seed.
Hardware-free driver for the ra8_cache_store on-media cache demo (#257).
@ k_cache_store_demo_stage_closed
Checkpointed + clean-closed.
@ k_cache_store_demo_stage_none
Nothing ran yet.
@ k_cache_store_demo_stage_persisted
Survivors + pin confirmed on media.
@ k_cache_store_demo_stage_reused
Re-put into the reclaimed sectors.
@ k_cache_store_demo_stage_mounted
Store formatted + mounted.
@ k_cache_store_demo_stage_seeded
Entries put + read-verified.
@ k_cache_store_demo_stage_remounted
Re-opened over the same media.
@ k_cache_store_demo_stage_evicted
Pinned one, forced an eviction.
@ k_cache_store_demo_err_remount
Re-mount over the same media failed.
@ k_cache_store_demo_err_evict
Eviction / survivor / pin-guard failed.
@ k_cache_store_demo_err_seed
A put or its read-back verify failed.
@ k_cache_store_demo_err_persist
A survivor / eviction / pin did not.
@ k_cache_store_demo_err_arg
NULL config / result / buffer.
@ k_cache_store_demo_ok
All stages passed.
@ k_cache_store_demo_err_mount
Format + mount failed.
@ k_cache_store_demo_err_reuse
Re-put into reclaimed sectors failed.
@ k_cache_store_demo_err_close
Checkpoint + close failed.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Persistent key(CRC32)->blob cache for compiled .rabook containers,built on the vendored,...
ra8_err_t ra8_cache_store_close(ra8_cache_store_t *store)
Checkpoint, set the clean-shutdown marker, and close the store.
ra8_err_t ra8_cache_store_init(ra8_cache_store_t *store, const ra8_cache_store_cfg_t *cfg)
Bind a LevelX NOR flash instance and mount (or format) the store.
ra8_err_t ra8_cache_store_pin(ra8_cache_store_t *store, uint32_t key, bool pin)
Pin or unpin an entry (pinned entries are never evicted).
ra8_err_t ra8_cache_store_read(void *ctx, uint64_t offset, uint8_t *buf, uint32_t len)
ra8_vsource_read_fn-shaped random read over an open entry.
ra8_err_t ra8_cache_store_get(const ra8_cache_store_t *store, uint32_t key, ra8_cache_store_reader_t *out_reader)
Open a sealed entry for random reads through ra8_cache_store_read.
ra8_err_t ra8_cache_store_put(ra8_cache_store_t *store, uint32_t key, const uint8_t *data, uint32_t len)
Seal a new entry once: append data under key, atomically.
ra8_err_t ra8_cache_store_evict(ra8_cache_store_t *store, uint32_t key)
Drop an entry and reclaim its sectors (no write-back).
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_busy
Resource busy – blocking operation cannot proceed.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_not_found
Requested item not found (lookup / search missed).
@ 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.
Injected dependencies + caller-owned buffers for cache_store_demo_run.
ra8_cache_store_entry_t * index
Caller-owned index array.
uint32_t scratch_bytes
Bytes at scratch.
struct LX_NOR_FLASH_STRUCT * nor_flash
Caller-owned LevelX control block.
uint16_t index_cap
Index slots (max live entries).
uint8_t * scratch
Read-back scratch (>= largest blob).
ra8_cache_store_nor_init_fn nor_driver_init
Injected physical-flash bind.
uint32_t staging_bytes
Bytes at staging (>= sector).
uint32_t logical_sectors
Usable LevelX logical-sector span.
uint8_t * staging
Caller-owned >=1-sector scratch.
Outcome + observable facts of one demo run (for the banner / asserts).
bool pin_survived
Pinned entry still refuses eviction.
cache_store_demo_status_t status
Overall verdict.
bool evicted_stayed_gone
Evicted key still absent post-remount.
uint32_t survivors
Live entries after the remount.
cache_store_demo_stage_t last_stage
Furthest stage reached.
Injected dependencies + geometry for ra8_cache_store_init.
Handle to an open entry that streams through ra8_cache_store_read.
uint32_t byte_len
Payload length (== vsource size).
Caller-owned store handle.