|
oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
|
Thin C++ wrappers around the oveRTOS power management API. More...
Typedefs | |
| using | State = ove_pm_state_t |
| System power state (active / sleep / deep-sleep / off). | |
| using | WakeType = ove_pm_wake_type_t |
| Wake-source kind (GPIO, RTC, timer, …). | |
| using | Domain = ove_pm_domain_t |
| Peripheral power domain identifier. | |
| using | Event = ove_pm_event_t |
| PM event delivered to subscribers (entering/exiting a state, etc.). | |
| using | WakeSrc = ove_pm_wake_src |
Wake-source descriptor passed to enable_wake_src(). | |
| using | Cfg = ove_pm_cfg |
Runtime configuration consumed by init(). | |
| using | Stats = ove_pm_stats |
| Aggregated runtime statistics (time in each state, etc.). | |
Functions | |
| Result< void > | init (const Cfg &cfg) noexcept |
| Initialise the PM subsystem. | |
| void | deinit () |
| Tear down the PM subsystem and release resources. | |
| Result< void > | set_state (State state) noexcept |
| Request an explicit power state transition. | |
| State | get_state () |
| Query the current power state. | |
| void | activity () |
| Report system activity (ISR-safe). | |
| Result< void > | wake_register (const WakeSrc &src) noexcept |
| Register a wake source. | |
| Result< void > | wake_unregister (const WakeSrc &src) noexcept |
| Unregister a previously registered wake source. | |
| Result< void > | domain_request (Domain domain) noexcept |
| Increment the reference count for a peripheral power domain. | |
| Result< void > | domain_release (Domain domain) noexcept |
| Decrement the reference count for a peripheral power domain. | |
| Result< int > | domain_get_refcount (Domain domain) noexcept |
| Query the current reference count for a domain. | |
| Result< void > | set_policy (ove_pm_policy_fn policy, void *user_data=nullptr) noexcept |
| Register a custom power policy callback. | |
| Result< void > | notify_register (ove_pm_notify_fn cb, void *user_data=nullptr) noexcept |
| Register a transition notification callback. | |
| Result< void > | notify_unregister (ove_pm_notify_fn cb, void *user_data=nullptr) noexcept |
| Unregister a transition notification callback. | |
| Result< Stats > | get_stats () noexcept |
| Query accumulated power statistics. | |
| void | reset_stats () |
| Reset all accumulated power statistics to zero. | |
| Result< void > | set_budget (uint32_t target_pct_x100) noexcept |
| Set a target percentage of time in low-power states. | |
| Result< uint32_t > | get_budget_status () noexcept |
| Query actual low-power percentage vs. budget target. | |
| void | idle_process () |
| Process idle — drive the PM state machine. | |
Thin C++ wrappers around the oveRTOS power management API.
The PM subsystem is a singleton — there is one system-wide power state. Available when CONFIG_OVE_PM is enabled.
Initialise the PM subsystem.
| [in] | cfg | Configuration parameters. |
Result<void> on success; unexpected Error on failure. Request an explicit power state transition.
| [in] | state | Target power state. |
Result<void> on success; unexpected Error on failure.
|
inline |
Query the current power state.
|
inline |
Report system activity (ISR-safe).
Resets the idle timer, causing the PM subsystem to return to the ACTIVE state on the next idle check.
Register a wake source.
| [in] | src | Wake source descriptor. |
Result<void> on success; unexpected Error::NoMemory if the wake-source table is full. Unregister a previously registered wake source.
| [in] | src | Wake source descriptor (must match a registered entry). |
Result<void> on success; unexpected Error on failure. Increment the reference count for a peripheral power domain.
| [in] | domain | Domain identifier. |
Result<void> on success; unexpected Error on failure. Decrement the reference count for a peripheral power domain.
| [in] | domain | Domain identifier. |
Result<void> on success; unexpected Error::InvalidParam on refcount underflow. Query the current reference count for a domain.
| [in] | domain | Domain identifier. |
unexpected Error.
|
inlinenoexcept |
Register a custom power policy callback.
| [in] | policy | Policy function, or nullptr for default. |
| [in] | user_data | Opaque pointer forwarded to the policy. |
Result<void> on success; unexpected Error on failure.
|
inlinenoexcept |
Register a transition notification callback.
| [in] | cb | Callback invoked on PRE_SLEEP and POST_WAKE. |
| [in] | user_data | Opaque pointer forwarded to the callback. |
Result<void> on success; unexpected Error::NoMemory if the notification table is full.
|
inlinenoexcept |
Unregister a transition notification callback.
| [in] | cb | Previously registered callback. |
| [in] | user_data | Pointer that was passed at registration time. |
Result<void> on success; unexpected Error on failure.
|
inlinenoexcept |
Set a target percentage of time in low-power states.
| [in] | target_pct_x100 | Target in hundredths of percent. |
Result<void> on success; unexpected Error on failure.
|
inlinenoexcept |
Query actual low-power percentage vs. budget target.
unexpected Error.
|
inline |
Process idle — drive the PM state machine.
Called internally from the RTOS idle hook. Not normally called by application code.