79struct LX_NOR_FLASH_STRUCT;
105typedef enum : uint16_t {
117typedef enum : uint8_t {
ra8_board_eth_pin_t pin
Pin.
unsigned int(* ra8_cache_store_nor_init_fn)(struct LX_NOR_FLASH_STRUCT *nor_flash)
LevelX NOR driver-initialise seam (the injected physical-flash bind).
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_sync(ra8_cache_store_t *store)
Checkpoint the index to flash (directory + clean marker not set).
ra8_cache_store_flag_t
Per-entry index-slot flag bits.
@ k_ra8_cache_store_flag_pinned
Never-evict (open book / metadata).
@ k_ra8_cache_store_flag_none
Empty slot.
@ k_ra8_cache_store_flag_in_use
Slot holds a live entry.
ra8_cache_store_geom_t
Fixed geometry + tuning constants for the store.
@ k_ra8_cache_store_sector_bytes
LevelX logical-sector size (bytes).
@ k_ra8_cache_store_overprov_pct
Default GC headroom margin (%).
@ k_ra8_cache_store_min_sectors
Minimum usable logical-sector span.
@ k_ra8_cache_store_max_overprov
Reject nonsensical margins above.
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).
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Injected dependencies + geometry for ra8_cache_store_init.
ra8_cache_store_nor_init_fn nor_driver_init
Injected physical-flash bind.
uint8_t * staging
Caller-owned >=1-sector scratch.
bool format
Format (wipe) before open.
uint32_t staging_bytes
Bytes at staging (>= sector).
struct LX_NOR_FLASH_STRUCT * nor_flash
Caller-owned LevelX control block.
const char * name
LevelX partition name (may be NULL).
ra8_cache_store_entry_t * index
Caller-owned index array.
uint16_t index_cap
Index slots (max live entries).
uint8_t overprovision_pct
GC headroom margin (0 => default).
uint32_t logical_sectors
Usable LevelX logical-sector span.
One RAM index slot: key -> {header sector, run length, payload len}.
uint8_t reserved
Padding; keeps the slot 16 bytes.
uint32_t byte_len
Payload length in bytes.
uint32_t start_sector
Logical sector of the entry header.
uint8_t flags
ra8_cache_store_flag_t bit set.
uint16_t sector_count
Run length (header + payload sectors).
uint32_t key
Content key (source CRC-32); valid iff in-use.
Handle to an open entry that streams through ra8_cache_store_read.
uint32_t byte_len
Payload length (== vsource size).
const ra8_cache_store_t * store
Parent store (flash + staging).
uint32_t data_start
First payload logical sector.
uint32_t data_sectors
Payload sector count.
Caller-owned store handle.
bool inited
True between init and close.
uint32_t data_capacity
Overprovisioned live-sector budget.
uint32_t log_start
First append-log sector.
uint16_t checkpoint_dirs
Directory sectors for the checkpoint.
uint32_t live_sectors
Sectors currently held by live entries.
uint8_t * staging
Caller-owned >=1-sector scratch.
ra8_cache_store_entry_t * index
Caller-owned index slot array.
uint16_t index_cap
Number of index slots.
uint32_t next_seq
Monotonic append sequence number.
struct LX_NOR_FLASH_STRUCT * flash
LevelX control block (borrowed).
uint8_t flash_state
RAM shadow of sector 0 (dirty/clean).
uint32_t logical_sectors
Usable LevelX logical-sector span.