40#define RA8_POWER_PROFILE_TAG "PWRPROF"
150 if (
s_cfg.now_us ==
nullptr) {
177 if (
s_cfg.pulse ==
nullptr) {
180 s_cfg.pulse(
s_cfg.user_ctx_gpio, region_id, entering);
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_VALIDATE_INIT(initialized, tag, message)
Precondition: module must be initialized.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
static bool s_initialized
True once display_init has succeeded.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_err_range_check_failed
Value outside range enforced by RA8_CHECK_RANGE / RA8_CHECK_RANGE_TAG.
@ 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.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error(tag, message)
RA8 log error.
ra8_err_t ra8_power_profile_get_stats(ra8_power_profile_stats_t *out_stats)
Copy the current statistics snapshot to the caller.
static ra8_power_profile_config_t s_cfg
Cached copy of the caller-supplied configuration.
ra8_err_t ra8_power_profile_mark_enter(ra8_power_profile_region_id_t region_id)
Mark entry into a tracked region.
static void internal_fire_pulse(ra8_power_profile_region_id_t region_id, bool entering)
Fire the GPIO pulse hook if one was configured.
static uint64_t internal_now_us(void)
Read the current timestamp via the configured clock hook.
static ra8_power_profile_stats_t s_stats
Per-region accumulator array (NASA Rule 3 – static).
static ra8_err_t internal_validate_region(ra8_power_profile_region_id_t region_id)
Validate a region ID against the static array bound.
ra8_err_t ra8_power_profile_mark_exit(ra8_power_profile_region_id_t region_id)
Mark exit from a tracked region.
ra8_err_t ra8_power_profile_reset_stats(void)
Zero every accumulator (preserves the configured hooks).
ra8_err_t ra8_power_profile_init(const ra8_power_profile_config_t *cfg)
Initialise the power profiler.
#define RA8_POWER_PROFILE_TAG
Logging tag passed to ra8_log_* from this TU.
Power-profiling helper – public API.
ra8_power_profile_region_id_t
Default named region IDs.
@ k_ra8_power_profile_max_regions
Maximum number of distinct regions tracked.
Initialisation configuration.
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.