Zephyr Project API 4.4.99
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
12
13#ifndef ZEPHYR_INCLUDE_PM_PM_H_
14#define ZEPHYR_INCLUDE_PM_PM_H_
15
16#include <zephyr/types.h>
17#include <zephyr/sys/slist.h>
18#include <zephyr/pm/state.h>
19#include <zephyr/toolchain.h>
20#include <errno.h>
21#include <stdbool.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
35
44
64 sys_snode_t _node;
70 union {
71 struct {
76 void (*state_entry)(enum pm_state state);
81 void (*state_exit)(enum pm_state state);
82 };
83 struct {
88 void (*substate_entry)(enum pm_state state, uint8_t substate_id);
93 void (*substate_exit)(enum pm_state state, uint8_t substate_id);
94 };
95 };
102};
103
104#if defined(CONFIG_PM) || defined(__DOXYGEN__)
117bool pm_state_force(uint8_t cpu, const struct pm_state_info *info);
118
127void pm_notifier_register(struct pm_notifier *notifier);
128
140
152
171
175
182
205
228
232
233#else /* CONFIG_PM */
234
235static inline void pm_notifier_register(struct pm_notifier *notifier)
236{
237 ARG_UNUSED(notifier);
238}
239
240static inline int pm_notifier_unregister(struct pm_notifier *notifier)
241{
242 ARG_UNUSED(notifier);
243
244 return -ENOSYS;
245}
246
247static inline const struct pm_state_info *pm_state_next_get(uint8_t cpu)
248{
249 ARG_UNUSED(cpu);
250
251 return NULL;
252}
253
254static inline void pm_system_resume(void)
255{
256}
257
258#endif /* CONFIG_PM */
259
260#ifdef __cplusplus
261}
262#endif
263
264#endif /* ZEPHYR_INCLUDE_PM_PM_H_ */
System error numbers.
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:44
pm_state
Power management state.
Definition state.h:34
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:83
#define NULL
Definition iar_missing_defs.h:20
state
Definition parser_state.h:29
Header file for the single-linked list API.
Header file for System Power Management state definitions.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Power management notifier struct.
Definition pm.h:63
bool report_substate
True if the substate reporting callbacks are set.
Definition pm.h:101
void(* substate_entry)(enum pm_state state, uint8_t substate_id)
Application defined function for doing any target specific operations for power state entry.
Definition pm.h:88
void(* state_entry)(enum pm_state state)
Application defined function for doing any target specific operations for power state entry.
Definition pm.h:76
void(* substate_exit)(enum pm_state state, uint8_t substate_id)
Application defined function for doing any target specific operations for power state exit.
Definition pm.h:93
void(* state_exit)(enum pm_state state)
Application defined function for doing any target specific operations for power state exit.
Definition pm.h:81
Information about a power management state.
Definition state.h:121
uint8_t substate_id
Some platforms have multiple states that map to one Zephyr power state.
Definition state.h:150
Macros to abstract toolchain specific capabilities.