52typedef enum : uint32_t {
70typedef enum : uint32_t {
75typedef enum : uint64_t {
83typedef enum : uint64_t {
89typedef enum : uint64_t {
104typedef enum : uint8_t {
112typedef enum : uint32_t {
124typedef enum : uint32_t {
132typedef enum : uint32_t {
137typedef enum : uint32_t {
151typedef enum : uint16_t {
224 uint64_t total = (uint64_t)count * (uint64_t)blocks;
228 return (uint32_t)total;
246 uint64_t src = (uint64_t)c->
dmsar;
247 uint64_t dst = (uint64_t)c->
dmdar;
253 for (uint32_t i = 0U; i < units; i++) {
268 c->
dmsar = (uint32_t)src;
269 c->
dmdar = (uint32_t)dst;
301 "DMAC%u %u units x %uB",
388 c->
dmtmd = (uint16_t)value;
391 c->
dmamd = (uint16_t)value;
397 c->
dmint = (uint8_t)value;
400 c->
dmcnt = (uint8_t)value;
404 c->
dmsts &= (uint8_t)value;
502 for (
unsigned i = 0U; i < size; i++) {
503 const uint64_t b = off + (uint64_t)i;
505 v |= (uint64_t)shadow[b] << (8U * i);
527 for (
unsigned i = 0U; i < size; i++) {
528 const uint64_t b = off + (uint64_t)i;
530 shadow[b] = (uint8_t)(value >> (8U * i));
595 for (uint32_t i = 0U; i < (uint32_t)
k_dmac_count; i++) {
613 for (uint32_t ch = 0U; ch < (uint32_t)
k_dmac_count; ch++) {
614 if (
s_dmac[ch].copies > 0U) {
615 (void)
priv_emu_io_errf(
" DMAC%u : transfers=%u last_units=%u DMSTS=0x%02X\n",
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_dma
DMAC + DTC transfer-complete summaries.
@ k_u16_mask
16-bit field.
Decentralized peripheral-block registry for the board emulator core.
void board_periph_icu_raise_event(uc_engine *uc, uint16_t event)
Raise a peripheral ELC event through the core's ICU -> NVIC path.
void board_periph_register_block(const board_periph_block_t *block)
Register a peripheral block's descriptor with the core registry.
bool board_periph_trace(void)
Whether –trace is active (blocks log transitions when true).
static uint8_t s_dma_shared[k_dma_shared_span]
Shared DMA module-control bank shadow (DMAST / DMCTL / DELSR).
dmac_am_t
DMAMD address-update fields (ra8_dmac_regs.h).
@ k_dmac_dm_pos
DMAMD.DM destination-update position.
@ k_dmac_am_incr
10b: increment after each unit.
@ k_dmac_am_mask
Address-update field width (2 bits).
@ k_dmac_sm_pos
DMAMD.SM source-update position.
static RA8_INTERNAL void internal_dmac_report(void)
Print one line per DMAC channel that completed any transfer.
static RA8_INTERNAL uint64_t internal_dmac_reg_read(uint32_t ch, uint64_t off)
Dispatch a DMAC channel register read for channel ch.
static RA8_INTERNAL void internal_dmac_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the DMAC0 channel window.
static RA8_INTERNAL void internal_board_periph_dmac_register(void)
Self-register the DMAC0 / shared module-control windows before main.
static RA8_INTERNAL void internal_dma_shared_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the shared DMA module-control bank.
dmac_console_t
Console-tap line buffer capacity for a DMAC transfer summary.
@ k_dmac_console_line_cap
Max chars in a "DMAC.. .. units" line.
dmac_dmcra_t
DMCRA low half holds the running transfer count (bits 0..9).
@ k_dmac_dmcra_low_mask
DMCRA.DMCRAL count field.
dmac_bit_t
DMCNT / DMREQ / DMSTS bit masks (ra8_dmac_regs.h).
@ k_dmac_swreq_mask
DMREQ.SWREQ software request.
@ k_dmac_dte_mask
DMCNT.DTE channel-enable.
@ k_dmac_act_mask
DMSTS.ACT active flag.
@ k_dmac_dtif_mask
DMSTS.DTIF transfer-end flag.
static RA8_INTERNAL uint64_t internal_dma_shared_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the shared DMA module-control bank.
static RA8_INTERNAL void internal_shadow_write(uint8_t *shadow, uint64_t span, uint64_t off, unsigned size, uint64_t value)
Write size bytes little-endian into a byte-array shadow.
dmac_off_t
Per-channel register byte offsets (subset the driver touches).
@ k_dmac_off_dmint
Interrupt setting (DTIE et al.).
@ k_dmac_off_dmreq
Software start (SWREQ / CLRS).
@ k_dmac_off_dmsts
Status (ESIF / DTIF / ACT).
@ k_dmac_off_dmdar
Destination address (32-bit).
@ k_dmac_off_dmamd
Address mode (SM / DM).
@ k_dmac_off_dmcnt
Transfer enable (DTE bit0).
@ k_dmac_off_dmofr
Offset register.
@ k_dmac_off_dmcrb
Block transfer count.
@ k_dmac_off_dmsar
Source address (32-bit).
@ k_dmac_off_dmtmd
Transfer mode (SZ / MD / DTS).
@ k_dmac_off_dmcra
Transfer count (low/high halves).
static RA8_INTERNAL void internal_dmac_copy_units(uc_engine *uc, dmac_chan_t *c, uint32_t units, uint32_t unit)
Copy units of unit bytes src->dst in emulated memory.
static RA8_INTERNAL void internal_dmac_run_transfer(uc_engine *uc, uint32_t ch)
Run one software-triggered transfer on channel ch.
static const board_periph_block_t s_k_dmac_block
DMAC0 channel window + the combined reset / report.
dmac_event_t
DMAC0 transfer-end ELC event the model emits (FSP ra8d2 bsp_elc).
@ k_dmac_event_ch0
DMAC0 channel-0 transfer-end event.
static RA8_INTERNAL uint64_t internal_dmac_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the DMAC0 channel window.
static RA8_INTERNAL uint32_t internal_dmac_total_units(const dmac_chan_t *c)
Total units one software trigger transfers for channel c.
dmac_order_t
Per-tick order slot for the DMAC / DTC windows.
@ k_dmac_block_order
DMAC / DMA / DTC reset+report order slot.
dmac_sz_t
DMTMD.SZ transfer-width field (bits 8..9) and unit sizes.
@ k_dmac_sz_pos
DMTMD.SZ field position.
@ k_dmac_sz_half
01b: 16-bit unit.
@ k_dmac_unit_half
Bytes moved per half-width unit.
@ k_dmac_sz_byte
00b: 8-bit unit.
@ k_dmac_sz_word
10b: 32-bit unit.
@ k_dmac_unit_byte
Bytes moved per byte-width unit.
@ k_dmac_unit_word
Bytes moved per word-width unit.
@ k_dmac_sz_mask
DMTMD.SZ field width (2 bits).
static RA8_INTERNAL uint32_t internal_dmac_unit_bytes(uint32_t sz_code)
Bytes moved per unit for a DMTMD.SZ code (defaults to byte width).
dmac_geom_t
DMAC0 per-channel window geometry (ra8_dmac_regs.h).
@ k_dmac_count
DMAC0 channel 0..7.
@ k_dmac_stride
Bytes per DMAC channel.
@ k_dmac_base
DMAC0 channel 0 base.
static RA8_INTERNAL uint64_t internal_shadow_read(const uint8_t *shadow, uint64_t span, uint64_t off, unsigned size)
Read size bytes little-endian from a byte-array shadow.
static const board_periph_block_t s_k_dma_shared_block
Shared DMA module-control bank window (transparent shadow).
dmac_lit_t
Field mask for the DMAC block-count register.
static RA8_INTERNAL void internal_dmac_reg_store(dmac_chan_t *c, uint64_t off, uint32_t value)
Apply a DMAC channel register write (non-trigger registers).
static dmac_chan_t s_dmac[k_dmac_count]
static RA8_INTERNAL void internal_dmac_reset(void)
Clear all DMAC channel state plus the shared module-control shadow.
dma_shared_geom_t
Shared DMA module-control bank geometry (R_DMA at 0x4000A800).
@ k_dma_shared_span
FSP R_DMA_Type size.
@ k_dma_shared_base
DMAST / DMCTL / DMECHR / DELSR.
static RA8_INTERNAL void internal_dmac_reg_write(uc_engine *uc, uint32_t ch, uint64_t off, uint32_t value)
Dispatch a DMAC channel register write; DMREQ.SWREQ triggers a copy.
dmac_limit_t
A bounded ceiling on units copied per trigger (safety net).
@ k_dmac_max_units
Largest one-trigger unit count.
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.
uc_err emu_mem_read(uc_engine *uc, uint64_t address, void *bytes, size_t count)
Read guest memory through the central access seam.
uc_err emu_mem_write(uc_engine *uc, uint64_t address, const void *bytes, size_t count)
Write guest memory through the central access seam.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
A modelled peripheral block's self-description for the core registry.
One DMAC channel's modelled register shadow.
uint32_t units
Units moved by the last copy.
uint32_t copies
Completed transfers (report).
uint8_t dmsts
DMSTS status flags.
uint32_t dmsar
DMSAR source address.
uint16_t dmtmd
DMTMD transfer mode.
uint16_t dmamd
DMAMD address mode.
uint8_t dmcnt
DMCNT transfer enable.
uint32_t dmcra
DMCRA transfer count.
uint8_t dmint
DMINT interrupt setting.
uint32_t dmdar
DMDAR destination address.
uint32_t dmcrb
DMCRB block transfer count.
uint32_t dmofr
DMOFR offset register.