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
14
extern
"C"
{
15
#endif
16
26
enum
pm_state
{
34
PM_STATE_ACTIVE
,
45
PM_STATE_RUNTIME_IDLE
,
57
PM_STATE_SUSPEND_TO_IDLE
,
69
PM_STATE_STANDBY
,
81
PM_STATE_SUSPEND_TO_RAM
,
94
PM_STATE_SUSPEND_TO_DISK
,
105
PM_STATE_SOFT_OFF
106
};
107
111
struct
pm_state_info
{
112
enum
pm_state
state
;
113
136
uint8_t
substate_id
;
137
144
uint32_t
min_residency_us
;
145
151
uint32_t
exit_latency_us
;
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.h
Devicetree main header.
pm_state
pm_state
Definition:
state.h:26
PM_STATE_SOFT_OFF
@ PM_STATE_SOFT_OFF
Soft off state.
Definition:
state.h:105
PM_STATE_STANDBY
@ PM_STATE_STANDBY
Standby state.
Definition:
state.h:69
PM_STATE_SUSPEND_TO_RAM
@ PM_STATE_SUSPEND_TO_RAM
Suspend to ram state.
Definition:
state.h:81
PM_STATE_ACTIVE
@ PM_STATE_ACTIVE
Runtime active state.
Definition:
state.h:34
PM_STATE_RUNTIME_IDLE
@ PM_STATE_RUNTIME_IDLE
Runtime idle state.
Definition:
state.h:45
PM_STATE_SUSPEND_TO_IDLE
@ PM_STATE_SUSPEND_TO_IDLE
Suspend to idle state.
Definition:
state.h:57
PM_STATE_SUSPEND_TO_DISK
@ PM_STATE_SUSPEND_TO_DISK
Suspend to disk state.
Definition:
state.h:94
uint32_t
__UINT32_TYPE__ uint32_t
Definition:
stdint.h:60
uint8_t
__UINT8_TYPE__ uint8_t
Definition:
stdint.h:58
pm_state_info
Definition:
state.h:111
pm_state_info::substate_id
uint8_t substate_id
Definition:
state.h:136
pm_state_info::min_residency_us
uint32_t min_residency_us
Definition:
state.h:144
pm_state_info::exit_latency_us
uint32_t exit_latency_us
Definition:
state.h:151
pm_state_info::state
enum pm_state state
Definition:
state.h:112
util.h
Misc utilities.
include
pm
state.h
Generated on Sun Oct 9 2022 09:21:57 for Zephyr API Documentation by
1.9.4