Zephyr Project API  3.2.0
A Scalable Open Source RTOS
pm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2014 Wind River Systems, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_PM_PM_H_
8#define ZEPHYR_INCLUDE_PM_PM_H_
9
10#include <zephyr/types.h>
11#include <zephyr/sys/slist.h>
12#include <zephyr/pm/state.h>
13#include <zephyr/toolchain.h>
14#include <errno.h>
15#include <stdbool.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
55 sys_snode_t _node;
60 void (*state_entry)(enum pm_state state);
65 void (*state_exit)(enum pm_state state);
66};
67
68#if defined(CONFIG_PM) || defined(__DOXYGEN__)
81bool pm_state_force(uint8_t cpu, const struct pm_state_info *info);
82
91void pm_notifier_register(struct pm_notifier *notifier);
92
105
116
138
151
156#else /* CONFIG_PM */
157
158static inline void pm_notifier_register(struct pm_notifier *notifier)
159{
160 ARG_UNUSED(notifier);
161}
162
163static inline int pm_notifier_unregister(struct pm_notifier *notifier)
164{
165 ARG_UNUSED(notifier);
166
167 return -ENOSYS;
168}
169
170static inline void pm_state_set(enum pm_state state, uint8_t substate_id)
171{
172 ARG_UNUSED(state);
173 ARG_UNUSED(substate_id);
174}
175
176static inline void pm_state_exit_post_ops(enum pm_state state,
178{
179 ARG_UNUSED(state);
180 ARG_UNUSED(substate_id);
181}
182
183static inline const struct pm_state_info *pm_state_next_get(uint8_t cpu)
184{
185 ARG_UNUSED(cpu);
186
187 return NULL;
188}
189#endif /* CONFIG_PM */
190
191void z_pm_save_idle_exit(void);
192
193#ifdef __cplusplus
194}
195#endif
196
197#endif /* ZEPHYR_INCLUDE_PM_PM_H_ */
System error numbers.
pm_state
Definition: state.h:27
void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
Do any SoC or architecture specific post ops after sleep state exits.
void pm_state_set(enum pm_state state, uint8_t substate_id)
Put processor into a power state.
void pm_notifier_register(struct pm_notifier *notifier)
Register a power management notifier.
bool pm_state_force(uint8_t cpu, const struct pm_state_info *info)
Force usage of given power state.
const struct pm_state_info * pm_state_next_get(uint8_t cpu)
Gets the next power state that will be used.
int pm_notifier_unregister(struct pm_notifier *notifier)
Unregister a power management notifier.
#define ENOSYS
Definition: errno.h:83
state
Definition: http_parser_state.h:29
Single-linked list implementation.
struct _snode sys_snode_t
Definition: slist.h:33
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Definition: pm.h:54
void(* state_entry)(enum pm_state state)
Definition: pm.h:60
void(* state_exit)(enum pm_state state)
Definition: pm.h:65
Definition: state.h:114
uint8_t substate_id
Definition: state.h:141
Macros to abstract toolchain specific capabilities.