|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Block-device interface that ra8_fs runs on top of. More...
#include <ra8_fs_types.h>
Data Fields | |
| ra8_err_t(* | read_block )(void *ctx, uint64_t lba, uint32_t count, uint8_t *buf) |
| Read count consecutive blocks starting at lba. | |
| ra8_err_t(* | write_block )(void *ctx, uint64_t lba, uint32_t count, const uint8_t *buf) |
| Write count consecutive blocks starting at lba. | |
| ra8_err_t(* | get_capacity )(void *ctx, uint64_t *block_count, uint32_t *block_size) |
| Report the device size. | |
| ra8_err_t(* | erase_blocks )(void *ctx, uint64_t lba, uint64_t count) |
| OPTIONAL: bulk-erase count blocks at lba to all-zero bytes. | |
| void * | ctx |
| Caller-owned context passed back into the function pointers. | |
Block-device interface that ra8_fs runs on top of.
Three function pointers + a context cookie. Each implementation (SDHI, USB MSC, mock) fills these in and passes the struct to ra8_fs_mount().
LBAs and the block count are 64-bit so media past the 32-bit-LBA reach (2 TiB at 512-byte blocks) are addressable end to end – through the mount's partition base, the GPT parser and every cluster computation (#683). The block size is the medium's real sector size: 512-byte and 4096-byte-native (4Kn) devices are both supported, 1024/2048 included.
Definition at line 149 of file ra8_fs_types.h.
| void* ra8_fs_backend_t::ctx |
Caller-owned context passed back into the function pointers.
Definition at line 189 of file ra8_fs_types.h.
Referenced by internal_exfat_write_bitmap(), internal_exfat_write_fat(), internal_exfat_write_mbr(), internal_exfat_write_root(), internal_fmt_seed_fats(), internal_fmt_write_fsinfo(), internal_fmt_zero_run(), internal_mount_probe_bps(), internal_stub_probe(), lx_fs_backend_bind(), priv_exfat_write_upcase(), priv_fmt_clear_region(), priv_fmt_emit_volume(), priv_read_sector(), priv_write_sector(), ra8_io_blockdev_as_fs_backend(), and ra8_sdmmc_spi_bind_fs_backend().
OPTIONAL: bulk-erase count blocks at lba to all-zero bytes.
May be NULL. When non-NULL and it returns k_ra8_ok, the range [lba, lba+count) is guaranteed to read back as 0x00 – letting the formatter skip an explicit zero-write of that region (much faster on flash media that erases internally). A backend that cannot guarantee a zero post-erase value (or does not implement erase) must return k_ra8_err_not_supported so the formatter falls back to writing zeros; any other non-OK error aborts the format.
| [in] | ctx | Backend cookie. |
| [in] | lba | First block to erase. |
| [in] | count | Number of blocks to erase. |
Definition at line 186 of file ra8_fs_types.h.
Referenced by lx_fs_backend_bind(), priv_fmt_clear_region(), ra8_io_blockdev_as_fs_backend(), and ra8_sdmmc_spi_bind_fs_backend().
| ra8_err_t(* ra8_fs_backend_t::get_capacity) (void *ctx, uint64_t *block_count, uint32_t *block_size) |
Report the device size.
| [out] | block_count | Total blocks (sectors). |
| [out] | block_size | Bytes per block: a power of two in k_ra8_fs_sector_min..k_ra8_fs_sector_max. |
Definition at line 170 of file ra8_fs_types.h.
Referenced by internal_mount_probe_bps(), lx_fs_backend_bind(), ra8_io_blockdev_as_fs_backend(), and ra8_sdmmc_spi_bind_fs_backend().
Read count consecutive blocks starting at lba.
| [in] | ctx | Backend cookie. |
| [in] | lba | Logical block address (0 = BPB). |
| [in] | count | Number of blocks to read. |
| [out] | buf | Destination buffer of at least count * block_size bytes. |
Definition at line 157 of file ra8_fs_types.h.
Referenced by internal_stub_probe(), lx_fs_backend_bind(), priv_read_sector(), ra8_io_blockdev_as_fs_backend(), and ra8_sdmmc_spi_bind_fs_backend().
| ra8_err_t(* ra8_fs_backend_t::write_block) (void *ctx, uint64_t lba, uint32_t count, const uint8_t *buf) |
Write count consecutive blocks starting at lba.
Definition at line 162 of file ra8_fs_types.h.
Referenced by internal_exfat_write_bitmap(), internal_exfat_write_fat(), internal_exfat_write_mbr(), internal_exfat_write_root(), internal_fmt_seed_fats(), internal_fmt_write_fsinfo(), internal_fmt_zero_run(), lx_fs_backend_bind(), priv_exfat_write_upcase(), priv_fmt_emit_volume(), priv_write_sector(), ra8_io_blockdev_as_fs_backend(), and ra8_sdmmc_spi_bind_fs_backend().