oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
pm.h File Reference
#include "ove/types.h"
#include "ove/gpio.h"
#include "ove_config.h"
Include dependency graph for pm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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

int ove_pm_init (const struct ove_pm_cfg *cfg)
 Initialise the PM subsystem.
 
void ove_pm_deinit (void)
 Tear down the PM subsystem and release resources.
 
int ove_pm_set_state (ove_pm_state_t state)
 Request an explicit transition to state.
 
ove_pm_state_t ove_pm_get_state (void)
 Query the current power state.
 
void ove_pm_activity (void)
 Report system activity (resets idle timer).
 
int ove_pm_wake_register (const struct ove_pm_wake_src *src)
 Register a wake source.
 
int ove_pm_wake_unregister (const struct ove_pm_wake_src *src)
 Unregister a previously registered wake source.
 
int ove_pm_domain_request (ove_pm_domain_t domain)
 Increment the reference count for a peripheral power domain.
 
int ove_pm_domain_release (ove_pm_domain_t domain)
 Decrement the reference count for a peripheral power domain.
 
int ove_pm_domain_get_refcount (ove_pm_domain_t domain)
 Query the current reference count for a domain.
 
int ove_pm_set_policy (ove_pm_policy_fn policy, void *user_data)
 Register a custom power policy callback.
 
int ove_pm_notify_register (ove_pm_notify_fn cb, void *user_data)
 Register a transition notification callback.
 
int ove_pm_notify_unregister (ove_pm_notify_fn cb, void *user_data)
 Unregister a transition notification callback.
 
int ove_pm_get_stats (struct ove_pm_stats *stats)
 Query accumulated power statistics.
 
void ove_pm_reset_stats (void)
 Reset all accumulated power statistics to zero.
 
int ove_pm_set_budget (uint32_t target_low_power_pct_x100)
 Set a target percentage of time in low-power states.
 
int ove_pm_get_budget_status (uint32_t *actual_pct_x100)
 Query actual low-power percentage vs. budget target.
 
void ove_pm_idle_process (void)
 Process idle — called from RTOS idle context by the HAL.