|
oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
|
Unified power management with sleep state machine, peripheral power domains, wake source registration, and runtime statistics. More...
Data Structures | |
| struct | ove_pm_cfg |
| PM subsystem configuration. More... | |
| struct | ove_pm_wake_src |
| Wake source descriptor. More... | |
| struct | ove_pm_stats |
| Runtime power statistics. More... | |
Typedefs | |
| typedef ove_pm_state_t(* | ove_pm_policy_fn) (ove_pm_state_t current, uint32_t idle_ms, uint32_t next_timeout_ms, void *user_data) |
| Power policy callback — returns recommended next state. | |
| typedef void(* | ove_pm_notify_fn) (ove_pm_event_t event, ove_pm_state_t from_state, ove_pm_state_t to_state, void *user_data) |
| Transition notification callback. | |
Enumerations | |
| enum | ove_pm_state_t { OVE_PM_STATE_ACTIVE = 0 , OVE_PM_STATE_IDLE = 1 , OVE_PM_STATE_STANDBY = 2 , OVE_PM_STATE_DEEP_SLEEP = 3 , OVE_PM_STATE_COUNT = 4 } |
| System power states, ordered by increasing sleep depth. More... | |
| enum | ove_pm_wake_type_t { OVE_PM_WAKE_GPIO = 0 , OVE_PM_WAKE_TIMER = 1 , OVE_PM_WAKE_UART = 2 , OVE_PM_WAKE_RTC = 3 } |
| Wake source types. More... | |
| enum | ove_pm_domain_t { OVE_PM_DOMAIN_RADIO = 0 , OVE_PM_DOMAIN_SENSOR = 1 , OVE_PM_DOMAIN_DISPLAY = 2 , OVE_PM_DOMAIN_AUDIO = 3 , OVE_PM_DOMAIN_STORAGE = 4 , OVE_PM_DOMAIN_COMMS = 5 , OVE_PM_DOMAIN_USER0 = 6 , OVE_PM_DOMAIN_USER1 = 7 , OVE_PM_DOMAIN_COUNT = 8 } |
| Peripheral power domain identifiers. | |
| enum | ove_pm_event_t { OVE_PM_EVENT_PRE_SLEEP = 0 , OVE_PM_EVENT_POST_WAKE = 1 } |
| Transition event type for notification callbacks. More... | |
Functions | |
| static int | ove_pm_init (const struct ove_pm_cfg *c) |
| static void | ove_pm_deinit (void) |
| static int | ove_pm_set_state (ove_pm_state_t s) |
| static ove_pm_state_t | ove_pm_get_state (void) |
| static void | ove_pm_activity (void) |
| static int | ove_pm_wake_register (const struct ove_pm_wake_src *s) |
| static int | ove_pm_wake_unregister (const struct ove_pm_wake_src *s) |
| static int | ove_pm_domain_request (ove_pm_domain_t d) |
| static int | ove_pm_domain_release (ove_pm_domain_t d) |
| static int | ove_pm_domain_get_refcount (ove_pm_domain_t d) |
| static int | ove_pm_set_policy (ove_pm_policy_fn p, void *u) |
| static int | ove_pm_notify_register (ove_pm_notify_fn c, void *u) |
| static int | ove_pm_notify_unregister (ove_pm_notify_fn c, void *u) |
| static int | ove_pm_get_stats (struct ove_pm_stats *s) |
| static void | ove_pm_reset_stats (void) |
| static int | ove_pm_set_budget (uint32_t t) |
| static int | ove_pm_get_budget_status (uint32_t *a) |
| static void | ove_pm_idle_process (void) |
Unified power management with sleep state machine, peripheral power domains, wake source registration, and runtime statistics.
The PM subsystem is a singleton module (like GPIO and console) — there is exactly one system power state. Initialise with ove_pm_init() and tear down with ove_pm_deinit().
Four sleep states are defined, ordered by increasing depth:
OVE_PM_STATE_ACTIVE — full speed, all clocks running.OVE_PM_STATE_IDLE — light sleep, fast wakeup, peripherals on.OVE_PM_STATE_STANDBY — deeper sleep, some peripherals off.OVE_PM_STATE_DEEP_SLEEP — lowest power, RAM retained, slow wakeup.A pluggable policy engine decides when to transition between states based on idle duration, next scheduled timeout, and registered wake sources. Peripheral power domains are reference-counted: power is gated when the last user releases a domain.
CONFIG_OVE_PM. | typedef ove_pm_state_t(* ove_pm_policy_fn) (ove_pm_state_t current, uint32_t idle_ms, uint32_t next_timeout_ms, void *user_data) |
Power policy callback — returns recommended next state.
| [in] | current | Current power state. |
| [in] | idle_ms | Milliseconds since last activity. |
| [in] | next_timeout_ms | Milliseconds until next scheduled event. |
| [in] | user_data | Opaque pointer from ove_pm_set_policy(). |
| typedef void(* ove_pm_notify_fn) (ove_pm_event_t event, ove_pm_state_t from_state, ove_pm_state_t to_state, void *user_data) |
Transition notification callback.
| [in] | event | PRE_SLEEP or POST_WAKE. |
| [in] | from_state | State being left. |
| [in] | to_state | State being entered. |
| [in] | user_data | Opaque pointer from ove_pm_notify_register(). |
| enum ove_pm_state_t |
| enum ove_pm_wake_type_t |
| enum ove_pm_event_t |