101static const char*
s_tag =
"dtc_coherency_hil";
110typedef enum : uint32_t {
125typedef enum : uint8_t {
141typedef enum : uint16_t {
151typedef enum : uint8_t {
163typedef enum : uint8_t {
177typedef enum : uint8_t {
194typedef enum : uint16_t {
208typedef enum : uint32_t {
215 "CRA=0x0000 encodes a 256-unit block; buffer must be 256 words");
217 "buffer byte count must equal words * 4");
219 "buffer must span at least one D-cache line");
318 __asm__
volatile(
"wfi");
542 if (slot_reg ==
nullptr) {
722 ra8_log_info(
s_tag,
"==== dtc_coherency_hil: M85 D-cache DTC descriptor coherency ====");
732 const uint8_t good = (err ==
k_ra8_ok && ok != 0U) ? 1U : 0U;
void main(void)
Secure fallback main entry point.
static uint32_t s_dtc_vt[k_dtc_arm_vt_entries]
DTC vector table – one 4-byte TI start address per IELSR slot.
static r_dtc_xfer_info_t s_dtc_ti
The 16-byte Transfer Information block the DTC reads each pass.
static uint32_t s_src[k_dtc_arm_buf_words]
Source / destination buffers (32-bit aligned by element type).
static uint16_t s_dtc_slot
IELSR slot allocated for the DTC activation = DTC vector number.
static uint32_t s_dst[k_dtc_arm_buf_words]
static void dtc_coh_fill_buffers(void)
Fill s_src with a deterministic pattern; prime s_dst.
static void dtc_coh_complete_cb(void *ctx, uint16_t status)
DTC completion callback (fanned out by ra8_dtc_dispatch).
dtc_coh_event_t
ELC software event 0 -> ICU event number.
@ k_dtc_coh_event_swevt0
ELC software event 0 (HUM Table 19.3).
static void dtc_coh_program_ti(void)
Write the 16-byte TI block and point the slot's vector entry at it.
dtc_coh_vt_geom_t
DTC vector-table geometry.
@ k_dtc_coh_vt_entries
One pointer per IELSR slot 0..95.
@ k_dtc_coh_vt_align
DTCVBR 1 KiB alignment (HUM 18.2.2).
@ k_dtc_coh_cra_units
Units per block when CRAH/CRAL = 0.
static void dtc_coh_setup_or_halt(void)
Bring CGC + MSTP + ISR + ELC + SCI8 console + LEDs up.
dtc_coh_mr_field_t
DTC Transfer-Information mode-bit field values.
@ k_dtc_coh_dm_inc
MRB.DM[3:2] = 10b: increment DAR.
@ k_dtc_coh_sm_inc
MRA.SM[3:2] = 10b: increment SAR.
@ k_dtc_coh_md_block
MRA.MD[7:6] = 10b: block transfer mode.
@ k_dtc_coh_sz_word
MRA.SZ[5:4] = 10b: 32-bit word units.
static const uint8_t k_dtc_coh_pass_banner[]
Deterministic one-shot HIL success banner (uart_scrape gate).
dtc_coh_count_t
DTC count-register values for one 256-word block.
@ k_dtc_coh_cra_block_256
CRAH = CRAL = 0 => 256-unit block.
@ k_dtc_coh_crb_one_block
CRB = 1 => one block per pass.
static ra8_err_t dtc_coh_arm_slot(void)
Re-arm DTC activation on the slot (set IELSRn.DTCE).
static ra8_err_t dtc_coh_run_once(uint8_t *out_ok)
Clean src + TI, enable + trigger the DTC, then wait for the copy.
static void dtc_coh_park(void)
Park the Cortex-M85 forever in a WFI idle loop.
dtc_coh_mr_pos_t
Bit positions inside the DTC TI MR word.
@ k_dtc_coh_mra_byte_pos
MRA byte offset within MR.
@ k_dtc_coh_mra_md_pos
MRA.MD field position.
@ k_dtc_coh_mra_sz_pos
MRA.SZ field position.
@ k_dtc_coh_mrb_byte_pos
MRB byte offset within MR.
@ k_dtc_coh_mrb_dm_pos
MRB.DM field position.
@ k_dtc_coh_mra_sm_pos
MRA.SM field position.
dtc_coh_swevt_t
ELSEGRn index fired by ra8_elc_software_trigger.
@ k_dtc_coh_swevt_index
ELSEGR0 -> ELC_SWEVT0 (0x0CC).
static void dtc_coh_swevt_isr(void *ctx)
IELSR-slot ISR for the DTC-complete interrupt (masked in this app).
dtc_coh_config_t
Compile-time scalar parameters for the DTC coherency self-test.
@ k_dtc_coh_buf_bytes
Bytes copied per pass (>= 256, 1 KiB).
@ k_dtc_coh_baud
VCOM console line rate (8N1).
@ k_dtc_coh_poll_limit
Bounded wait for the copy to land in RAM.
@ k_dtc_coh_buf_words
32-bit words per buffer (256 x 4).
@ k_dtc_coh_sentinel
Destination pre-fill; no-op copy fails.
static const uint8_t k_dtc_coh_fail_banner[]
Failure banner: the copy was wrong, absent, or timed out.
dtc_coh_byte_t
Single-byte scalar constants for the self-test.
@ k_dtc_coh_isr_prio
NVIC priority for the DTC-complete slot.
@ k_dtc_coh_align
D-cache line size (bytes).
@ k_dtc_coh_byte_sh
Source-pattern shift (i ^ (i >> 8)).
static void dtc_coh_bringup_or_halt(void)
Initialise the DTC and allocate its ELC-software-event activation slot.
static void dtc_coh_report(uint8_t ok)
Emit the PASS/FAIL result over VCOM and ITM, toggle an LED.
static uint8_t dtc_coh_verify(void)
Verify s_dst matches s_src element-by-element.
static const char * s_tag
Logging / check tag.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
ra8_err_t ra8_board_uart_console_flush(void)
Block until every byte queued on the J-Link OB VCOM console has finished clocking out on the wire.
Boot entry points shared between a vector table and its startup code.
Cortex-M85 L1 cache maintenance, enable/disable, and I-cache invalidate.
ra8_err_t ra8_cache_dcache_invalidate_by_addr(const void *addr, uint32_t size)
Invalidate (drop) the D-cache lines covering a byte range.
ra8_err_t ra8_cache_dcache_clean_by_addr(const void *addr, uint32_t size)
Clean (write back) the D-cache lines covering a byte range.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Data Transfer Controller (DTC) driver.
void ra8_dtc_dispatch(void)
Fire the attached activation callback with current DTCSTS.
ra8_err_t ra8_dtc_attach_handler(ra8_dtc_event_fn_t fn, void *ctx)
Attach a shared activation-complete callback.
ra8_err_t ra8_dtc_enable(void)
Start the DTC module.
ra8_err_t ra8_dtc_init(void *vector_base)
Initialise the DTC and install its vector table base.
DTC (Data Transfer Controller) register layout for the RA8D2.
Event Link Controller driver.
ra8_err_t ra8_elc_init(void)
Reset the ELC register block and enable the controller.
ra8_err_t ra8_elc_software_trigger(uint8_t event_index)
Fire a software event via one of the ELSEGRn registers.
ra8_elc_event_t
Partial list of ELC events (populate as drivers need them).
Error Code Definitions for ra8-firmware.
@ k_ra8_err_hw_timeout
Hardware timed out waiting for a flag or handshake.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_hw_error
Generic hardware fault detected (error flag set, fault interrupt).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Interrupt Control Unit (ICU) register layout for the Renesas RA8D2.
static volatile uint32_t * ra8_icu_ielsr(uint16_t index)
Get pointer to IELSR register N.
@ k_ra8_ielsr_dtce_mask
DTCE bit mask.
NVIC + ICU IELSR allocator.
ra8_err_t ra8_isr_init(void)
Initialise the ra8_isr table.
ra8_err_t ra8_isr_register(ra8_elc_event_t event, ra8_isr_handler_t handler, void *ctx, uint8_t priority, uint16_t *out_slot)
Allocate an IELSR slot for an ELC event + handler.
Lightweight Logging Interface for ra8-firmware.
void ra8_log_init(void)
Initialise the logging backend.
#define ra8_log_info(tag, message)
RA8 log info.
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
One 16-byte Transfer Information (TI) block referenced by the DTC vector table.