|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
LevelX NOR-flash driver shim that bridges LevelX onto the RA8 ra8_xspi HAL (EK-RA8D2 ISSI IS25LX512M octal-SPI flash). More...
#include "lx_api.h"Go to the source code of this file.
Functions | |
| UINT | lx_nor_driver_ra8_xspi_initialize (LX_NOR_FLASH *nor_flash) |
| LevelX NOR driver-initialise entry point bridging onto ra8_xspi. | |
LevelX NOR-flash driver shim that bridges LevelX onto the RA8 ra8_xspi HAL (EK-RA8D2 ISSI IS25LX512M octal-SPI flash).
Declares the single LevelX NOR driver-initialise entry point lx_nor_driver_ra8_xspi_initialize that lx_nor_flash_open() / lx_nor_flash_format() calls back into during NOR-flash bring-up. The function:
Sector geometry:
| LevelX concept | IS25LX512M mapping |
|---|---|
| block (smallest erase unit) | 4 KiB sector (opcode 0x20) |
| physical sector | 512 bytes (LX_NOR_SECTOR_SIZE words) |
| physical sectors per block | 7 usable + 1 metadata = 8 |
| words per block | 4096 / sizeof(ULONG) = 1024 words |
The shim hard-wires xSPI instance 0, which is the channel routed to the EK-RA8D2 octal-SPI flash device. lx_nor_flash_base_address is set to a non-zero "fake" base; LevelX uses it only as an opaque cookie when computing flash addresses for the read / write / erase callbacks below, where we re-derive the byte offset by subtracting this base.
Definition in file lx_nor_driver_ra8_xspi.h.
| UINT lx_nor_driver_ra8_xspi_initialize | ( | LX_NOR_FLASH * | nor_flash | ) |
LevelX NOR driver-initialise entry point bridging onto ra8_xspi.
Pass this function as the nor_driver_initialize argument to lx_nor_flash_open() or lx_nor_flash_format(). LevelX invokes it exactly once per open / format call to discover the geometry of the flash and to populate the four lx_nor_flash_driver_* function pointers in the supplied control block.
Driver mapping:
| LevelX callback | Action |
|---|---|
| lx_nor_flash_driver_read | ra8_xspi_flash_read(0, off, buf, words*4) |
| lx_nor_flash_driver_write | ra8_xspi_flash_program(0, off, buf, w*4) |
| lx_nor_flash_driver_block_erase | ra8_xspi_flash_erase_sector(0, off) |
| lx_nor_flash_driver_block_erased_verify | read sector and check 0xFFFFFFFF |
| [in,out] | nor_flash | LevelX NOR-flash control block. The driver writes lx_nor_flash_base_address, lx_nor_flash_total_blocks, lx_nor_flash_words_per_block, lx_nor_flash_sector_buffer and the four lx_nor_flash_driver_* function pointers. |
| LX_SUCCESS | Driver registered, geometry programmed. |
Definition at line 886 of file lx_nor_driver_ra8_xspi.c.
References internal_bus_init_once(), internal_nor_block_erase(), internal_nor_block_erased_verify(), internal_nor_read(), internal_nor_write(), k_ra8_lx_nor_base_addr, k_ra8_lx_nor_total_blocks, k_ra8_lx_nor_words_per_block, and s_ra8_lx_nor_sector_buffer.
Referenced by demo_lx_format_or_panic(), demo_lx_open(), and demo_lx_open_or_panic().