|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
ra8_io block-device backend over a caller-owned RAM buffer. More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_io_blockdev_ram_state_t |
| Caller-owned private state for a RAM block device. More... | |
Functions | |
| ra8_err_t | ra8_io_blockdev_ram_init (ra8_io_blockdev_t *bd, ra8_io_blockdev_ram_state_t *state, uint8_t *storage, uint32_t block_count, bool read_only) |
| Bind a RAM block-device backend into a caller-owned handle. | |
ra8_io block-device backend over a caller-owned RAM buffer.
The RAM backend treats a flat caller-owned byte buffer as an array of 512-byte logical blocks. It is the reference backend (the simplest correct implementation of ra8_io_blockdev_iface), the substrate for host unit tests, and a usable scratch/ramdisk volume on target (e.g. a small staging area in SRAM, or – via the SDRAM backend's identical model – the 64 MiB external SDRAM window). It erases to zero and needs no erase-before-write.
Definition in file ra8_io_blockdev_ram.h.
|
nodiscard |
Bind a RAM block-device backend into a caller-owned handle.
Records storage/block_count in state, marks it read-only per read_only, and points bd at the RAM vtable with state as its context. No allocation occurs; the caller owns both bd and state.
| [out] | bd | Handle to bind (zero-initialised by the caller). |
| [out] | state | Caller-owned backend state to populate. |
| [in] | storage | Backing buffer of block_count * 512 bytes. |
| [in] | block_count | Number of 512-byte logical blocks (>= 1). |
| [in] | read_only | true to reject writes and erases on this device. |
| k_ra8_ok | Backend bound; bd is usable. |
| k_ra8_err_null_ptr | bd, state, or storage was NULL. |
| k_ra8_err_invalid_size | block_count was zero. |
Definition at line 262 of file ra8_io_blockdev_ram.c.
References ra8_io_blockdev_ram_state_t::block_count, ra8_io_blockdev_t::ctx, ra8_io_blockdev_t::iface, k_ra8_err_invalid_size, k_ra8_io_ram_min_blocks, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_io_blockdev_ram_state_t::read_only, s_ram_iface, s_tag, and ra8_io_blockdev_ram_state_t::storage.
Referenced by internal_demo_mount(), internal_demo_probe_fat(), internal_demo_probe_foreign(), internal_demo_run(), internal_demo_run(), internal_swap_run_all(), and ra8_io_blockdev_sdram_init().