ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_blockdev_cache.h
Go to the documentation of this file.
1
39
40#pragma once
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#include <stdint.h>
47
48#include "ra8_err.h"
49#include "ra8_io_blockdev.h"
50
60typedef struct {
61 uint32_t lba;
62 uint32_t last_use;
63 bool valid;
65
77typedef struct {
79 uint8_t* data;
81 uint32_t n_slots;
82 uint32_t clock;
83 uint32_t hits;
84 uint32_t misses;
86
113 const ra8_io_blockdev_t* under,
114 uint8_t* data,
116 uint32_t n_slots);
117
139 uint32_t* out_hits,
140 uint32_t* out_misses);
141
142#ifdef __cplusplus
143}
144#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_io block-device fabric – one LBA vtable across every storage medium.
ra8_err_t ra8_io_blockdev_cache_init(ra8_io_blockdev_t *bd, ra8_io_blockdev_cache_state_t *state, const ra8_io_blockdev_t *under, uint8_t *data, ra8_io_blockdev_cache_slot_t *slots, uint32_t n_slots)
Bind a caching block device over an existing backend.
ra8_err_t ra8_io_blockdev_cache_stats(const ra8_io_blockdev_cache_state_t *state, uint32_t *out_hits, uint32_t *out_misses)
Report the cache hit/miss counters.
Per-sector cache metadata (one caller-owned array entry per slot).
uint32_t lba
Cached logical block address (valid only if in use).
bool valid
true => this slot holds a cached sector.
uint32_t last_use
LRU stamp; larger == more recently used.
Caller-owned private state for a caching block device.
uint8_t * data
n_slots * 512 cache bytes.
uint32_t misses
Read cache misses so far.
const ra8_io_blockdev_t * under
Wrapped backend (private).
uint32_t clock
Monotonic LRU access counter.
uint32_t hits
Read cache hits so far.
uint32_t n_slots
Number of cached sectors.
ra8_io_blockdev_cache_slot_t * slots
n_slots metadata entries.
Caller-allocated block-device handle binding a backend to its context.