41typedef enum : uint32_t {
48typedef enum : uint8_t {
109 __asm__
volatile(
"wfi");
132 uint32_t cpuclk0_hz = 0U;
175 .duty_a = (uint32_t)0U,
176 .duty_b = (uint32_t)0U,
193 uint32_t prev_count = 0U;
194 bool have_prev =
false;
200 uint32_t now_count = 0U;
203 }
else if (have_prev && (now_count == prev_count)) {
206 prev_count = now_count;
209 prev_count = now_count;
void main(void)
Secure fallback main entry point.
static void internal_gpt_pwm_demo_panic_halt(void)
Park the processor after an unrecoverable PWM demo failure.
static void internal_gpt_pwm_demo_setup_or_halt(void)
Initialize clocks, timing, and the PWM demo status LED.
gpt_pwm_demo_chan_t
GPT channel.
@ k_gpt_pwm_demo_channel
GPT PWM demo channel.
gpt_pwm_demo_const_t
Demo tunables.
@ k_gpt_pwm_demo_step_pct
Duty step (>= 64 to stay in 16-bit range).
@ k_gpt_pwm_demo_step_ms
Per-step delay -> ~1.3 s sweep.
@ k_gpt_pwm_demo_period
16-bit period (~61 Hz at 4 MHz / 4).
volatile uint32_t g_gpt_pwm_mismatch
HIL failure counter – incremented whenever a sub-step fails: ra8_gpt_set_duty returned non-ok,...
volatile uint32_t g_gpt_pwm_match
HIL liveness counter – incremented every iteration in which GTCNT advanced relative to the previous s...
static ra8_err_t internal_gpt_pwm_demo_arm(void)
Configure GPT0 for saw-wave PWM with auto_start = true.
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_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
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.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Full-featured General PWM Timer (GPT) driver.
ra8_err_t ra8_gpt_set_duty(uint8_t channel, ra8_gpt_ccr_sel_t which, uint32_t value)
Change one compare register (GTCCRA / GTCCRB) at runtime.
@ k_ra8_gpt_mode_saw_pwm
Saw-wave PWM (up-count).
ra8_err_t ra8_gpt_init(uint8_t channel, const ra8_gpt_cfg_t *cfg)
Initialise a GPT channel with a full config descriptor.
ra8_err_t ra8_gpt_read(uint8_t channel, uint32_t *out)
Read the current counter value.
@ k_ra8_gpt_ps_div_4
PCLKD / 4.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
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.
Configuration descriptor for ra8_gpt_init.