|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
RAM-backed standalone-LevelX NOR driver – implementation. More...
Go to the source code of this file.
Enumerations | |
| enum | lx_nor_ram_const_t : uint32_t { k_lx_nor_ram_total_blocks = 64U , k_lx_nor_ram_words_per_block = 512U , k_lx_nor_ram_total_words = 64U * 512U , k_lx_nor_ram_erased = 0xFFFFFFFFU } |
| Geometry + sentinel constants for the RAM NOR driver. More... | |
Functions | |
| static UINT | internal_ram_read (ULONG *flash_address, ULONG *destination, ULONG words) |
Read words ULONGs from the backing pointer into destination. | |
| static UINT | internal_ram_write (ULONG *flash_address, ULONG *source, ULONG words) |
Write words ULONGs from source to the backing pointer. | |
| static UINT | internal_ram_block_erase (ULONG block, ULONG erase_count) |
| Erase one block to the LevelX erased pattern. | |
| static UINT | internal_ram_block_erased_verify (ULONG block) |
| Verify one block is fully erased. | |
| unsigned int | lx_nor_ram_init (struct LX_NOR_FLASH_STRUCT *nor_flash) |
| LevelX NOR driver-initialise callback over the static SRAM backing. | |
| void | lx_nor_ram_wipe (void) |
| Erase the entire SRAM backing to the LevelX "erased" pattern. | |
Variables | |
| static ULONG | s_ram_backing [k_lx_nor_ram_total_words] |
| The fake NOR media (persists across open/close within one boot). | |
| static ULONG | s_ram_sector_buf [LX_NOR_SECTOR_SIZE] |
| LevelX per-open sector scratch (one logical sector wide). | |
RAM-backed standalone-LevelX NOR driver – implementation.
Implements a minimal LevelX NOR driver whose media is a static ULONG array. The read/write callbacks dereference the ULONG* LevelX hands them directly (LevelX derives it from lx_nor_flash_base_address, which points at the backing), mirroring the vendored lx_nor_flash_simulator.c but first-party and heap-free. No peripheral register is touched, so the emulator and silicon run identical code.
ULONG width note: under LX_STANDALONE_ENABLE, ULONG is unsigned long (4 bytes on the arm-none-eabi ILP32 target, 8 bytes on the LP64 test host). The erased pattern is written as (ULONG)0xFFFFFFFF (== LevelX's LX_ALL_ONES), matching how LevelX compares words against 0xFFFFFFFF.
Definition in file lx_nor_ram.c.
| enum lx_nor_ram_const_t : uint32_t |
Geometry + sentinel constants for the RAM NOR driver.
64 blocks * 512 words/block is an ample logical-sector space for the demo (well over a hundred usable 512-byte sectors on both the 4-byte target and 8-byte host) while keeping the SRAM backing modest (128 KiB on the target).
| Enumerator | |
|---|---|
| k_lx_nor_ram_total_blocks | NOR blocks. |
| k_lx_nor_ram_words_per_block | ULONG words/block. |
| k_lx_nor_ram_total_words | Backing word count. |
| k_lx_nor_ram_erased | LevelX erased word. |
Definition at line 39 of file lx_nor_ram.c.
Erase one block to the LevelX erased pattern.
Computes the selected block's base word and overwrites exactly one geometry-defined block with the erased value.
| [in] | block | Block index. |
| [in] | erase_count | LevelX erase counter (unused). |
block is out of range. | 0 | Block erased. |
| 1 | block is out of range. |
block indexes a real block. Definition at line 146 of file lx_nor_ram.c.
References k_lx_nor_ram_erased, k_lx_nor_ram_total_blocks, k_lx_nor_ram_words_per_block, RA8_INTERNAL, and s_ram_backing.
Referenced by lx_nor_ram_init().
Verify one block is fully erased.
Bounds-checks the block index, then scans every word in the block for the LevelX erased pattern without modifying the backing.
| [in] | block | Block index. |
| 0 | Every word matches the erased pattern. |
| 1 | block is out of range, or a word is not erased. |
block indexes a real block. Definition at line 174 of file lx_nor_ram.c.
References k_lx_nor_ram_erased, k_lx_nor_ram_total_blocks, k_lx_nor_ram_words_per_block, RA8_INTERNAL, and s_ram_backing.
Referenced by lx_nor_ram_init().
Read words ULONGs from the backing pointer into destination.
Copies the requested contiguous range without allocating storage or changing the emulated NOR contents.
| [in] | flash_address | Source pointer into the backing (LevelX cookie). |
| [out] | destination | Destination buffer of words ULONGs. |
| [in] | words | Word count. |
| 0 | Words copied. |
| 1 | A pointer argument was NULL. |
flash_address lies within the backing. destination covers words ULONGs. destination holds the copied words on success. Definition at line 82 of file lx_nor_ram.c.
References RA8_INTERNAL.
Write words ULONGs from source to the backing pointer.
Programs the requested contiguous range directly in the RAM-backed NOR model without allocating storage or touching other words.
| [in] | flash_address | Destination pointer into the backing (LevelX cookie). |
| [in] | source | Source buffer of words ULONGs. |
| [in] | words | Word count. |
| 0 | Words written. |
| 1 | A pointer argument was NULL. |
flash_address lies within the backing. source covers words ULONGs. source on success. Definition at line 116 of file lx_nor_ram.c.
References RA8_INTERNAL.
| unsigned int lx_nor_ram_init | ( | struct LX_NOR_FLASH_STRUCT * | nor_flash | ) |
LevelX NOR driver-initialise callback over the static SRAM backing.
Signature-compatible with ra8_cache_store_nor_init_fn: programs the control block's geometry, the read/write/erase/verify callbacks, and the LevelX per-open sector buffer against the static backing array. Passed straight to lx_nor_flash_open() / lx_nor_flash_format().
| [in,out] | nor_flash | LevelX control block to populate. |
| 0 | Control block programmed. |
| 1 | nor_flash was NULL. |
nor_flash points at caller-owned LevelX control-block storage. Definition at line 188 of file lx_nor_ram.c.
References internal_ram_block_erase(), internal_ram_block_erased_verify(), internal_ram_read(), internal_ram_write(), k_lx_nor_ram_total_blocks, k_lx_nor_ram_words_per_block, s_ram_backing, and s_ram_sector_buf.
Referenced by internal_rcs_build_cfg().
| void lx_nor_ram_wipe | ( | void | ) |
Erase the entire SRAM backing to the LevelX "erased" pattern.
Resets the fake NOR media to a blank (unformatted) device. Firmware never needs this – reset zeroes the BSS backing and the first mount formats it – but the host test calls it between independent scenarios that share the one static backing.
Definition at line 204 of file lx_nor_ram.c.
References k_lx_nor_ram_erased, k_lx_nor_ram_total_words, and s_ram_backing.
|
static |
The fake NOR media (persists across open/close within one boot).
Definition at line 52 of file lx_nor_ram.c.
Referenced by internal_ram_block_erase(), internal_ram_block_erased_verify(), lx_nor_ram_init(), and lx_nor_ram_wipe().
|
static |
LevelX per-open sector scratch (one logical sector wide).
Definition at line 60 of file lx_nor_ram.c.
Referenced by lx_nor_ram_init().