Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
state.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_PM_STATE_H_
8#define ZEPHYR_INCLUDE_PM_STATE_H_
9
10#include <sys/util.h>
11#include <devicetree.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
107
113
137
145
152};
153
161#define PM_STATE_INFO_DT_ITEM_BY_IDX(node_id, i) \
162 { \
163 .state = DT_ENUM_IDX(DT_PHANDLE_BY_IDX(node_id, \
164 cpu_power_states, i), power_state_name), \
165 .substate_id = DT_PROP_BY_PHANDLE_IDX_OR(node_id, \
166 cpu_power_states, i, substate_id, 0), \
167 .min_residency_us = DT_PROP_BY_PHANDLE_IDX_OR(node_id, \
168 cpu_power_states, i, min_residency_us, 0),\
169 .exit_latency_us = DT_PROP_BY_PHANDLE_IDX_OR(node_id, \
170 cpu_power_states, i, exit_latency_us, 0),\
171 },
172
179#define PM_STATE_DT_ITEMS_LEN(node_id) \
180 DT_PROP_LEN_OR(node_id, cpu_power_states, 0)
181
190#define PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC(child, node_id) \
191 PM_STATE_INFO_DT_ITEM_BY_IDX(node_id, child)
192
231#define PM_STATE_INFO_DT_ITEMS_LIST(node_id) { \
232 UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id), \
233 PM_STATE_INFO_DT_ITEMS_LISTIFY_FUNC,\
234 node_id) \
235 }
236
245#define PM_STATE_DT_ITEM_BY_IDX(node_id, i) \
246 DT_ENUM_IDX(DT_PHANDLE_BY_IDX(node_id, \
247 cpu_power_states, i), power_state_name),
248
249
258#define PM_STATE_DT_ITEMS_LISTIFY_FUNC(child, node_id) \
259 PM_STATE_DT_ITEM_BY_IDX(node_id, child)
260
296#define PM_STATE_DT_ITEMS_LIST(node_id) { \
297 UTIL_LISTIFY(PM_STATE_DT_ITEMS_LEN(node_id),\
298 PM_STATE_DT_ITEMS_LISTIFY_FUNC,\
299 node_id) \
300 }
301
306#ifdef __cplusplus
307}
308#endif
309
310#endif
Devicetree main header.
pm_state
Definition: state.h:26
@ PM_STATE_SOFT_OFF
Soft off state.
Definition: state.h:105
@ PM_STATE_STANDBY
Standby state.
Definition: state.h:69
@ PM_STATE_SUSPEND_TO_RAM
Suspend to ram state.
Definition: state.h:81
@ PM_STATE_ACTIVE
Runtime active state.
Definition: state.h:34
@ PM_STATE_RUNTIME_IDLE
Runtime idle state.
Definition: state.h:45
@ PM_STATE_SUSPEND_TO_IDLE
Suspend to idle state.
Definition: state.h:57
@ PM_STATE_SUSPEND_TO_DISK
Suspend to disk state.
Definition: state.h:94
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Definition: state.h:111
uint8_t substate_id
Definition: state.h:136
uint32_t min_residency_us
Definition: state.h:144
uint32_t exit_latency_us
Definition: state.h:151
enum pm_state state
Definition: state.h:112
Misc utilities.