Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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
57 sys_snode_t _node;
62 void (*state_entry)(enum pm_state state);
67 void (*state_exit)(enum pm_state state);
68};
69
70#if defined(CONFIG_PM) || defined(__DOXYGEN__)
83bool pm_state_force(uint8_t cpu, const struct pm_state_info *info);
84
93void pm_notifier_register(struct pm_notifier *notifier);
94
107
118
137
138
140__deprecated void z_pm_save_idle_exit(void);
164
177
182#else /* CONFIG_PM */
183
184static inline void pm_notifier_register(struct pm_notifier *notifier)
185{
186 ARG_UNUSED(notifier);
187}
188
189static inline int pm_notifier_unregister(struct pm_notifier *notifier)
190{
191 ARG_UNUSED(notifier);
192
193 return -ENOSYS;
194}
195
196static inline const struct pm_state_info *pm_state_next_get(uint8_t cpu)
197{
198 ARG_UNUSED(cpu);
199
200 return NULL;
201}
202static inline void z_pm_save_idle_exit(void)
203{
204}
205
206static inline void pm_system_resume(void)
207{
208}
209
210#endif /* CONFIG_PM */
211
212#ifdef __cplusplus
213}
214#endif
215
216#endif /* ZEPHYR_INCLUDE_PM_PM_H_ */
System error numbers.
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
pm_state
Power management 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.
void pm_system_resume(void)
Notify exit from kernel sleep.
int pm_notifier_unregister(struct pm_notifier *notifier)
Unregister a power management notifier.
#define ENOSYS
Function not implemented.
Definition errno.h:82
state
Definition parser_state.h:29
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Power management notifier struct.
Definition pm.h:56
void(* state_entry)(enum pm_state state)
Application defined function for doing any target specific operations for power state entry.
Definition pm.h:62
void(* state_exit)(enum pm_state state)
Application defined function for doing any target specific operations for power state exit.
Definition pm.h:67
Information about a power management state.
Definition state.h:114
uint8_t substate_id
Some platforms have multiple states that map to one Zephyr power state.
Definition state.h:142
Macros to abstract toolchain specific capabilities.