ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_blockdev_iface Struct Reference

Opaque to applications – backends implement this internally and export a binding helper through their own header. More...

#include <ra8_io_blockdev_backend.h>

Data Fields

ra8_err_t(* read )(void *ctx, uint32_t lba, uint32_t count, uint8_t *buf)
 Read count blocks at lba into buf.
ra8_err_t(* write )(void *ctx, uint32_t lba, uint32_t count, const uint8_t *buf)
 Write count blocks from buf at lba.
ra8_err_t(* erase )(void *ctx, uint32_t lba, uint32_t count)
 Erase count blocks at lba.
ra8_err_t(* get_caps )(const void *ctx, ra8_io_blockdev_caps_t *out)
 Fill *out with the medium capabilities.
ra8_err_t(* sync )(void *ctx)
 Commit any write buffering.

Detailed Description

Opaque to applications – backends implement this internally and export a binding helper through their own header.

One vtable per storage backend.

The concrete vtable layout lives in ra8_io_blockdev_backend.h. Application consumers never construct one; they call a backend's _init() helper, which binds the backend's const vtable into a caller-owned ra8_io_blockdev_t. Separate backend and adapter libraries include the implementer-facing header rather than reaching into libs/ra8_io/src/.

Since
0.1.0

Each callback receives the backend's opaque ctx so backends keep their state private.

read, write, and get_caps are mandatory. erase and sync may be NULL for media that have no erase concept or no write buffering; the dispatcher maps a NULL erase to k_ra8_err_not_supported and a NULL sync to success.

Invariant
read, write, and get_caps are non-NULL.
Since
0.1.0

Definition at line 52 of file ra8_io_blockdev_backend.h.

Field Documentation

◆ erase

ra8_err_t(* ra8_io_blockdev_iface::erase) (void *ctx, uint32_t lba, uint32_t count)

Erase count blocks at lba.

May be NULL (no erase concept).

Definition at line 60 of file ra8_io_blockdev_backend.h.

Referenced by ra8_io_blockdev_erase().

◆ get_caps

ra8_err_t(* ra8_io_blockdev_iface::get_caps) (const void *ctx, ra8_io_blockdev_caps_t *out)

Fill *out with the medium capabilities.

Definition at line 63 of file ra8_io_blockdev_backend.h.

Referenced by ra8_io_blockdev_get_caps().

◆ read

ra8_err_t(* ra8_io_blockdev_iface::read) (void *ctx, uint32_t lba, uint32_t count, uint8_t *buf)

Read count blocks at lba into buf.

Definition at line 54 of file ra8_io_blockdev_backend.h.

Referenced by ra8_io_blockdev_read().

◆ sync

ra8_err_t(* ra8_io_blockdev_iface::sync) (void *ctx)

Commit any write buffering.

May be NULL (nothing buffered).

Definition at line 66 of file ra8_io_blockdev_backend.h.

Referenced by ra8_io_blockdev_sync().

◆ write

ra8_err_t(* ra8_io_blockdev_iface::write) (void *ctx, uint32_t lba, uint32_t count, const uint8_t *buf)

Write count blocks from buf at lba.

Definition at line 57 of file ra8_io_blockdev_backend.h.

Referenced by ra8_io_blockdev_write().


The documentation for this struct was generated from the following file: