59typedef enum : uint32_t {
64typedef enum : uint64_t {
74typedef enum : uint64_t {
81typedef enum : uint32_t {
87typedef enum : uint32_t {
96typedef enum : uint32_t {
113typedef enum : uint32_t {
118typedef enum : uint32_t {
126typedef enum : uint32_t {
265 uint32_t per_block = ti->
cra;
266 uint32_t blocks = 1U;
271 blocks = (ti->
crb == 0U) ? 1U : ti->
crb;
273 const uint32_t units = per_block * blocks;
299 uint64_t local_addr = (uint64_t)ti->
sar;
300 uint64_t d_addr = (uint64_t)ti->
dar;
301 const uint64_t local_step = (ti->
sm == (uint32_t)
k_mr_addr_inc) ? (uint64_t)unit : 0U;
302 const uint64_t d_step = (ti->
dm == (uint32_t)
k_mr_addr_inc) ? (uint64_t)unit : 0U;
303 for (uint32_t i = 0U; i < units; ++i) {
307 local_addr += local_step;
335 s_dtc.bytes = units * unit;
339 (void)snprintf(ln,
sizeof(ln),
"DTC %u units x %uB", (
unsigned)units, (
unsigned)unit);
354 if (
s_dtc.dtcvbr == 0U) {
361 const uint64_t vt_entry =
388 for (uint32_t i = 0U; i < (uint32_t)
k_elc_span; ++i) {
410 const uint64_t off = addr - (uint64_t)
k_dtc_base;
443 const uint64_t off = addr - (uint64_t)
k_dtc_base;
445 s_dtc.dtccr = (uint8_t)value;
447 s_dtc.dtcvbr = (uint32_t)value;
449 s_dtc.dtcst = (uint8_t)value;
451 s_dtc.dtcsts = (uint16_t)value;
471 const uint64_t off = addr - (uint64_t)
k_elc_base;
473 for (
unsigned i = 0U; (i < size) && ((off + (uint64_t)i) < (uint64_t)
k_elc_span); ++i) {
474 v |= (uint64_t)
s_elc[off + (uint64_t)i] << (8U * i);
494 const uint64_t off = addr - (uint64_t)
k_elc_base;
495 for (
unsigned i = 0U; (i < size) && ((off + (uint64_t)i) < (uint64_t)
k_elc_span); ++i) {
496 s_elc[off + (uint64_t)i] = (uint8_t)(value >> (8U * i));
516 if (
s_dtc.activations == 0U) {
519 (void)
priv_emu_io_errf(
" DTC : activations=%u last_bytes=%u DTCVBR=0x%08X\n",
548 .name =
"ELC/DTC-trig",
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.
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.
uint32_t board_periph_icu_dtc_slot(uint16_t event)
Find the IELSR slot that activates the DTC for an ELC event.
@ k_mrb_dm_pos
MRB.DM[3:2] dest-address mode.
@ k_mra_md_pos
MRA.MD[7:6] transfer mode.
@ k_mra_sz_half
SZ = 01b: 16-bit unit.
@ k_mra_sz_word
SZ = 10b: 32-bit unit.
@ k_mra_sm_pos
MRA.SM[3:2] source-address mode.
@ k_mr_mra_shift
MRA occupies MR[31:24].
@ k_mr_byte_mask
Eight-bit field mask (one MRA/MRB byte).
@ k_mra_md_block
MD = 10b: block transfer.
@ k_mr_addr_inc
SM / DM = 10b: increment the address.
@ k_mra_sz_byte
SZ = 00b: 8-bit unit.
@ k_mr_mrb_shift
MRB occupies MR[23:16].
@ k_mr_2bit_mask
Two-bit field mask.
@ k_mra_sz_pos
MRA.SZ[5:4] unit width.
static RA8_INTERNAL uint32_t internal_dtc_mem_read(uc_engine *uc, uint64_t addr, uint32_t bytes)
Read a little-endian word of bytes from emulated memory.
static const board_periph_block_t s_k_dtc_block
DTC control-window descriptor (owns reset + report).
static RA8_INTERNAL uint64_t internal_elc_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the ELC window (transparent byte shadow).
static RA8_INTERNAL void internal_dtc_block_register(void)
Register the DTC control + ELC ELSEGR windows before main runs.
static RA8_INTERNAL void internal_elc_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the ELC window: byte shadow + ELSEGR0 trigger.
static RA8_INTERNAL void internal_dtc_run_transfer(uc_engine *uc, uint32_t ti_addr)
Perform the SAR->DAR copy described by one TI block.
@ k_dtc_max_units
Sanity cap on a single activation.
@ k_dtc_vt_entry_bytes
One 4-byte pointer per IELSR slot.
@ k_dtc_ti_addr_mask
Strip bit0 (privilege attribute).
@ k_dtc_ielsr_slots
Number of IELSR slots (0..95).
dtc_console_t
Console-tap line buffer capacity for a DTC transfer summary.
@ k_dtc_console_line_cap
Max chars in a "DTC .. units" line.
static RA8_INTERNAL uint32_t internal_dtc_unit_count(const dtc_ti_t *ti)
Total unit count a descriptor moves, or 0 if it is out of range.
static RA8_INTERNAL void internal_dtc_decode_ti(uc_engine *uc, uint32_t ti_addr, dtc_ti_t *out)
Read and decode the TI block at ti_addr into out.
static RA8_INTERNAL void internal_dtc_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the DTC control window.
dtc_ti_off_t
DTC TI block field offsets (r_dtc_xfer_info_t, HUM Figure 18.4).
@ k_ti_off_sar
SAR source address.
@ k_ti_off_dar
DAR destination address.
@ k_ti_off_cra
CRA transfer count (16b).
@ k_ti_off_crb
CRB block count (16b).
@ k_ti_off_mr
MR mode word ([31:24] MRA, [23:16] MRB).
static RA8_INTERNAL uint32_t internal_dtc_unit_bytes(uint32_t sz_code)
Bytes per unit for an MRA.SZ code (defaults to byte width).
@ k_dtc_block_cra_zero
Block mode CRA = 0 encodes a 256-unit block.
static uint8_t s_elc[k_elc_span]
ELC register-window shadow (ELCR / ELSEGR / ELSR).
static RA8_INTERNAL void internal_dtc_activate_swevt0(uc_engine *uc)
Run the DTC for ELC software event 0 if a DTCE slot links it.
static RA8_INTERNAL void internal_dtc_copy_units(uc_engine *uc, const dtc_ti_t *ti, uint32_t units, uint32_t unit)
Copy units units of unit bytes from SAR to DAR.
static RA8_INTERNAL void internal_dtc_reset(void)
Reset the DTC model (and the ELC shadow) to power-on state.
elc_swevt_t
ELC software event 0 number and its ELSEGR trigger value.
@ k_elc_swevt0_event
ELC_SWEVT0 event (HUM Table 19.3).
@ k_elc_elsegr_trigger
WE=1, SEG=1: fires the software event.
static RA8_INTERNAL void internal_dtc_report(void)
End-of-run DTC section: activations and bytes moved.
dtc_geom_t
DTC control-window geometry (ra8_dtc_regs.h, r_dtc_regs_t).
@ k_dtc_off_dtcst
DTCST module start (8b).
@ k_dtc_base
DTC control-register base.
@ k_dtc_off_dtcvbr
DTCVBR vector base (32b).
@ k_dtc_off_dtcsts
DTCSTS status (16b).
@ k_dtc_span
Covers DTCCR..DTCSQE comfortably.
@ k_dtc_off_dtccr
DTCCR control (8b).
dtc_order_t
Per-tick order slot for the DTC block (relative order only).
@ k_dtc_block_order
Just after the DMAC block; report order.
elc_geom_t
ELC ELSEGR-window geometry (ra8_elc_regs.h).
@ k_elc_off_elsegr0
ELSEGR0 software-event gen (8b).
@ k_elc_span
Covers ELCR / ELSEGR[0..3] / ELSR.
static RA8_INTERNAL uint64_t internal_dtc_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the DTC control window.
static const board_periph_block_t s_k_elc_block
ELC ELSEGR-window descriptor (the DTC activation trigger).
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.
dtc_mr_field_t
DTC Transfer-Information mode-bit field values.
dtc_vt_geom_t
DTC vector-table geometry.
dtc_count_t
DTC count-register values for one 256-word block.
#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.
DTC control-register state plus an activation/byte tally.
uint16_t dtcsts
DTCSTS status shadow.
uint8_t dtccr
DTCCR shadow.
uint32_t activations
Successful DTC activations performed.
uint32_t dtcvbr
DTCVBR vector-table base address.
uint32_t bytes
Bytes moved on the last activation.
uint8_t dtcst
DTCST module-start shadow.
One Transfer Information block, decoded from emulated memory.
uint32_t cra
CRA transfer count (block size in block mode).
uint32_t sar
SAR source address.
uint32_t md
MRA.MD transfer mode (normal / repeat / block).
uint32_t crb
CRB block count.
uint32_t dar
DAR destination address.
uint32_t dm
MRB.DM destination address mode.
uint32_t sm
MRA.SM source address mode.
uint32_t sz
MRA.SZ unit-width code (see internal_dtc_unit_bytes).