oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Functions
HAL Power Management Interface

Hardware Abstraction Layer interface for power management. More...

Functions

int ove_hal_pm_enter_state (ove_pm_state_t state, uint32_t expected_idle_ms)
 Enter a hardware sleep state.
 
int ove_hal_pm_wake_arm (const struct ove_pm_wake_src *src)
 Arm a wake source in hardware before entering sleep.
 
int ove_hal_pm_wake_disarm (const struct ove_pm_wake_src *src)
 Disarm a wake source after waking.
 
int ove_hal_pm_domain_enable (ove_pm_domain_t domain)
 Enable power to a peripheral domain.
 
int ove_hal_pm_domain_disable (ove_pm_domain_t domain)
 Disable power to a peripheral domain (power-gate).
 
uint32_t ove_hal_pm_get_next_timeout_ms (void)
 Query the time until the next scheduled RTOS event.
 
void ove_hal_pm_idle_hook (void)
 Idle hook entry point — registered with the RTOS idle mechanism.
 

Detailed Description

Hardware Abstraction Layer interface for power management.

Declares the low-level PM functions that every platform HAL must implement. The portable Power Management layer delegates to these functions after performing state machine logic, refcounting, and statistics tracking.

Note
Platform implementations supply their own definitions of these functions in a backend-specific source file.

Function Documentation

◆ ove_hal_pm_enter_state()

int ove_hal_pm_enter_state ( ove_pm_state_t  state,
uint32_t  expected_idle_ms 
)

Enter a hardware sleep state.

Called by the portable PM layer after arming wake sources and firing PRE_SLEEP notifications. The function blocks until the system wakes.

Parameters
[in]stateTarget sleep state.
[in]expected_idle_msHint: expected sleep duration in ms.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_pm_wake_arm()

int ove_hal_pm_wake_arm ( const struct ove_pm_wake_src src)

Arm a wake source in hardware before entering sleep.

Called for each registered wake source before ove_hal_pm_enter_state().

Parameters
[in]srcWake source descriptor.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_pm_wake_disarm()

int ove_hal_pm_wake_disarm ( const struct ove_pm_wake_src src)

Disarm a wake source after waking.

Parameters
[in]srcWake source descriptor.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_pm_domain_enable()

int ove_hal_pm_domain_enable ( ove_pm_domain_t  domain)

Enable power to a peripheral domain.

Called when a domain's reference count transitions from 0 to 1.

Parameters
[in]domainDomain identifier.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_pm_domain_disable()

int ove_hal_pm_domain_disable ( ove_pm_domain_t  domain)

Disable power to a peripheral domain (power-gate).

Called when a domain's reference count transitions from 1 to 0.

Parameters
[in]domainDomain identifier.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_pm_get_next_timeout_ms()

uint32_t ove_hal_pm_get_next_timeout_ms ( void  )

Query the time until the next scheduled RTOS event.

Returns
Milliseconds until next timeout, or OVE_WAIT_FOREVER if none.

◆ ove_hal_pm_idle_hook()

void ove_hal_pm_idle_hook ( void  )

Idle hook entry point — registered with the RTOS idle mechanism.

The backend registers this function with the RTOS idle task (e.g. vApplicationIdleHook on FreeRTOS, pm_notifier on Zephyr). It calls ove_pm_idle_process() in the portable layer to drive the PM state machine.