Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
System Power Management Policy API . More...
Data Structures | |
struct | pm_policy_latency_subscription |
Latency change subscription. More... | |
struct | pm_policy_latency_request |
Latency request. More... | |
struct | pm_policy_event |
Event. More... | |
Macros | |
#define | PM_ALL_SUBSTATES (UINT8_MAX) |
Special value for 'all substates'. | |
Typedefs | |
typedef void(* | pm_policy_latency_changed_cb_t) (int32_t latency) |
Callback to notify when maximum latency changes. | |
Functions | |
void | pm_policy_state_lock_get (enum pm_state state, uint8_t substate_id) |
Increase a power state lock counter. | |
void | pm_policy_state_lock_put (enum pm_state state, uint8_t substate_id) |
Decrease a power state lock counter. | |
bool | pm_policy_state_lock_is_active (enum pm_state state, uint8_t substate_id) |
Check if a power state lock is active (not allowed). | |
void | pm_policy_event_register (struct pm_policy_event *evt, uint32_t cycle) |
Register an event. | |
void | pm_policy_event_update (struct pm_policy_event *evt, uint32_t cycle) |
Update an event. | |
void | pm_policy_event_unregister (struct pm_policy_event *evt) |
Unregister an event. | |
void | pm_policy_device_power_lock_get (const struct device *dev) |
Increase power state locks. | |
void | pm_policy_device_power_lock_put (const struct device *dev) |
Decrease power state locks. | |
int32_t | pm_policy_next_event_ticks (void) |
Returns the ticks until the next event. | |
void | pm_policy_latency_request_add (struct pm_policy_latency_request *req, uint32_t value_us) |
Add a new latency requirement. | |
void | pm_policy_latency_request_update (struct pm_policy_latency_request *req, uint32_t value_us) |
Update a latency requirement. | |
void | pm_policy_latency_request_remove (struct pm_policy_latency_request *req) |
Remove a latency requirement. | |
void | pm_policy_latency_changed_subscribe (struct pm_policy_latency_subscription *req, pm_policy_latency_changed_cb_t cb) |
Subscribe to maximum latency changes. | |
void | pm_policy_latency_changed_unsubscribe (struct pm_policy_latency_subscription *req) |
Unsubscribe to maximum latency changes. | |
System Power Management Policy API .
#define PM_ALL_SUBSTATES (UINT8_MAX) |
#include <zephyr/pm/policy.h>
Special value for 'all substates'.
typedef void(* pm_policy_latency_changed_cb_t) (int32_t latency) |
#include <zephyr/pm/policy.h>
Callback to notify when maximum latency changes.
latency | New maximum latency. Positive value represents latency in microseconds. SYS_FOREVER_US value lifts the latency constraint. Other values are forbidden. |
void pm_policy_device_power_lock_get | ( | const struct device * | dev | ) |
#include <zephyr/pm/policy.h>
Increase power state locks.
Set power state locks in all power states that disable power in the given device.
dev | Device reference. |
void pm_policy_device_power_lock_put | ( | const struct device * | dev | ) |
#include <zephyr/pm/policy.h>
Decrease power state locks.
Remove power state locks in all power states that disable power in the given device.
dev | Device reference. |
void pm_policy_event_register | ( | struct pm_policy_event * | evt, |
uint32_t | cycle ) |
#include <zephyr/pm/policy.h>
Register an event.
Events in the power-management policy context are defined as any source that will wake up the system at a known time in the future. By registering such event, the policy manager will be able to decide whether certain power states are worth entering or not. CPU is woken up before the time passed in cycle to prevent the event handling latency
evt | Event. |
cycle | When the event will occur, in absolute time (cycles). |
void pm_policy_event_unregister | ( | struct pm_policy_event * | evt | ) |
#include <zephyr/pm/policy.h>
Unregister an event.
evt | Event. |
void pm_policy_event_update | ( | struct pm_policy_event * | evt, |
uint32_t | cycle ) |
#include <zephyr/pm/policy.h>
Update an event.
evt | Event. |
cycle | When the event will occur, in absolute time (cycles). |
void pm_policy_latency_changed_subscribe | ( | struct pm_policy_latency_subscription * | req, |
pm_policy_latency_changed_cb_t | cb ) |
#include <zephyr/pm/policy.h>
Subscribe to maximum latency changes.
req | Subscription request. |
cb | Callback function (NULL to disable). |
void pm_policy_latency_changed_unsubscribe | ( | struct pm_policy_latency_subscription * | req | ) |
#include <zephyr/pm/policy.h>
Unsubscribe to maximum latency changes.
req | Subscription request. |
void pm_policy_latency_request_add | ( | struct pm_policy_latency_request * | req, |
uint32_t | value_us ) |
#include <zephyr/pm/policy.h>
Add a new latency requirement.
The system will not enter any power state that would make the system to exceed the given latency value.
req | Latency request. |
value_us | Maximum allowed latency in microseconds. |
void pm_policy_latency_request_remove | ( | struct pm_policy_latency_request * | req | ) |
void pm_policy_latency_request_update | ( | struct pm_policy_latency_request * | req, |
uint32_t | value_us ) |
#include <zephyr/pm/policy.h>
Update a latency requirement.
req | Latency request. |
value_us | New maximum allowed latency in microseconds. |
int32_t pm_policy_next_event_ticks | ( | void | ) |
#include <zephyr/pm/policy.h>
Returns the ticks until the next event.
If an event is registred, it will return the number of ticks until the next event as a positive or zero value. Otherwise it returns -1
#include <zephyr/pm/policy.h>
Increase a power state lock counter.
A power state will not be allowed on the first call of pm_policy_state_lock_get(). Subsequent calls will just increase a reference count, thus meaning this API can be safely used concurrently. A state will be allowed again after pm_policy_state_lock_put() is called as many times as pm_policy_state_lock_get().
Note that the PM_STATE_ACTIVE state is always allowed, so calling this API with PM_STATE_ACTIVE will have no effect.
state | Power state. |
substate_id | Power substate ID. Use PM_ALL_SUBSTATES to affect all the substates in the given power state. |
#include <zephyr/pm/policy.h>
Check if a power state lock is active (not allowed).
state | Power state. |
substate_id | Power substate ID. Use PM_ALL_SUBSTATES to affect all the substates in the given power state. |
true | if power state lock is active. |
false | if power state lock is not active. |
#include <zephyr/pm/policy.h>
Decrease a power state lock counter.
state | Power state. |
substate_id | Power substate ID. Use PM_ALL_SUBSTATES to affect all the substates in the given power state. |