ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_periph_xspi.c File Reference

Octal-SPI (xSPI) manual-command + NOR-flash peripheral model for ra8_emulator. More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "board_console.h"
#include "board_periph_block.h"
#include "emu_host_io_internal.h"
Include dependency graph for board_periph_xspi.c:

Go to the source code of this file.

Data Structures

struct  xspi_state_t
 xSPI model state: register-window shadow + op counters. More...

Enumerations

enum  xspi_console_t : uint32_t { k_xspi_console_line_cap = 48U }
 Console-tap line buffer capacity for an xSPI command summary. More...
enum  xspi_map_t : uint64_t {
  k_xspi_base = 0x40268000UL ,
  k_xspi_span = 0x200UL ,
  k_xspi_off_cdctl0 = 0x070UL ,
  k_xspi_off_cdbuf = 0x080UL ,
  k_xspi_off_ints = 0x190UL ,
  k_xspi_off_intc = 0x194UL
}
 XSPI0 register-window geometry (ra8_ospi_regs.h). More...
enum  xspi_cdt_field_t : uint32_t {
  k_xspi_cdt_pos_cmdsize = 0U ,
  k_xspi_cdt_pos_datasize = 5U ,
  k_xspi_cdt_pos_cmd = 16U ,
  k_xspi_cdt_mask_cmdsize = 0x3U ,
  k_xspi_cdt_mask_datasize = 0xFU ,
  k_xspi_cdt_mask_cmd = 0xFFFFU ,
  k_xspi_cdt_byte = 0xFFU
}
 Command-descriptor (CDT) field positions / masks (ra8_ospi_regs.h). More...
enum  xspi_ctl_field_t : uint32_t {
  k_xspi_cdctl0_trreq = 1UL << 0U ,
  k_xspi_ints_cmdcmp = 1UL << 0U ,
  k_xspi_cdbuf_cdt = 0U ,
  k_xspi_cdbuf_addr = 1U ,
  k_xspi_cdbuf_data0 = 2U ,
  k_xspi_cdbuf_data1 = 3U
}
 CDCTL0 / INTS bits + CDBUF slot-0 word indices. More...
enum  xspi_op_t : uint32_t {
  k_xspi_op_wren = 0x06U ,
  k_xspi_op_pp = 0x02U ,
  k_xspi_op_rdsr = 0x05U ,
  k_xspi_op_rdid = 0x9FU ,
  k_xspi_op_read = 0x03U ,
  k_xspi_op_erase = 0x20U
}
 JEDEC opcodes the engine decodes (ra8_xspi.c). More...
enum  xspi_lit_t : uint32_t {
  k_xspi_flash_size = 0x4000000UL ,
  k_xspi_sector_len = 0x1000UL ,
  k_xspi_words = 128U ,
  k_xspi_erased = 0xFFU ,
  k_xspi_status_wel = 0x02U ,
  k_xspi_jedec_cdd0 = 0x001A5A9DUL ,
  k_xspi_byte_bits = 8U
}
 Backing-flash + register-window sizing and constants. More...
enum  xspi_order_t : uint32_t { k_xspi_block_order = 95U }
 Per-tick / report order slot (after the SD block, before SPI). More...

Functions

static RA8_INTERNAL uint8_t internal_xspi_flash_byte (uint32_t addr)
 Current flash content byte at addr (0xFF beyond the part).
static RA8_INTERNAL void internal_xspi_mark_dirty (uint32_t end_excl)
 Raise the dirty high-water mark to cover [0, end_excl).
static RA8_INTERNAL uint32_t internal_xspi_cdbuf_word (uint32_t w)
 Word index of CDBUF slot-0 entry w inside the window shadow.
static RA8_INTERNAL uint32_t internal_xspi_opcode (uint32_t cdt)
 Extract the 1/2-byte opcode from a CDT descriptor word.
static RA8_INTERNAL void internal_xspi_do_read (uint32_t addr, uint32_t n)
 Read n bytes (<= 8) from flash@addr into CDD0/CDD1.
static RA8_INTERNAL void internal_xspi_do_program (uint32_t addr, uint32_t n)
 Page-program n bytes (<= 8) of CDD0/CDD1 into flash@addr (NOR AND).
static RA8_INTERNAL void internal_xspi_do_erase (uint32_t addr)
 Erase the 4 KiB sector containing addr (restore 0xFF).
static RA8_INTERNAL void internal_xspi_exec_command (void)
 Execute the slot-0 manual command, then raise INTS.CMDCMP.
static RA8_INTERNAL void internal_xspi_reset (void)
 Reset the xSPI model: zero the window, erase the touched flash prefix.
static RA8_INTERNAL uint64_t internal_xspi_read (uc_engine *uc, uint64_t addr, unsigned size)
 MMIO read inside the xSPI window.
static RA8_INTERNAL void internal_xspi_write (uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
 MMIO write inside the xSPI window (TRREQ kicks; INTC is W1C).
static RA8_INTERNAL void internal_xspi_report (void)
 End-of-run xSPI section: op counts (only if the bus was used).
static RA8_INTERNAL void internal_xspi_block_register (void)
 Register the xSPI block before main (host constructor).

Variables

static xspi_state_t s_xspi
static uint8_t s_xspi_flash_neg [k_xspi_flash_size]
 Backing NOR array for the full 64 MiB part, stored INVERTED.
static uint32_t s_xspi_dirty_hi
 Exclusive high-water mark of bytes ever programmed/erased this run.
static const board_periph_block_t s_k_xspi_block
 xSPI block descriptor (self-registered with the core).

Detailed Description

Octal-SPI (xSPI) manual-command + NOR-flash peripheral model for ra8_emulator.

Models the RA8D2 XSPI0 manual-command engine (ra8_ospi_regs.h, ra8_xspi.c) at 0x40268000 plus a backing NOR-flash array, so the firmware's real "fill CDBUF, set CDCTL0.TRREQ, poll INTS.CMDCMP, read CDBUF" sequence actually round-trips data. Without this block the xSPI MMIO was unmodeled: flash_journal reached its run budget only because it tolerates the failed ops, while threadx_levelx_demo / threadx_fs_levelx_demo panic-halted inside lx_nor_flash_format (LevelX needs the flash to truly read back what it wrote).

The model decodes the slot-0 command descriptor (CDBUF[0] = CDT, [1] = CDA, [2] = CDD0, [3] = CDD1) on every TRREQ kick:

  • 0x9F RDID -> CDD0 = {0x9D, 0x5A, 0x1A} (ISSI IS25LX512M JEDEC triplet)
  • 0x05 RDSR -> CDD0 = WEL=1, WIP=0 (flash idle)
  • 0x06 WREN -> no-op (latch is implicit; status always reports WEL=1)
  • 0x03 READ -> copy DATASIZE bytes from the flash array into CDD0/CDD1
  • 0x02 PP -> AND DATASIZE bytes of CDD0/CDD1 into the flash array
  • 0x20 SE -> fill the 4 KiB sector at CDA with 0xFF
  • anything else (8D/1S software-reset opcodes, mode switches) -> no-op then sets INTS.CMDCMP and clears CDCTL0.TRREQ. NOR semantics (program only clears bits; erase restores 0xFF) match the real part and the host-test register-level model in tests/mocks/src/ra8_fake_xspi_flash.c.
Since
0.1.0

Definition in file board_periph_xspi.c.

Enumeration Type Documentation

◆ xspi_cdt_field_t

enum xspi_cdt_field_t : uint32_t

Command-descriptor (CDT) field positions / masks (ra8_ospi_regs.h).

Enumerator
k_xspi_cdt_pos_cmdsize 

CMDSIZE[1:0] command bytes.

k_xspi_cdt_pos_datasize 

DATASIZE[8:5] data bytes.

k_xspi_cdt_pos_cmd 

CMD[31:16] opcode field.

k_xspi_cdt_mask_cmdsize 

CMDSIZE width.

k_xspi_cdt_mask_datasize 

DATASIZE width.

k_xspi_cdt_mask_cmd 

CMD field width.

k_xspi_cdt_byte 

One opcode/data byte.

Definition at line 57 of file board_periph_xspi.c.

◆ xspi_console_t

enum xspi_console_t : uint32_t

Console-tap line buffer capacity for an xSPI command summary.

Enumerator
k_xspi_console_line_cap 

Max chars in an "OSPI .. @0x.." line.

Definition at line 42 of file board_periph_xspi.c.

◆ xspi_ctl_field_t

enum xspi_ctl_field_t : uint32_t

CDCTL0 / INTS bits + CDBUF slot-0 word indices.

Enumerator
k_xspi_cdctl0_trreq 

TRREQ: kick the manual transfer.

k_xspi_ints_cmdcmp 

CMDCMP: command complete.

k_xspi_cdbuf_cdt 

CDBUF[0] command descriptor.

k_xspi_cdbuf_addr 

CDBUF[1] flash address.

k_xspi_cdbuf_data0 

CDBUF[2] data bytes 0..3.

k_xspi_cdbuf_data1 

CDBUF[3] data bytes 4..7.

Definition at line 68 of file board_periph_xspi.c.

◆ xspi_lit_t

enum xspi_lit_t : uint32_t

Backing-flash + register-window sizing and constants.

Enumerator
k_xspi_flash_size 

64 MiB: the full IS25LX512M part (512 Mbit; usb_selftest_ospi_rw's scratch window sits at +2 MiB).

k_xspi_sector_len 

4 KiB sector (opcode 0x20).

k_xspi_words 

0x200-byte window as 32-bit words.

k_xspi_erased 

NOR erased byte value.

k_xspi_status_wel 

RDSR result: WEL=1, WIP=0.

k_xspi_jedec_cdd0 

{0x9D,0x5A,0x1A} packed for CDD0.

k_xspi_byte_bits 

Bits per byte.

Definition at line 88 of file board_periph_xspi.c.

◆ xspi_map_t

enum xspi_map_t : uint64_t

XSPI0 register-window geometry (ra8_ospi_regs.h).

Enumerator
k_xspi_base 

XSPI0 register window base.

k_xspi_span 

Window covering WRAPCFG..INTE.

k_xspi_off_cdctl0 

CDCTL0 (TRREQ bit 0 / CSSEL bit 3).

k_xspi_off_cdbuf 

CDBUF[0..3] for manual slot 0.

k_xspi_off_ints 

INTS (CMDCMP bit 0).

k_xspi_off_intc 

INTC (write-1-to-clear).

Definition at line 47 of file board_periph_xspi.c.

◆ xspi_op_t

enum xspi_op_t : uint32_t

JEDEC opcodes the engine decodes (ra8_xspi.c).

Enumerator
k_xspi_op_wren 

Write enable.

k_xspi_op_pp 

Page program.

k_xspi_op_rdsr 

Read status.

k_xspi_op_rdid 

Read JEDEC ID.

k_xspi_op_read 

Normal read.

k_xspi_op_erase 

4 KiB sector erase.

Definition at line 78 of file board_periph_xspi.c.

◆ xspi_order_t

enum xspi_order_t : uint32_t

Per-tick / report order slot (after the SD block, before SPI).

Enumerator
k_xspi_block_order 

Report ordering only.

Definition at line 101 of file board_periph_xspi.c.

Function Documentation

◆ internal_xspi_block_register()

RA8_INTERNAL void internal_xspi_block_register ( void )
static

Register the xSPI block before main (host constructor).

Definition at line 457 of file board_periph_xspi.c.

References board_periph_register_block(), RA8_INTERNAL, and s_k_xspi_block.

◆ internal_xspi_cdbuf_word()

RA8_INTERNAL uint32_t internal_xspi_cdbuf_word ( uint32_t w)
static

Word index of CDBUF slot-0 entry w inside the window shadow.

Word index of cdbuf slot-0 entry w inside the window shadow; this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in]wW input used by the operation.
Returns
The xSPI cdbuf word result produced by the board periph xSPI model.
Return values
valueThe operation-specific xSPI cdbuf word value.
Precondition
Arguments satisfy the ranges documented for xSPI cdbuf word.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 193 of file board_periph_xspi.c.

References k_xspi_off_cdbuf, and RA8_INTERNAL.

Referenced by internal_xspi_do_program(), internal_xspi_do_read(), and internal_xspi_exec_command().

◆ internal_xspi_do_erase()

RA8_INTERNAL void internal_xspi_do_erase ( uint32_t addr)
static

Erase the 4 KiB sector containing addr (restore 0xFF).

Erase the 4 kib sector containing addr (restore 0xff); this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in]addrGuest address involved in the operation.
Precondition
Arguments satisfy the ranges documented for xSPI do erase.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 295 of file board_periph_xspi.c.

References internal_xspi_mark_dirty(), k_xspi_flash_size, k_xspi_sector_len, memset(), RA8_INTERNAL, s_xspi, and s_xspi_flash_neg.

Referenced by internal_xspi_exec_command().

◆ internal_xspi_do_program()

RA8_INTERNAL void internal_xspi_do_program ( uint32_t addr,
uint32_t n )
static

Page-program n bytes (<= 8) of CDD0/CDD1 into flash@addr (NOR AND).

Page-program n bytes (<= 8) of cdd0/cdd1 into flash@addr (nor and); this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in]addrGuest address involved in the operation.
[in]nNumber of elements or bytes participating in the operation.
Precondition
Arguments satisfy the ranges documented for xSPI do program.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 262 of file board_periph_xspi.c.

References board_console_push(), internal_xspi_cdbuf_word(), internal_xspi_mark_dirty(), k_board_console_ch_ospi, k_xspi_byte_bits, k_xspi_cdbuf_data0, k_xspi_cdbuf_data1, k_xspi_cdt_byte, k_xspi_console_line_cap, k_xspi_flash_size, RA8_INTERNAL, s_xspi, and s_xspi_flash_neg.

Referenced by internal_xspi_exec_command().

◆ internal_xspi_do_read()

RA8_INTERNAL void internal_xspi_do_read ( uint32_t addr,
uint32_t n )
static

Read n bytes (<= 8) from flash@addr into CDD0/CDD1.

Read n bytes (<= 8) from flash@addr into cdd0/cdd1; this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in]addrGuest address involved in the operation.
[in]nNumber of elements or bytes participating in the operation.
Precondition
Arguments satisfy the ranges documented for xSPI do read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 231 of file board_periph_xspi.c.

References board_console_push(), internal_xspi_cdbuf_word(), internal_xspi_flash_byte(), k_board_console_ch_ospi, k_xspi_byte_bits, k_xspi_cdbuf_data0, k_xspi_cdbuf_data1, k_xspi_console_line_cap, RA8_INTERNAL, and s_xspi.

Referenced by internal_xspi_exec_command().

◆ internal_xspi_exec_command()

RA8_INTERNAL void internal_xspi_exec_command ( void )
static

Execute the slot-0 manual command, then raise INTS.CMDCMP.

Execute the slot-0 manual command, then raise ints.cmdcmp; this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for xSPI exec command.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 315 of file board_periph_xspi.c.

References internal_xspi_cdbuf_word(), internal_xspi_do_erase(), internal_xspi_do_program(), internal_xspi_do_read(), internal_xspi_opcode(), k_xspi_cdbuf_addr, k_xspi_cdbuf_cdt, k_xspi_cdbuf_data0, k_xspi_cdt_mask_datasize, k_xspi_cdt_pos_datasize, k_xspi_ints_cmdcmp, k_xspi_jedec_cdd0, k_xspi_off_ints, k_xspi_op_erase, k_xspi_op_pp, k_xspi_op_rdid, k_xspi_op_rdsr, k_xspi_op_read, k_xspi_status_wel, RA8_INTERNAL, and s_xspi.

Referenced by internal_xspi_write().

◆ internal_xspi_flash_byte()

RA8_INTERNAL uint8_t internal_xspi_flash_byte ( uint32_t addr)
static

Current flash content byte at addr (0xFF beyond the part).

Current flash content byte at addr (0xff beyond the part); this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in]addrGuest address involved in the operation.
Returns
The xSPI flash byte result produced by the board periph xSPI model.
Return values
valueThe operation-specific xSPI flash byte value.
Precondition
Arguments satisfy the ranges documented for xSPI flash byte.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 158 of file board_periph_xspi.c.

References k_xspi_erased, k_xspi_flash_size, RA8_INTERNAL, and s_xspi_flash_neg.

Referenced by internal_xspi_do_read().

◆ internal_xspi_mark_dirty()

RA8_INTERNAL void internal_xspi_mark_dirty ( uint32_t end_excl)
static

Raise the dirty high-water mark to cover [0, end_excl).

Raise the dirty high-water mark to cover [0, end_excl); this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in]end_exclEnd excl input used by the operation.
Precondition
Arguments satisfy the ranges documented for xSPI mark dirty.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 175 of file board_periph_xspi.c.

References RA8_INTERNAL, and s_xspi_dirty_hi.

Referenced by internal_xspi_do_erase(), and internal_xspi_do_program().

◆ internal_xspi_opcode()

RA8_INTERNAL uint32_t internal_xspi_opcode ( uint32_t cdt)
static

Extract the 1/2-byte opcode from a CDT descriptor word.

Extract the 1/2-byte opcode from a cdt descriptor word; this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in]cdtCdt input used by the operation.
Returns
The xSPI opcode result produced by the board periph xSPI model.
Return values
valueThe operation-specific xSPI opcode value.
Precondition
Arguments satisfy the ranges documented for xSPI opcode.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 209 of file board_periph_xspi.c.

References k_xspi_byte_bits, k_xspi_cdt_byte, k_xspi_cdt_mask_cmd, k_xspi_cdt_mask_cmdsize, k_xspi_cdt_pos_cmd, k_xspi_cdt_pos_cmdsize, and RA8_INTERNAL.

Referenced by internal_xspi_exec_command().

◆ internal_xspi_read()

RA8_INTERNAL uint64_t internal_xspi_read ( uc_engine * uc,
uint64_t addr,
unsigned size )
static

MMIO read inside the xSPI window.

MMIO read inside the xspi window; this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]addrGuest address involved in the operation.
[in]sizeSize of the requested region or access in bytes.
Returns
The xSPI read result produced by the board periph xSPI model.
Return values
valueThe operation-specific xSPI read value.
Precondition
Arguments satisfy the ranges documented for xSPI read.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 378 of file board_periph_xspi.c.

References k_xspi_base, k_xspi_words, RA8_INTERNAL, and s_xspi.

◆ internal_xspi_report()

RA8_INTERNAL void internal_xspi_report ( void )
static

End-of-run xSPI section: op counts (only if the bus was used).

End-of-run xspi section: op counts (only if the bus was used); this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for xSPI report.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 432 of file board_periph_xspi.c.

References priv_emu_io_errf(), RA8_INTERNAL, and s_xspi.

◆ internal_xspi_reset()

RA8_INTERNAL void internal_xspi_reset ( void )
static

Reset the xSPI model: zero the window, erase the touched flash prefix.

Reset the xspi model: zero the window, erase the touched flash prefix; this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Precondition
Arguments satisfy the ranges documented for xSPI reset.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 353 of file board_periph_xspi.c.

References memset(), RA8_INTERNAL, s_xspi, s_xspi_dirty_hi, and s_xspi_flash_neg.

◆ internal_xspi_write()

RA8_INTERNAL void internal_xspi_write ( uc_engine * uc,
uint64_t addr,
unsigned size,
uint64_t value )
static

MMIO write inside the xSPI window (TRREQ kicks; INTC is W1C).

MMIO write inside the xspi window (trreq kicks; intc is w1c); this step is contained within the board periph xSPI model and uses bounded caller or module-owned storage.

Parameters
[in,out]ucUnicorn engine whose emulated state is read or updated.
[in]addrGuest address involved in the operation.
[in]sizeSize of the requested region or access in bytes.
[in]valueRegister or payload value involved in the operation.
Precondition
Arguments satisfy the ranges documented for xSPI write.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board periph xSPI model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 402 of file board_periph_xspi.c.

References internal_xspi_exec_command(), k_xspi_base, k_xspi_cdctl0_trreq, k_xspi_off_cdctl0, k_xspi_off_intc, k_xspi_off_ints, k_xspi_words, and s_xspi.

Variable Documentation

◆ s_k_xspi_block

const board_periph_block_t s_k_xspi_block
static
Initial value:
= {
.base = (uint32_t)k_xspi_base,
.span = (uint32_t)k_xspi_span,
.order = (uint32_t)k_xspi_block_order,
.tick = nullptr,
.name = "XSPI",
}
@ k_xspi_base
XSPI0 register window base.
@ k_xspi_span
Window covering WRAPCFG..INTE.
static RA8_INTERNAL void internal_xspi_report(void)
End-of-run xSPI section: op counts (only if the bus was used).
static RA8_INTERNAL void internal_xspi_reset(void)
Reset the xSPI model: zero the window, erase the touched flash prefix.
@ k_xspi_block_order
Report ordering only.
-proof
static ra8_err_t internal_xspi_write(void *ctx, uint32_t lba, uint32_t count, const uint8_t *buf)
xSPI backend: write count blocks from buf at lba.
static ra8_err_t internal_xspi_read(void *ctx, uint32_t lba, uint32_t count, uint8_t *buf)
xSPI backend: read count blocks at lba into buf.

xSPI block descriptor (self-registered with the core).

Definition at line 444 of file board_periph_xspi.c.

Referenced by internal_xspi_block_register().

◆ s_xspi

◆ s_xspi_dirty_hi

uint32_t s_xspi_dirty_hi
static

Exclusive high-water mark of bytes ever programmed/erased this run.

Lets internal_xspi_reset restore only the touched prefix of the 64 MiB array instead of sweeping (and thereby committing) all of it on every warm reboot of the emulator.

Note
Updated by internal_xspi_do_program and internal_xspi_do_erase only.
Since
0.1.0

Definition at line 145 of file board_periph_xspi.c.

Referenced by internal_xspi_mark_dirty(), and internal_xspi_reset().

◆ s_xspi_flash_neg

uint8_t s_xspi_flash_neg[k_xspi_flash_size]
static

Backing NOR array for the full 64 MiB part, stored INVERTED.

Each byte holds the bitwise complement of the flash content, so the all-zero BSS image IS the erased (0xFF) part: a fresh ra8_emulator process pays no resident memory for the 64 MiB until a sector is actually programmed or erased (the zero page is never dirtied by reads). NOR semantics translate directly: page-program clears flash bits = SETS stored bits (OR), sector erase restores 0xFF = clears stored bytes to 0.

Note
Access only through internal_xspi_flash_byte / internal_xspi_do_program / internal_xspi_do_erase so the inversion cannot leak.
Warning
Do not memset this to 0xFF – that would mean "all bits programmed to 0" AND commit 64 MiB of resident pages per emulator process.
Since
0.1.0

Definition at line 132 of file board_periph_xspi.c.

Referenced by internal_xspi_do_erase(), internal_xspi_do_program(), internal_xspi_flash_byte(), and internal_xspi_reset().