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

ra8_io block-device backend over the native SDHI SD-card controller. More...

#include "ra8_err.h"
#include "ra8_io_blockdev.h"
Include dependency graph for ra8_io_blockdev_sdhi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ra8_err_t ra8_io_blockdev_sdhi_init (ra8_io_blockdev_t *bd)
 Bind the native-SDHI SD-card backend into a caller-owned handle.

Detailed Description

ra8_io block-device backend over the native SDHI SD-card controller.

Tag
[Ring 4 / PAL] {World: NS}

The SDHI backend exposes an SD/SDHC/SDXC card – driven over the RA8D2 4-bit SDHI controller through the ra8_sdcard HAL driver – as the fabric's 512-byte logical-block device. It is the high-throughput counterpart to the SD-over-SPI backend: both present the identical ra8_io_blockdev_iface, so a filesystem mounted on one mounts unchanged on the other.

The card is a singleton owned by ra8_sdcard, so this backend keeps no per-device state: it binds the const vtable into a caller-owned handle with a NULL context. The application must have brought the card up with ra8_sdcard_init before any I/O flows through the bound handle. The card has no host-visible erase primitive, so the vtable's erase slot is NULL and the fabric maps an erase request to k_ra8_err_not_supported.

Since
0.1.0

Definition in file ra8_io_blockdev_sdhi.h.

Function Documentation

◆ ra8_io_blockdev_sdhi_init()

ra8_err_t ra8_io_blockdev_sdhi_init ( ra8_io_blockdev_t * bd)
nodiscard

Bind the native-SDHI SD-card backend into a caller-owned handle.

Points bd at the SDHI vtable with a NULL context (the card is a singleton owned by ra8_sdcard). No allocation occurs; the caller owns bd. The card itself must already have been initialised with ra8_sdcard_init – this helper only wires the dispatch table and does not touch the controller.

Parameters
[out]bdHandle to bind (zero-initialised by the caller).
Returns
ra8_err_t Error code.
Return values
k_ra8_okBackend bound; bd is usable.
k_ra8_err_null_ptrbd was NULL.
Precondition
bd out-lives every call made through the device.
ra8_sdcard_init has returned k_ra8_ok before any I/O through bd.
Postcondition
On success bd dispatches to the native-SDHI backend.
On any non-ok return bd is left untouched.
Note
Not thread-safe with respect to the same device.
Since
0.1.0

Definition at line 174 of file ra8_io_blockdev_sdhi.c.

References ra8_io_blockdev_t::ctx, ra8_io_blockdev_t::iface, k_ra8_ok, RA8_CHECK_NULL_PTR, s_sdhi_iface, and s_tag.

Referenced by sdhi_demo_mount_via_io().