55typedef enum : uint32_t {
61typedef enum : uint8_t {
87 __asm__
volatile(
"wfi");
107 uint32_t cpuclk0_hz = 0U;
177 for (uint8_t i = 0U; i < n; i++) {
178 buf[i] = tmp[(uint8_t)(n - 1U - i)];
207 const uint8_t prefix[] =
"elc: en=";
208 const uint8_t mid[] =
" trig=";
209 const uint8_t suffix[] =
"\r\n";
210 for (uint32_t i = 0U; i <
sizeof(prefix) - 1U; i++) {
211 out[off++] = prefix[i];
214 for (uint32_t i = 0U; i <
sizeof(mid) - 1U; i++) {
218 for (uint32_t i = 0U; i <
sizeof(suffix) - 1U; i++) {
219 out[off++] = suffix[i];
240 uint32_t trig_count = 0U;
248 const uint8_t trig_fail[] =
"elc: FAIL trigger\r\n";
253 bool enabled =
false;
256 const uint8_t enabled_fail[] =
"elc: FAIL is_enabled\r\n";
void main(void)
Secure fallback main entry point.
static void internal_setup_or_halt(void)
Bring up clocks, MSTP, delay timing, and the board console.
static void internal_panic_halt(void)
Park the core after an unrecoverable ADC demo failure.
static uint8_t internal_uint_to_dec(uint8_t *buf, uint32_t v)
Write a decimal uint32 into buf.
elc_demo_byte_t
ELC slot / software-event indices used by the demo.
@ k_elc_demo_uint_dec_max
Max digits in a uint32 base-10.
@ k_elc_demo_dec_base
Elc demo dec base.
@ k_elc_demo_print_buf
Max bytes in one print line.
@ k_elc_demo_ascii_one
Elc demo ascii one.
@ k_elc_demo_slot
ELSR0 – arbitrary; HUM Tbl 19.2 maps to GPT capture.
@ k_elc_demo_ascii_zero
Elc demo ascii zero.
@ k_elc_demo_sw_event_idx
ELSEGR0 – software event 0.
static uint32_t internal_format_line(uint8_t *out, bool enabled, uint32_t trig_count)
Format the per-cycle "elc: en=N trig=NN\r\n" line.
elc_demo_const_t
App-wide tunables.
@ k_elc_demo_period_ms
Elc demo period ms.
@ k_elc_demo_baud
Elc demo baud.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
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).
ra8_err_t ra8_board_led_on(ra8_board_led_id_t led)
Drive led HIGH (light it).
@ 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.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Event Link Controller driver.
ra8_err_t ra8_elc_link(uint8_t elsr_index, ra8_elc_event_t event)
Route an ELC event to an ELSR slot so the destination peripheral triggers on it.
ra8_err_t ra8_elc_is_enabled(bool *out_enabled)
Read ELCR.ELCON to verify the global enable state.
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.
Event Link Controller (ELC) register layout for the Renesas RA8D2.
@ k_ra8_elc_event_icu_irq0
External pin interrupt 0.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
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.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.