Zephyr Project API
3.1.0
A Scalable Open Source RTOS
|
System Power Management Policy API. More...
Data Structures | |
struct | pm_policy_latency_request |
Latency request. More... | |
Macros | |
#define | PM_ALL_SUBSTATES (UINT8_MAX) |
Typedefs | |
typedef void(* | pm_policy_latency_changed_cb_t) (int32_t latency) |
Callback to notify when maximum latency changes. More... | |
Functions | |
void | pm_policy_state_lock_get (enum pm_state state, uint8_t substate_id) |
Increase a power state lock counter. More... | |
void | pm_policy_state_lock_put (enum pm_state state, uint8_t substate_id) |
Decrease a power state lock counter. More... | |
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). More... | |
void | pm_policy_latency_request_add (struct pm_policy_latency_request *req, uint32_t value) |
Add a new latency requirement. More... | |
void | pm_policy_latency_request_update (struct pm_policy_latency_request *req, uint32_t value) |
Update a latency requirement. More... | |
void | pm_policy_latency_request_remove (struct pm_policy_latency_request *req) |
Remove a latency requirement. More... | |
void | pm_policy_latency_changed (pm_policy_latency_changed_cb_t cb) |
Set the callback to be called when maximum latency changes. More... | |
System Power Management Policy API.
#define PM_ALL_SUBSTATES (UINT8_MAX) |
#include <include/zephyr/pm/policy.h>
Special value for 'all substates'.
typedef void(* pm_policy_latency_changed_cb_t) (int32_t latency) |
#include <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_latency_changed | ( | pm_policy_latency_changed_cb_t | cb | ) |
#include <include/zephyr/pm/policy.h>
Set the callback to be called when maximum latency changes.
cb | Callback function (NULL to disable). |
void pm_policy_latency_request_add | ( | struct pm_policy_latency_request * | req, |
uint32_t | value | ||
) |
#include <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 | 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 | ||
) |
#include <include/zephyr/pm/policy.h>
Update a latency requirement.
req | Latency request. |
value | New maximum allowed latency in microseconds. |
#include <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 <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 <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. |