Zephyr API Documentation 3.7.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/device.h>
14#include <zephyr/pm/state.h>
15#include <zephyr/sys/slist.h>
16#include <zephyr/toolchain.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
36typedef void (*pm_policy_latency_changed_cb_t)(int32_t latency);
37
49
57 sys_snode_t node;
58 uint32_t value_us;
60};
61
69 sys_snode_t node;
70 uint32_t value_cyc;
72};
73
89const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks);
90
94#define PM_ALL_SUBSTATES (UINT8_MAX)
95
96#if defined(CONFIG_PM) || defined(__DOXYGEN__)
116
127
139
150 uint32_t value_us);
151
159 uint32_t value_us);
160
167
176
183
205
215
224
237
250
258
259#else
261{
262 ARG_UNUSED(state);
263 ARG_UNUSED(substate_id);
264}
265
267{
268 ARG_UNUSED(state);
269 ARG_UNUSED(substate_id);
270}
271
273{
274 ARG_UNUSED(state);
275 ARG_UNUSED(substate_id);
276
277 return false;
278}
279
280static inline void pm_policy_latency_request_add(
281 struct pm_policy_latency_request *req, uint32_t value_us)
282{
283 ARG_UNUSED(req);
284 ARG_UNUSED(value_us);
285}
286
287static inline void pm_policy_latency_request_update(
288 struct pm_policy_latency_request *req, uint32_t value_us)
289{
290 ARG_UNUSED(req);
291 ARG_UNUSED(value_us);
292}
293
294static inline void pm_policy_latency_request_remove(
295 struct pm_policy_latency_request *req)
296{
297 ARG_UNUSED(req);
298}
299
300static inline void pm_policy_event_register(struct pm_policy_event *evt, uint32_t cycle)
301{
302 ARG_UNUSED(evt);
303 ARG_UNUSED(cycle);
304}
305
306static inline void pm_policy_event_update(struct pm_policy_event *evt, uint32_t cycle)
307{
308 ARG_UNUSED(evt);
309 ARG_UNUSED(cycle);
310}
311
312static inline void pm_policy_event_unregister(struct pm_policy_event *evt)
313{
314 ARG_UNUSED(evt);
315}
316
317static inline void pm_policy_device_power_lock_get(const struct device *dev)
318{
319 ARG_UNUSED(dev);
320}
321
322static inline void pm_policy_device_power_lock_put(const struct device *dev)
323{
324 ARG_UNUSED(dev);
325}
326
327static inline int32_t pm_policy_next_event_ticks(void)
328{
329 return -1;
330}
331
332#endif /* CONFIG_PM */
333
338#ifdef __cplusplus
339}
340#endif
341
342#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_event_update(struct pm_policy_event *evt, uint32_t cycle)
Update an event.
void pm_policy_state_lock_put(enum pm_state state, uint8_t substate_id)
Decrease a power state lock counter.
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_device_power_lock_get(const struct device *dev)
Increase power state locks.
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_register(struct pm_policy_event *evt, uint32_t cycle)
Register an event.
void pm_policy_event_unregister(struct pm_policy_event *evt)
Unregister an event.
int32_t pm_policy_next_event_ticks(void)
Returns the ticks until the next 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:36
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_device_power_lock_put(const struct device *dev)
Decrease power state locks.
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
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
Event.
Definition policy.h:67
Latency request.
Definition policy.h:55
Latency change subscription.
Definition policy.h:43
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.