Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
state.h File Reference
#include <zephyr/sys/util.h>
#include <zephyr/devicetree.h>
#include <errno.h>

Go to the source code of this file.

Data Structures

struct  pm_state_info
 Information about a power management state. More...
 
struct  pm_state_constraint
 Information needed to be able to reference a power state as a constraint on some device or system functions. More...
 
struct  pm_state_constraints
 Collection of multiple power state constraints. More...
 

Macros

#define PM_STATE_INFO_DT_INIT(node_id)
 Initializer for struct pm_state_info given a DT node identifier with zephyr,power-state compatible.
 
#define PM_STATE_DT_INIT(node_id)    DT_ENUM_IDX(node_id, power_state_name)
 Initializer for enum pm_state given a DT node identifier with zephyr,power-state compatible.
 
#define DT_NUM_CPU_POWER_STATES(node_id)
 Obtain number of CPU power states supported and enabled by the given CPU node identifier.
 
#define PM_STATE_INFO_LIST_FROM_DT_CPU(node_id)
 Initialize an array of struct pm_state_info with information from all the states present and enabled in the given CPU node identifier.
 
#define PM_STATE_LIST_FROM_DT_CPU(node_id)
 Initialize an array of struct pm_state with information from all the states present and enabled in the given CPU node identifier.
 
#define PM_STATE_CONSTRAINT_INIT(node_id)
 initialize a device pm constraint with information from devicetree.
 
#define PM_STATE_CONSTRAINTS_LIST_DEFINE(node_id, prop)
 Define a list of power state constraints from devicetree.
 
#define PM_STATE_CONSTRAINTS_GET(node_id, prop)
 Get power state constraints structure from devicetree.
 

Enumerations

enum  pm_state {
  PM_STATE_ACTIVE , PM_STATE_RUNTIME_IDLE , PM_STATE_SUSPEND_TO_IDLE , PM_STATE_STANDBY ,
  PM_STATE_SUSPEND_TO_RAM , PM_STATE_SUSPEND_TO_DISK , PM_STATE_SOFT_OFF , PM_STATE_COUNT
}
 Power management state. More...
 

Functions

uint8_t pm_state_cpu_get_all (uint8_t cpu, const struct pm_state_info **states)
 Obtain information about all supported states by a CPU.
 
const struct pm_state_infopm_state_get (uint8_t cpu, enum pm_state state, uint8_t substate_id)
 Get power state structure.
 
const char * pm_state_to_str (enum pm_state state)
 Convert a pm_state enum value to its string representation.
 
int pm_state_from_str (const char *name, enum pm_state *out)
 Parse a string and convert it to a pm_state enum value.
 
bool pm_state_in_constraints (const struct pm_state_constraints *constraints, const struct pm_state_constraint match)
 Check if a power management constraint matches any in a set of constraints.