|
Zephyr API 3.6.99
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
15#ifndef _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_UTIL_H_
16#define _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_UTIL_H_
29#define SCMI_PROTOCOL_NAME(proto) CONCAT(scmi_protocol_, proto)
31#ifdef CONFIG_ARM_SCMI_TRANSPORT_HAS_STATIC_CHANNELS
33#ifdef CONFIG_ARM_SCMI_MAILBOX_TRANSPORT
47#define DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, idx)\
48 DT_PROP_HAS_IDX(node_id, shmem, idx)
50#error "Transport with static channels needs to define HAS_CHAN macro"
53#define SCMI_TRANSPORT_CHAN_NAME(proto, idx) CONCAT(scmi_channel_, proto, _, idx)
66#define DT_SCMI_TRANSPORT_TX_CHAN_DECLARE(node_id) \
67 COND_CODE_1(DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, 0), \
68 (extern struct scmi_channel \
69 SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR(node_id), 0);), \
70 (extern struct scmi_channel \
71 SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 0);)) \
85#define DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id) \
86 DT_SCMI_TRANSPORT_TX_CHAN_DECLARE(node_id) \
96#define DT_INST_SCMI_TRANSPORT_CHANNELS_DECLARE(inst) \
97 DT_SCMI_TRANSPORT_CHANNELS_DECLARE(DT_INST(inst, DT_DRV_COMPAT))
111#define DT_SCMI_TRANSPORT_TX_CHAN(node_id) \
112 COND_CODE_1(DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, 0), \
113 (&SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR(node_id), 0)), \
114 (&SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 0)))
128#define DT_SCMI_TRANSPORT_CHAN_DEFINE(node_id, idx, proto, pdata) \
129 struct scmi_channel SCMI_TRANSPORT_CHAN_NAME(proto, idx) = \
149#define DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, proto, pdata) \
150 STRUCT_SECTION_ITERABLE(scmi_protocol, SCMI_PROTOCOL_NAME(proto)) = \
153 .tx = DT_SCMI_TRANSPORT_TX_CHAN(node_id), \
159#define DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id)
161#define DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, proto, pdata) \
162 STRUCT_SECTION_ITERABLE(scmi_protocol, SCMI_PROTOCOL_NAME(proto)) = \
182#define DT_INST_SCMI_TRANSPORT_DEFINE(inst, pm, data, config, level, prio, api) \
183 DEVICE_DT_INST_DEFINE(inst, &scmi_core_transport_init, \
184 pm, data, config, level, prio, api)
211#define DT_SCMI_PROTOCOL_DEFINE(node_id, init_fn, pm, data, config, \
213 DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id) \
214 DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, DT_REG_ADDR(node_id), data); \
215 DEVICE_DT_DEFINE(node_id, init_fn, pm, \
216 &SCMI_PROTOCOL_NAME(DT_REG_ADDR(node_id)), \
217 config, level, prio, api)
226#define DT_INST_SCMI_PROTOCOL_DEFINE(inst, init_fn, pm, data, config, \
228 DT_SCMI_PROTOCOL_DEFINE(DT_INST(inst, DT_DRV_COMPAT), init_fn, pm, \
229 data, config, level, prio, api)
242#define DT_SCMI_PROTOCOL_DEFINE_NODEV(node_id, data) \
243 DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id) \
244 DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, DT_REG_ADDR(node_id), data)
258#define SCMI_FIELD_MAKE(x, mask, shift)\
259 (((uint32_t)(x) & (mask)) << (shift))
269#define SCMI_PROTOCOL_BASE 16
270#define SCMI_PROTOCOL_POWER_DOMAIN 17
271#define SCMI_PROTOCOL_SYSTEM 18
272#define SCMI_PROTOCOL_PERF 19
273#define SCMI_PROTOCOL_CLOCK 20
274#define SCMI_PROTOCOL_SENSOR 21
275#define SCMI_PROTOCOL_RESET_DOMAIN 22
276#define SCMI_PROTOCOL_VOLTAGE_DOMAIN 23
277#define SCMI_PROTOCOL_PCAP_MONITOR 24
278#define SCMI_PROTOCOL_PINCTRL 25