61typedef enum : uint8_t {
78typedef enum : uint8_t {
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_err_t ra8_power_profile_get_stats(ra8_power_profile_stats_t *out_stats)
Copy the current statistics snapshot to the caller.
ra8_err_t ra8_power_profile_mark_enter(ra8_power_profile_region_id_t region_id)
Mark entry into a tracked region.
ra8_err_t ra8_power_profile_mark_exit(ra8_power_profile_region_id_t region_id)
Mark exit from a tracked region.
ra8_power_profile_region_id_t
Default named region IDs.
@ k_ra8_power_profile_region_deep_standby
Deep-software-standby mode.
@ k_ra8_power_profile_region_active
CPU active / running mode.
@ k_ra8_power_profile_region_user_0
First freely-assignable user slot.
@ k_ra8_power_profile_region_snooze
Snooze (peripheral-driven wake).
@ k_ra8_power_profile_region_sleep
Sleep mode (CPU clock stopped).
@ k_ra8_power_profile_region_software_standby
Software-standby mode.
ra8_err_t ra8_power_profile_reset_stats(void)
Zero every accumulator (preserves the configured hooks).
ra8_power_profile_limits_t
Static sizing constants for the profiler.
@ k_ra8_power_profile_max_regions
Maximum number of distinct regions tracked.
ra8_err_t ra8_power_profile_init(const ra8_power_profile_config_t *cfg)
Initialise the power profiler.
void(* ra8_power_profile_gpio_pulse_fn_t)(void *ctx, ra8_power_profile_region_id_t region_id, bool entering)
GPIO-toggle hook used to emit profiler edges.
uint64_t(* ra8_power_profile_now_us_fn_t)(void *ctx)
Wall-clock timestamp hook (microseconds since some epoch).
Initialisation configuration.
void * user_ctx_gpio
Opaque pointer passed to pulse.
ra8_power_profile_now_us_fn_t now_us
Clock hook, us (may be nullptr).
void * user_ctx_time
Opaque pointer passed to now_us.
ra8_power_profile_gpio_pulse_fn_t pulse
GPIO edge hook (may be nullptr).
Per-region accumulator returned by ra8_power_profile_get_stats.
uint64_t last_enter_us
Timestamp of the most recent unmatched mark_enter.
uint64_t total_time_us
Sum of (exit - enter) over all closed pairs, microseconds.
bool is_open
true if a mark_enter is awaiting a mark_exit.
uint64_t entries
Total number of mark_enter calls for this region.
uint64_t exits
Total number of mark_exit calls for this region.
Aggregate snapshot of all per-region accumulators.
ra8_power_profile_region_stats_t regions[k_ra8_power_profile_max_regions]
Per-region accumulators.