36static const char*
s_tag =
"ULPT";
50typedef enum : uint32_t {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_ISR_SAFE
The function is callable from interrupt context.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_hw_init_failed
Hardware peripheral failed to initialise.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ 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.
Bounded wait-flag primitives for RA8D2 HAL drivers.
static ra8_err_t ra8_hw_wait_flag_clear8(volatile const uint8_t *reg, uint8_t mask, uint32_t budget)
Spin until (*reg & mask) == 0 or budget runs out.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
#define ra8_log_info(tag, message)
RA8 log info.
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_enable(ra8_mstp_t id)
Reference-counted "ungate this peripheral" request.
ra8_err_t ra8_mstp_disable(ra8_mstp_t id)
Reference-counted "gate this peripheral" request.
ra8_mstp_t
Packed (reg << 8) | bit module-stop identifier.
@ k_ra8_mstp_ulpt1
MSTPE8 ULPT1.
@ k_ra8_mstp_ulpt0
MSTPE9 ULPT0.
ra8_err_t ra8_ulpt_enter_stop(uint8_t channel)
Drop the MSTP reference for one ULPT channel (low-power gate).
ra8_err_t ra8_ulpt_deinit(uint8_t channel)
Tear down one ULPT channel and drop its MSTP reference.
ra8_ulpt_poll_t
Bounded poll budget for the ra8_ulpt_stop halt confirmation.
@ k_ra8_ulpt_stop_poll_max
Max TCSTF-low poll iterations.
void ra8_ulpt_dispatch(uint8_t channel)
Fire the registered ULPT callback for channel (ISR helper).
ra8_err_t ra8_ulpt_set_period(uint8_t channel, uint32_t period)
Update the 32-bit reload value for a running ULPT channel.
static ra8_ulpt_event_fn_t s_ulpt_fn
static const ra8_mstp_t s_ulpt_mstp_table[]
Channel-index -> MSTP id lookup.
ra8_err_t ra8_ulpt_attach_handler(ra8_ulpt_event_fn_t fn, void *ctx)
Register the global ULPT ISR callback (NULL detaches).
ra8_err_t ra8_ulpt_get_status(uint8_t channel, uint8_t *out_mask)
Read the ULPTCR control / status register for channel.
ra8_err_t ra8_ulpt_stop(uint8_t channel)
Stop a ULPT channel and confirm the counter has halted.
ra8_err_t ra8_ulpt_exit_stop(uint8_t channel)
Re-enable the MSTP gate for one ULPT channel after stop.
ra8_err_t ra8_ulpt_init(void)
Reset both ULPT channels to their power-on state.
ra8_err_t ra8_ulpt_start(uint8_t channel, uint32_t period)
Start a ULPT channel counting down from period.
Ultra-Low-Power Timer (ULPT) driver header.
void(* ra8_ulpt_event_fn_t)(void *ctx, uint8_t channel)
ULPT event callback.
Ultra-Low-Power Timer (ULPT) register layout for the Renesas RA8D2.
@ k_ra8_ulpt_mask_tstart
TSTART bit.
@ k_ra8_ulpt_mask_tstop
TSTOP bit.
@ k_ra8_ulpt_mask_tcstf
TCSTF count-status flag (RO).
@ k_ra8_ulpt_channel_count
ULPT0 and ULPT1.
static volatile r_ulpt_regs_t * ra8_ulpt(uint8_t channel)
Get pointer to ULPT channel channel.
Per-channel ULPT register window.
volatile uint8_t ULPTMR1
+0x0D Mode register 1.
volatile uint8_t ULPTIOC
+0x10 I/O control.
volatile uint8_t ULPTMR2
+0x0E Mode register 2.
volatile uint32_t ULPTCNT
+0x00 Counter / reload (32-bit).
volatile uint8_t ULPTMR3
+0x0F Mode register 3.
volatile uint8_t ULPTCR
+0x0C Control register.