Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
devicetree.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_I3C_DEVICETREE_H_
8#define ZEPHYR_INCLUDE_DRIVERS_I3C_DEVICETREE_H_
9
17#include <zephyr/device.h>
18#include <zephyr/kernel.h>
19#include <zephyr/types.h>
20#include <zephyr/sys/util.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
35#define I3C_DEVICE_ID_DT(node_id) \
36 { \
37 .pid = ((uint64_t)DT_PROP_BY_IDX(node_id, reg, 1) << 32)\
38 | DT_PROP_BY_IDX(node_id, reg, 2), \
39 }
40
49#define I3C_DEVICE_ID_DT_INST(inst) \
50 I3C_DEVICE_ID_DT(DT_DRV_INST(inst))
51
62#define I3C_DEVICE_DESC_DT(node_id) \
63 { \
64 .bus = DEVICE_DT_GET(DT_BUS(node_id)), \
65 .dev = DEVICE_DT_GET(node_id), \
66 .static_addr = DT_PROP_BY_IDX(node_id, reg, 0), \
67 .pid = ((uint64_t)DT_PROP_BY_IDX(node_id, reg, 1) << 32)\
68 | DT_PROP_BY_IDX(node_id, reg, 2), \
69 .init_dynamic_addr = \
70 DT_PROP_OR(node_id, assigned_address, 0), \
71 },
72
81#define I3C_DEVICE_DESC_DT_INST(inst) \
82 I3C_DEVICE_DESC_DT(DT_DRV_INST(inst))
83
90#define I3C_DEVICE_DESC_DT_FILTERED(node_id) \
91 COND_CODE_0(DT_PROP_BY_IDX(node_id, reg, 1), \
92 (), (I3C_DEVICE_DESC_DT(node_id)))
93
102#define I3C_DEVICE_ARRAY_DT(node_id) \
103 { \
104 DT_FOREACH_CHILD_STATUS_OKAY( \
105 node_id, \
106 I3C_DEVICE_DESC_DT_FILTERED) \
107 }
108
117#define I3C_DEVICE_ARRAY_DT_INST(inst) \
118 I3C_DEVICE_ARRAY_DT(DT_DRV_INST(inst))
119
145#define I3C_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \
146 prio, api, ...) \
147 DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \
148 prio, api, __VA_ARGS__)
149
158#define I3C_DEVICE_DT_INST_DEFINE(inst, ...) \
159 I3C_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
160
171#define I3C_I2C_DEVICE_DESC_DT(node_id) \
172 { \
173 .bus = DEVICE_DT_GET(DT_BUS(node_id)), \
174 .addr = DT_PROP_BY_IDX(node_id, reg, 0), \
175 .lvr = DT_PROP_BY_IDX(node_id, reg, 2), \
176 },
177
186#define I3C_I2C_DEVICE_DESC_DT_INST(inst) \
187 I3C_I2C_DEVICE_DESC_DT(DT_DRV_INST(inst))
188
189
196#define I3C_I2C_DEVICE_DESC_DT_FILTERED(node_id) \
197 COND_CODE_0(DT_PROP_BY_IDX(node_id, reg, 1), \
198 (I3C_I2C_DEVICE_DESC_DT(node_id)), ())
199
208#define I3C_I2C_DEVICE_ARRAY_DT(node_id) \
209 { \
210 DT_FOREACH_CHILD_STATUS_OKAY( \
211 node_id, \
212 I3C_I2C_DEVICE_DESC_DT_FILTERED) \
213 }
214
223#define I3C_I2C_DEVICE_ARRAY_DT_INST(inst) \
224 I3C_I2C_DEVICE_ARRAY_DT(DT_DRV_INST(inst))
225
226#ifdef __cplusplus
227}
228#endif
229
234#endif /* ZEPHYR_INCLUDE_DRIVERS_I3C_DEVICETREE_H_ */
Public kernel APIs.
Misc utilities.