Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pstate.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Analog Devices, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_SUBSYS_CPU_FREQ_PSTATE_H_
8#define ZEPHYR_SUBSYS_CPU_FREQ_PSTATE_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include <zephyr/types.h>
15#include <zephyr/devicetree.h>
17
26
28#define PSTATE_DT_SYM(_node) _CONCAT(__pstate_, DT_DEP_ORD(_node))
29
36#define PSTATE_DT_DEFINE(_node, _config) \
37 const struct pstate PSTATE_DT_SYM(_node) = { \
38 .load_threshold = DT_PROP(_node, load_threshold), \
39 .config = _config, \
40 };
41
49#define PSTATE_DT_GET(_node) &PSTATE_DT_SYM(_node)
50
51
58struct pstate {
60 const void *config;
61};
62
63/* Define performance-states as extern to be picked up by CPU Freq policy */
64#define Z_DECLARE_PSTATE_EXTERN(_node) \
65 extern const struct pstate PSTATE_DT_SYM(_node);
66
67DT_FOREACH_CHILD_STATUS_OKAY(DT_PATH(performance_states), Z_DECLARE_PSTATE_EXTERN)
68
69
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif /* ZEPHYR_SUBSYS_CPU_FREQ_PSTATE_H_ */
Devicetree main header.
#define DT_FOREACH_CHILD_STATUS_OKAY(node_id, fn)
Call fn on the child nodes with status okay
Definition devicetree.h:3207
#define DT_PATH(...)
Get a node identifier for a devicetree path.
Definition devicetree.h:140
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
CPU performance state (pstate) struct.
Definition pstate.h:58
const void * config
Vendor specific devicetree properties.
Definition pstate.h:60
uint8_t load_threshold
CPU load threshold at which P-state should be triggered.
Definition pstate.h:59