118typedef enum : uint16_t {
135typedef enum : uint8_t {
253 uint32_t logical_blocks,
255 uint32_t physical_blocks,
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_ftl_const_t
FTL sizing and sentinel constants.
@ k_ra8_ftl_unmapped
map[] sentinel: logical block unwritten.
@ k_ra8_ftl_max_pblocks
Max physical blocks an FTL may wrap.
@ k_ra8_ftl_min_spare
Minimum spare blocks (P - L >= 1).
ra8_err_t ra8_ftl_checkpoint_load(ra8_ftl_t *ftl, const uint8_t *buf, uint32_t buf_len)
Restore FTL mapping state from a checkpoint produced by save.
ra8_err_t ra8_ftl_checkpoint_save(const ra8_ftl_t *ftl, uint8_t *buf, uint32_t buf_len)
Serialise the FTL's mapping state into a caller buffer.
ra8_ftl_pstate_t
Lifecycle state of one physical erase block.
@ k_ra8_ftl_pstate_free
Blank (reads as erase value); allocatable.
@ k_ra8_ftl_pstate_live
Holds current data for one logical block.
@ k_ra8_ftl_pstate_stale
Superseded; reclaimable by erase to FREE.
ra8_err_t ra8_ftl_wear_stats(const ra8_ftl_t *ftl, uint32_t *max_out, uint32_t *min_out)
Report the highest per-physical-block erase count seen so far.
ra8_err_t ra8_ftl_init(ra8_ftl_t *bd, const ra8_io_blockdev_t *raw, uint16_t *map, uint32_t logical_blocks, ra8_ftl_pblock_t *pblocks, uint32_t physical_blocks, uint8_t *scratch)
Initialise an FTL over an erase-before-write block device.
ra8_err_t ra8_ftl_checkpoint_size(const ra8_ftl_t *ftl, uint32_t *size_out)
Report the buffer size a checkpoint of this FTL requires, in bytes.
ra8_err_t ra8_ftl_as_blockdev(ra8_ftl_t *ftl, ra8_io_blockdev_t *out)
Expose an initialised FTL as a free-overwrite ra8_io_blockdev_t.
ra8_err_t ra8_ftl_phys_of(const ra8_ftl_t *ftl, uint32_t lbn, uint16_t *phys_out)
Report the physical block currently backing a logical block.
ra8_io block-device fabric – one LBA vtable across every storage medium.
Caller-owned metadata for one physical erase block.
uint32_t erase_count
Cumulative erases of this block (wear metric).
uint8_t state
ra8_ftl_pstate_t lifecycle state (private).
Caller-allocated FTL handle binding the wrapper to the raw device.
ra8_ftl_pblock_t * pblocks
Per-physical metadata (private).
uint32_t physical_blocks
Blocks in the raw dev (private).
uint8_t * scratch
512-byte copy scratch (private).
uint16_t * map
logical->physical map (private).
uint8_t erase_value
Raw medium erase byte (private).
const ra8_io_blockdev_t * raw
Underlying erase-before-write dev.
uint32_t logical_blocks
Blocks presented to FAT (private).
Caller-allocated block-device handle binding a backend to its context.