Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
policy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_PM_POLICY_H_
8#define ZEPHYR_INCLUDE_PM_POLICY_H_
9
10#include <stdbool.h>
11#include <stdint.h>
12
13#include <zephyr/pm/state.h>
14#include <zephyr/sys/slist.h>
15#include <zephyr/toolchain.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
35typedef void (*pm_policy_latency_changed_cb_t)(int32_t latency);
36
44 sys_snode_t node;
47};
48
56 sys_snode_t node;
57 uint32_t value_us;
59};
60
68 sys_snode_t node;
69 uint32_t value_cyc;
71};
72
88const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks);
89
93#define PM_ALL_SUBSTATES (UINT8_MAX)
94
95#if defined(CONFIG_PM) || defined(__DOXYGEN__)
115
126
138
149 uint32_t value_us);
150
158 uint32_t value_us);
159
166
175
182
202
212
221
222#else
224{
225 ARG_UNUSED(state);
226 ARG_UNUSED(substate_id);
227}
228
230{
231 ARG_UNUSED(state);
232 ARG_UNUSED(substate_id);
233}
234
236{
237 ARG_UNUSED(state);
238 ARG_UNUSED(substate_id);
239
240 return false;
241}
242
243static inline void pm_policy_latency_request_add(
244 struct pm_policy_latency_request *req, uint32_t value_us)
245{
246 ARG_UNUSED(req);
247 ARG_UNUSED(value_us);
248}
249
250static inline void pm_policy_latency_request_update(
251 struct pm_policy_latency_request *req, uint32_t value_us)
252{
253 ARG_UNUSED(req);
254 ARG_UNUSED(value_us);
255}
256
257static inline void pm_policy_latency_request_remove(
258 struct pm_policy_latency_request *req)
259{
260 ARG_UNUSED(req);
261}
262
263static inline void pm_policy_event_register(struct pm_policy_event *evt,
264 uint32_t time_us)
265{
266 ARG_UNUSED(evt);
267 ARG_UNUSED(time_us);
268}
269
270static inline void pm_policy_event_update(struct pm_policy_event *evt,
271 uint32_t time_us)
272{
273 ARG_UNUSED(evt);
274 ARG_UNUSED(time_us);
275}
276
277static inline void pm_policy_event_unregister(struct pm_policy_event *evt)
278{
279 ARG_UNUSED(evt);
280}
281#endif /* CONFIG_PM */
282
287#ifdef __cplusplus
288}
289#endif
290
291#endif /* ZEPHYR_INCLUDE_PM_POLICY_H_ */
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_policy_state_lock_put(enum pm_state state, uint8_t substate_id)
Decrease a power state lock counter.
void pm_policy_event_update(struct pm_policy_event *evt, uint32_t time_us)
Update an event.
bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t substate_id)
Check if a power state lock is active (not allowed).
void pm_policy_latency_request_update(struct pm_policy_latency_request *req, uint32_t value_us)
Update a latency requirement.
void pm_policy_latency_request_add(struct pm_policy_latency_request *req, uint32_t value_us)
Add a new latency requirement.
void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req)
Unsubscribe to maximum latency changes.
void pm_policy_event_unregister(struct pm_policy_event *evt)
Unregister an event.
void pm_policy_latency_request_remove(struct pm_policy_latency_request *req)
Remove a latency requirement.
void(* pm_policy_latency_changed_cb_t)(int32_t latency)
Callback to notify when maximum latency changes.
Definition: policy.h:35
void pm_policy_state_lock_get(enum pm_state state, uint8_t substate_id)
Increase a power state lock counter.
void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, pm_policy_latency_changed_cb_t cb)
Subscribe to maximum latency changes.
void pm_policy_event_register(struct pm_policy_event *evt, uint32_t time_us)
Register an event.
state
Definition: parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Event.
Definition: policy.h:66
Latency request.
Definition: policy.h:54
Latency change subscription.
Definition: policy.h:42
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:141
Macros to abstract toolchain specific capabilities.