|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
ra8_fs block-device backend over a LevelX wear-levelled NOR partition More...
Go to the source code of this file.
Functions | |
| ra8_err_t | lx_fs_backend_bind (LX_NOR_FLASH *nor_flash, ra8_fs_backend_t *out) |
| Expose an open LevelX NOR flash as an ra8_fs block-device backend. | |
ra8_fs block-device backend over a LevelX wear-levelled NOR partition
Declares lx_fs_backend_bind() – the adapter that exposes an open LX_NOR_FLASH as an ra8_fs_backend_t, so the first-party ra8_fs filesystem can format and mount a FAT volume on top of the LevelX wear-levelling layer that already sits on top of ra8_xspi_flash_* against the on-board EK-RA8D2 ISSI IS25LX512M octal-SPI NOR flash.
Stack layout:
Sector geometry:
The adapter is stateless apart from one static sector bounce buffer used to satisfy LevelX's ULONG-aligned buffer contract for arbitrary caller pointers; ra8_fs serialises every backend call (see ra8_fs_set_lock()), so the buffer is never shared between two calls.
Definition in file lx_fs_backend.h.
|
nodiscard |
Expose an open LevelX NOR flash as an ra8_fs block-device backend.
Fills out with trampolines that forward ra8_fs's read_block / write_block / get_capacity calls into lx_nor_flash_sector_read / lx_nor_flash_sector_write against nor_flash, with out->ctx pointing at nor_flash. erase_blocks is left NULL (NOR erases to ones, and ra8_fs only consumes a zero-guaranteeing erase), so the formatter writes zeros instead. After this call every ra8_fs API (ra8_fs_format, ra8_fs_mount, ...) works on the LevelX partition.
The caller retains ownership of nor_flash; it must stay open for the lifetime of every filesystem call made through out.
| [in] | nor_flash | LevelX NOR-flash control block already opened via lx_nor_flash_open. Must not be NULL. |
| [out] | out | Backend to populate. Must not be NULL. |
| k_ra8_ok | out is wired to nor_flash. |
| k_ra8_err_null_ptr | nor_flash or out was NULL. |
| k_ra8_err_not_initialized | nor_flash reports zero usable sectors (not opened, or geometry not programmed). |
nor_flash was successfully opened with lx_nor_flash_open. out is writable and outlives every filesystem call. out's callbacks and ctx reference nor_flash. out is left unmodified.Expose an open LevelX NOR flash as an ra8_fs block-device backend.
Definition at line 261 of file lx_fs_backend.c.
References ra8_fs_backend_t::ctx, ra8_fs_backend_t::erase_blocks, ra8_fs_backend_t::get_capacity, internal_get_capacity(), internal_read_block(), internal_usable_sectors(), internal_write_block(), k_ra8_err_not_initialized, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_fs_backend_t::read_block, s_tag, and ra8_fs_backend_t::write_block.
Referenced by demo_fs_format_mount(), and demo_fs_format_or_panic().