60typedef enum : uint32_t {
65typedef enum : uint64_t {
73typedef enum : uint64_t {
91typedef enum : uint8_t {
112typedef enum : uint32_t {
127typedef enum : uint16_t {
132typedef enum : uint32_t {
251 const uint32_t ch = (uint32_t)(rel / (uint64_t)
k_ulpt_stride);
259 for (
unsigned i = 0U; i < size; i++) {
260 const uint32_t b = lane + (uint32_t)i;
261 if (b < (uint32_t)
sizeof(uint32_t)) {
262 const uint32_t lane_byte =
287 c->
cr = (uint8_t)(start | (start != 0U ? (uint8_t)
k_ulpt_cr_tcstf : 0U) | status_keep);
307 const uint32_t ch = (uint32_t)(rel / (uint64_t)
k_ulpt_stride);
319 c->
reload = (uint32_t)value;
322 c->
cmpa = (uint32_t)value;
325 c->
cmpb = (uint32_t)value;
330 c->
mr1 = (uint8_t)value;
333 c->
mr2 = (uint8_t)value;
336 c->
mr3 = (uint8_t)value;
339 c->
ioc = (uint8_t)value;
372 const uint32_t span = c->
reload + 1U;
373 const uint32_t deficit = step - c->
counter;
401 for (uint32_t ch = 0U; ch < (uint32_t)
k_ulpt_count; ch++) {
421 for (uint32_t ch = 0U; ch < (uint32_t)
k_ulpt_count; ch++) {
436 for (uint32_t ch = 0U; ch < (uint32_t)
k_ulpt_count; ch++) {
441 (void)
priv_emu_io_errf(
" ULPT%u : counter=0x%08X underflows=%u (running=%s)\n",
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 RA8_INTERNAL void internal_ulpt_tick_channel(uc_engine *uc, uint32_t ch)
Advance one running ULPT channel by one chunk; raise its underflow event.
ulpt_event_t
ULPT0 underflow ELC event the model emits (HUM Ch 19 ELC).
@ k_ulpt_event_ch0_underflow
ULPT0_ULPTI underflow event.
ulpt_order_t
Per-tick order slot for the ULPT block.
@ k_ulpt_block_order
ULPT tick / reset / report order slot.
static RA8_INTERNAL void internal_ulpt_report(void)
Print each ULPT channel that underflowed at least once.
static RA8_INTERNAL uint64_t internal_ulpt_cell_base(uint64_t off)
Byte offset of the start of the register cell that contains off.
static RA8_INTERNAL void internal_ulpt_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
Write size bytes little-endian into the addressed ULPT channel.
static RA8_INTERNAL void internal_board_periph_ulpt_register(void)
Self-register the ULPT window before main runs (decentralized).
ulpt_off_t
ULPT per-channel register byte offsets (ra8_ulpt_regs.h).
@ k_ulpt_off_mr2
ULPTMR2 mode 2 (8-bit).
@ k_ulpt_off_cma
ULPTCMA compare match A (32-bit).
@ k_ulpt_off_mr3
ULPTMR3 mode 3 (8-bit).
@ k_ulpt_off_cmb
ULPTCMB compare match B (32-bit).
@ k_ulpt_off_cnt
ULPTCNT counter / reload (32-bit).
@ k_ulpt_off_ioc
ULPTIOC I/O control (8-bit).
@ k_ulpt_off_cr
ULPTCR control / status (8-bit).
@ k_ulpt_off_mr1
ULPTMR1 mode 1 (8-bit).
static const board_periph_block_t s_k_ulpt_block
ULPT register window + the down-count tick / reset / report.
ulpt_geom_t
ULPT register window geometry (ra8_ulpt_regs.h).
@ k_ulpt_stride
Bytes per channel (ULPT0 -> ULPT1).
@ k_ulpt_span
Whole-block window (both channels).
@ k_ulpt_base
ULPT0 base (FSP R_ULPT0_BASE).
@ k_ulpt_count
ULPT0 and ULPT1.
static RA8_INTERNAL void internal_ulpt_tick(uc_engine *uc)
Advance every running ULPT channel one chunk.
ulpt_rate_t
Down-count step applied per emulation chunk while a channel runs.
@ k_ulpt_step_per_chunk
256 Ki ticks/chunk: example periods underflow on the first idle tick.
static RA8_INTERNAL void internal_ulpt_reset(void)
Clear every ULPT channel to its power-on state.
static RA8_INTERNAL uint32_t internal_ulpt_cell_value(const ulpt_channel_t *c, uint64_t off)
Current 32-bit value of the register cell that contains off.
ulpt_byte_t
Sub-word access constants for the byte-granular MMIO path.
@ k_ulpt_byte_bits
Bits per byte lane.
@ k_ulpt_byte_mask
Low 8 bits of a register lane.
static RA8_INTERNAL void internal_ulpt_write_cr(ulpt_channel_t *c, uint8_t value)
Apply a write to ULPTCR: TSTART arms, TCSTF tracks it, TUNDF clears on 0.
static RA8_INTERNAL uint64_t internal_ulpt_read(uc_engine *uc, uint64_t addr, unsigned size)
Read size bytes little-endian from the addressed ULPT channel.
static ulpt_channel_t s_ulpt[k_ulpt_count]
ulpt_cr_bit_t
ULPTCR control / status bit masks.
@ k_ulpt_cr_tstop
TSTOP forced-stop request (bit 2, W).
@ k_ulpt_cr_tundf
TUNDF underflow flag (bit 5, write-0-clear).
@ k_ulpt_cr_tcstf
TCSTF count-status flag (bit 1, RO).
@ k_ulpt_cr_tstart
TSTART start request (bit 0, RW).
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).
A modelled peripheral block's self-description for the core registry.
One modelled ULPT channel: a 32-bit reloading down-counter + status.
uint32_t cmpa
ULPTCMA compare match A.
uint8_t mr1
ULPTMR1 mode 1.
uint32_t cmpb
ULPTCMB compare match B.
uint8_t ioc
ULPTIOC I/O control.
uint8_t mr3
ULPTMR3 mode 3.
uint32_t reload
Value last written to ULPTCNT.
uint8_t cr
ULPTCR control / status.
uint32_t underflows
Underflow event count (report).
uint32_t counter
Live ULPTCNT count.
uint8_t mr2
ULPTMR2 mode 2.