42typedef enum : uint32_t {
47typedef enum : uint64_t {
57typedef enum : uint32_t {
68typedef enum : uint32_t {
78typedef enum : uint32_t {
88typedef enum : uint32_t {
101typedef enum : uint32_t {
211 const uint32_t cmdsize =
216 const uint32_t shift =
235 for (uint32_t i = 0U; i < n; i++) {
248 (void)snprintf(ln,
sizeof(ln),
"OSPI rd @0x%06X %uB", (
unsigned)addr, (
unsigned)n);
266 for (uint32_t i = 0U; i < n; i++) {
270 const uint32_t w = (i < 4U) ? d0 : d1;
271 const uint32_t s = (i < 4U) ? i : (i - 4U);
282 (void)snprintf(ln,
sizeof(ln),
"OSPI pp @0x%06X %uB", (
unsigned)addr, (
unsigned)n);
386 return s_xspi.regs[off / 4U];
415 s_xspi.regs[off / 4U] = (uint32_t)value;
Multi-channel console log store backing the board view's tabbed console.
void board_console_push(board_console_ch_t ch, const char *line)
Append one completed line to a channel ring and the ALL ring.
@ k_board_console_ch_ospi
Octal-SPI (xSPI) command summaries.
Decentralized peripheral-block registry for the board emulator core.
void board_periph_register_block(const board_periph_block_t *block)
Register a peripheral block's descriptor with the core registry.
static RA8_INTERNAL void internal_xspi_block_register(void)
Register the xSPI block before main (host constructor).
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 uint64_t internal_xspi_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the xSPI window.
xspi_op_t
JEDEC opcodes the engine decodes (ra8_xspi.c).
@ k_xspi_op_read
Normal read.
@ k_xspi_op_rdid
Read JEDEC ID.
@ k_xspi_op_rdsr
Read status.
@ k_xspi_op_pp
Page program.
@ k_xspi_op_erase
4 KiB sector erase.
@ k_xspi_op_wren
Write enable.
xspi_ctl_field_t
CDCTL0 / INTS bits + CDBUF slot-0 word indices.
@ k_xspi_cdbuf_addr
CDBUF[1] flash address.
@ k_xspi_ints_cmdcmp
CMDCMP: command complete.
@ k_xspi_cdbuf_data1
CDBUF[3] data bytes 4..7.
@ k_xspi_cdbuf_cdt
CDBUF[0] command descriptor.
@ k_xspi_cdctl0_trreq
TRREQ: kick the manual transfer.
@ k_xspi_cdbuf_data0
CDBUF[2] data bytes 0..3.
static RA8_INTERNAL uint32_t internal_xspi_opcode(uint32_t cdt)
Extract the 1/2-byte opcode from a CDT descriptor word.
static xspi_state_t s_xspi
static uint32_t s_xspi_dirty_hi
Exclusive high-water mark of bytes ever programmed/erased this run.
static RA8_INTERNAL void internal_xspi_exec_command(void)
Execute the slot-0 manual command, then raise INTS.CMDCMP.
xspi_console_t
Console-tap line buffer capacity for an xSPI command summary.
@ k_xspi_console_line_cap
Max chars in an "OSPI .. @0x.." line.
static RA8_INTERNAL uint32_t internal_xspi_cdbuf_word(uint32_t w)
Word index of CDBUF slot-0 entry w inside the window shadow.
xspi_map_t
XSPI0 register-window geometry (ra8_ospi_regs.h).
@ k_xspi_off_cdctl0
CDCTL0 (TRREQ bit 0 / CSSEL bit 3).
@ k_xspi_off_ints
INTS (CMDCMP bit 0).
@ k_xspi_off_cdbuf
CDBUF[0..3] for manual slot 0.
@ k_xspi_off_intc
INTC (write-1-to-clear).
@ k_xspi_base
XSPI0 register window base.
@ k_xspi_span
Window covering WRAPCFG..INTE.
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_mark_dirty(uint32_t end_excl)
Raise the dirty high-water mark to cover [0, end_excl).
static RA8_INTERNAL void internal_xspi_report(void)
End-of-run xSPI section: op counts (only if the bus was used).
xspi_lit_t
Backing-flash + register-window sizing and constants.
@ k_xspi_status_wel
RDSR result: WEL=1, WIP=0.
@ 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_words
0x200-byte window as 32-bit words.
@ k_xspi_byte_bits
Bits per byte.
@ k_xspi_erased
NOR erased byte value.
@ k_xspi_jedec_cdd0
{0x9D,0x5A,0x1A} packed for CDD0.
@ k_xspi_sector_len
4 KiB sector (opcode 0x20).
xspi_cdt_field_t
Command-descriptor (CDT) field positions / masks (ra8_ospi_regs.h).
@ k_xspi_cdt_pos_cmdsize
CMDSIZE[1:0] command bytes.
@ k_xspi_cdt_pos_cmd
CMD[31:16] opcode field.
@ k_xspi_cdt_mask_cmdsize
CMDSIZE width.
@ k_xspi_cdt_mask_cmd
CMD field width.
@ k_xspi_cdt_byte
One opcode/data byte.
@ k_xspi_cdt_mask_datasize
DATASIZE width.
@ k_xspi_cdt_pos_datasize
DATASIZE[8:5] data bytes.
static uint8_t s_xspi_flash_neg[k_xspi_flash_size]
Backing NOR array for the full 64 MiB part, stored INVERTED.
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_do_read(uint32_t addr, uint32_t n)
Read n bytes (<= 8) from flash@addr into CDD0/CDD1.
static RA8_INTERNAL void internal_xspi_reset(void)
Reset the xSPI model: zero the window, erase the touched flash prefix.
xspi_order_t
Per-tick / report order slot (after the SD block, before SPI).
@ k_xspi_block_order
Report ordering only.
static const board_periph_block_t s_k_xspi_block
xSPI block descriptor (self-registered with the core).
static RA8_INTERNAL uint8_t internal_xspi_flash_byte(uint32_t addr)
Current flash content byte at addr (0xFF beyond the part).
Bounded raw-descriptor I/O seam for the RA8 emulator.
emu_io_result_t priv_emu_io_errf(const char *format,...)
Format bounded text and write it to the injected error descriptor.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
void * memset(void *dst, int value, size_t n)
Fill memory with a constant byte value.
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.
A modelled peripheral block's self-description for the core registry.
xSPI model state: register-window shadow + op counters.
uint32_t erases
Sector erases.
uint32_t reads
READ commands executed.
uint32_t regs[k_xspi_words]
0x200-byte window shadow.
uint32_t writes
Page-program commands.