Software APIs
dt_soc_proxy.h
Go to the documentation of this file.
1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4//
5// Device table API auto-generated by `dtgen`
6
7#ifndef OPENTITAN_DT_SOC_PROXY_H_
8#define OPENTITAN_DT_SOC_PROXY_H_
9
10/**
11 * @file
12 * @brief Device Tables (DT) for IP soc_proxy and top darjeeling.
13 *
14 * This file contains the type definitions and global functions of the soc_proxy.
15 */
16
17#include "dt_api.h"
18#include <stdint.h>
19
20/**
21 * List of instances.
22 */
23typedef enum dt_soc_proxy {
24 kDtSocProxy = 0, /**< soc_proxy */
25 kDtSocProxyFirst = 0, /**< \internal First instance */
26 kDtSocProxyCount = 1, /**< \internal Number of instances */
28
29/**
30 * List of register blocks.
31 *
32 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
33 */
35 kDtSocProxyRegBlockCore = 0, /**< */
36 kDtSocProxyRegBlockCtn = 1, /**< */
37 kDtSocProxyRegBlockCount = 2, /**< \internal Number of register blocks */
39
40/** Primary register block (associated with the "primary" set of registers that control the IP). */
41static const dt_soc_proxy_reg_block_t kDtSocProxyRegBlockPrimary = kDtSocProxyRegBlockCore;
42
43/**
44 * List of IRQs.
45 *
46 * IRQs are guaranteed to be numbered consecutively from 0.
47 */
48typedef enum dt_soc_proxy_irq {
49 kDtSocProxyIrqExternal0 = 0, /**< External interrupt request */
50 kDtSocProxyIrqExternal1 = 1, /**< External interrupt request */
51 kDtSocProxyIrqExternal2 = 2, /**< External interrupt request */
52 kDtSocProxyIrqExternal3 = 3, /**< External interrupt request */
53 kDtSocProxyIrqExternal4 = 4, /**< External interrupt request */
54 kDtSocProxyIrqExternal5 = 5, /**< External interrupt request */
55 kDtSocProxyIrqExternal6 = 6, /**< External interrupt request */
56 kDtSocProxyIrqExternal7 = 7, /**< External interrupt request */
57 kDtSocProxyIrqExternal8 = 8, /**< External interrupt request */
58 kDtSocProxyIrqExternal9 = 9, /**< External interrupt request */
59 kDtSocProxyIrqExternal10 = 10, /**< External interrupt request */
60 kDtSocProxyIrqExternal11 = 11, /**< External interrupt request */
61 kDtSocProxyIrqExternal12 = 12, /**< External interrupt request */
62 kDtSocProxyIrqExternal13 = 13, /**< External interrupt request */
63 kDtSocProxyIrqExternal14 = 14, /**< External interrupt request */
64 kDtSocProxyIrqExternal15 = 15, /**< External interrupt request */
65 kDtSocProxyIrqExternal16 = 16, /**< External interrupt request */
66 kDtSocProxyIrqExternal17 = 17, /**< External interrupt request */
67 kDtSocProxyIrqExternal18 = 18, /**< External interrupt request */
68 kDtSocProxyIrqExternal19 = 19, /**< External interrupt request */
69 kDtSocProxyIrqExternal20 = 20, /**< External interrupt request */
70 kDtSocProxyIrqExternal21 = 21, /**< External interrupt request */
71 kDtSocProxyIrqExternal22 = 22, /**< External interrupt request */
72 kDtSocProxyIrqExternal23 = 23, /**< External interrupt request */
73 kDtSocProxyIrqExternal24 = 24, /**< External interrupt request */
74 kDtSocProxyIrqExternal25 = 25, /**< External interrupt request */
75 kDtSocProxyIrqExternal26 = 26, /**< External interrupt request */
76 kDtSocProxyIrqExternal27 = 27, /**< External interrupt request */
77 kDtSocProxyIrqExternal28 = 28, /**< External interrupt request */
78 kDtSocProxyIrqExternal29 = 29, /**< External interrupt request */
79 kDtSocProxyIrqExternal30 = 30, /**< External interrupt request */
80 kDtSocProxyIrqExternal31 = 31, /**< External interrupt request */
81 kDtSocProxyIrqCount = 32, /**< \internal Number of IRQs */
83
84/**
85 * List of Alerts.
86 *
87 * Alerts are guaranteed to be numbered consecutively from 0.
88 */
89typedef enum dt_soc_proxy_alert {
90 kDtSocProxyAlertFatalAlertIntg = 0, /**< Fatal bus integrity alert */
91 kDtSocProxyAlertFatalAlertExternal0 = 1, /**< Fatal external alert channel 0 */
92 kDtSocProxyAlertFatalAlertExternal1 = 2, /**< Fatal external alert channel 1 */
93 kDtSocProxyAlertFatalAlertExternal2 = 3, /**< Fatal external alert channel 2 */
94 kDtSocProxyAlertFatalAlertExternal3 = 4, /**< Fatal external alert channel 3 */
95 kDtSocProxyAlertFatalAlertExternal4 = 5, /**< Fatal external alert channel 4 */
96 kDtSocProxyAlertFatalAlertExternal5 = 6, /**< Fatal external alert channel 5 */
97 kDtSocProxyAlertFatalAlertExternal6 = 7, /**< Fatal external alert channel 6 */
98 kDtSocProxyAlertFatalAlertExternal7 = 8, /**< Fatal external alert channel 7 */
99 kDtSocProxyAlertFatalAlertExternal8 = 9, /**< Fatal external alert channel 8 */
100 kDtSocProxyAlertFatalAlertExternal9 = 10, /**< Fatal external alert channel 9 */
101 kDtSocProxyAlertFatalAlertExternal10 = 11, /**< Fatal external alert channel 10 */
102 kDtSocProxyAlertFatalAlertExternal11 = 12, /**< Fatal external alert channel 11 */
103 kDtSocProxyAlertFatalAlertExternal12 = 13, /**< Fatal external alert channel 12 */
104 kDtSocProxyAlertFatalAlertExternal13 = 14, /**< Fatal external alert channel 13 */
105 kDtSocProxyAlertFatalAlertExternal14 = 15, /**< Fatal external alert channel 14 */
106 kDtSocProxyAlertFatalAlertExternal15 = 16, /**< Fatal external alert channel 15 */
107 kDtSocProxyAlertFatalAlertExternal16 = 17, /**< Fatal external alert channel 16 */
108 kDtSocProxyAlertFatalAlertExternal17 = 18, /**< Fatal external alert channel 17 */
109 kDtSocProxyAlertFatalAlertExternal18 = 19, /**< Fatal external alert channel 18 */
110 kDtSocProxyAlertFatalAlertExternal19 = 20, /**< Fatal external alert channel 19 */
111 kDtSocProxyAlertFatalAlertExternal20 = 21, /**< Fatal external alert channel 20 */
112 kDtSocProxyAlertFatalAlertExternal21 = 22, /**< Fatal external alert channel 21 */
113 kDtSocProxyAlertFatalAlertExternal22 = 23, /**< Fatal external alert channel 22 */
114 kDtSocProxyAlertFatalAlertExternal23 = 24, /**< Fatal external alert channel 23 */
115 kDtSocProxyAlertRecovAlertExternal0 = 25, /**< Recoverable external alert channel 0 */
116 kDtSocProxyAlertRecovAlertExternal1 = 26, /**< Recoverable external alert channel 1 */
117 kDtSocProxyAlertRecovAlertExternal2 = 27, /**< Recoverable external alert channel 2 */
118 kDtSocProxyAlertRecovAlertExternal3 = 28, /**< Recoverable external alert channel 3 */
119 kDtSocProxyAlertCount = 29, /**< \internal Number of Alerts */
121
122/**
123 * List of clock ports.
124 *
125 * Clock ports are guaranteed to be numbered consecutively from 0.
126 */
127typedef enum dt_soc_proxy_clock {
128 kDtSocProxyClockClk = 0, /**< Clock port clk_i */
129 kDtSocProxyClockAon = 1, /**< Clock port clk_aon_i */
130 kDtSocProxyClockCount = 2, /**< \internal Number of clock ports */
132
133/**
134 * List of reset requests.
135 *
136 * Reset requests are guaranteed to be numbered consecutively from 0.
137 */
139 kDtSocProxyResetReqExternal = 0, /**< External reset request */
140 kDtSocProxyResetReqCount = 1, /**< \internal Number of reset requests */
142
143/**
144 * List of reset ports.
145 *
146 * Reset ports are guaranteed to be numbered consecutively from 0.
147 */
148typedef enum dt_soc_proxy_reset {
149 kDtSocProxyResetRst = 0, /**< Reset port rst_ni */
150 kDtSocProxyResetPor = 1, /**< Reset port rst_por_ni */
151 kDtSocProxyResetCount = 2, /**< \internal Number of reset ports */
153
154/**
155 * List of peripheral I/O.
156 *
157 * Peripheral I/O are guaranteed to be numbered consecutively from 0.
158 */
160 kDtSocProxyPeriphIoSocGpi0 = 0, /**< */
161 kDtSocProxyPeriphIoSocGpi1 = 1, /**< */
162 kDtSocProxyPeriphIoSocGpi2 = 2, /**< */
163 kDtSocProxyPeriphIoSocGpi3 = 3, /**< */
164 kDtSocProxyPeriphIoSocGpi4 = 4, /**< */
165 kDtSocProxyPeriphIoSocGpi5 = 5, /**< */
166 kDtSocProxyPeriphIoSocGpi6 = 6, /**< */
167 kDtSocProxyPeriphIoSocGpi7 = 7, /**< */
168 kDtSocProxyPeriphIoSocGpi8 = 8, /**< */
169 kDtSocProxyPeriphIoSocGpi9 = 9, /**< */
170 kDtSocProxyPeriphIoSocGpi10 = 10, /**< */
171 kDtSocProxyPeriphIoSocGpi11 = 11, /**< */
172 kDtSocProxyPeriphIoSocGpi12 = 12, /**< */
173 kDtSocProxyPeriphIoSocGpi13 = 13, /**< */
174 kDtSocProxyPeriphIoSocGpi14 = 14, /**< */
175 kDtSocProxyPeriphIoSocGpi15 = 15, /**< */
176 kDtSocProxyPeriphIoSocGpo0 = 16, /**< */
177 kDtSocProxyPeriphIoSocGpo1 = 17, /**< */
178 kDtSocProxyPeriphIoSocGpo2 = 18, /**< */
179 kDtSocProxyPeriphIoSocGpo3 = 19, /**< */
180 kDtSocProxyPeriphIoSocGpo4 = 20, /**< */
181 kDtSocProxyPeriphIoSocGpo5 = 21, /**< */
182 kDtSocProxyPeriphIoSocGpo6 = 22, /**< */
183 kDtSocProxyPeriphIoSocGpo7 = 23, /**< */
184 kDtSocProxyPeriphIoSocGpo8 = 24, /**< */
185 kDtSocProxyPeriphIoSocGpo9 = 25, /**< */
186 kDtSocProxyPeriphIoSocGpo10 = 26, /**< */
187 kDtSocProxyPeriphIoSocGpo11 = 27, /**< */
188 kDtSocProxyPeriphIoSocGpo12 = 28, /**< */
189 kDtSocProxyPeriphIoSocGpo13 = 29, /**< */
190 kDtSocProxyPeriphIoSocGpo14 = 30, /**< */
191 kDtSocProxyPeriphIoSocGpo15 = 31, /**< */
192 kDtSocProxyPeriphIoCount = 32, /**< \internal Number of peripheral I/O */
194
195/**
196 * List of wakeups.
197 *
198 * Wakeups are guaranteed to be numbered consecutively from 0.
199 */
201 kDtSocProxyWakeupWkupInternalReq = 0, /**< Internal wakeup request, should be asserted whenever an external alert or IRQ is seen */
202 kDtSocProxyWakeupWkupExternalReq = 1, /**< External wakeup request */
203 kDtSocProxyWakeupCount = 2, /**< \internal Number of wakeups */
205
206
207/**
208 * Get the soc_proxy instance from an instance ID
209 *
210 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
211 *
212 * @param inst_id Instance ID.
213 * @return A soc_proxy instance.
214 *
215 * **Note:** This function only makes sense if the instance ID has device type soc_proxy,
216 * otherwise the returned value is unspecified.
217 */
219
220/**
221 * Get the instance ID of an instance.
222 *
223 * @param dt Instance of soc_proxy.
224 * @return The instance ID of that instance.
225 */
227
228/**
229 * Get the register base address of an instance.
230 *
231 * @param dt Instance of soc_proxy.
232 * @param reg_block The register block requested.
233 * @return The register base address of the requested block.
234 */
237 dt_soc_proxy_reg_block_t reg_block);
238
239/**
240 * Get the primary register base address of an instance.
241 *
242 * This is just a convenience function, equivalent to
243 * `dt_soc_proxy_reg_block(dt, kDtSocProxyRegBlockCore)`
244 *
245 * @param dt Instance of soc_proxy.
246 * @return The register base address of the primary register block.
247 */
248static inline uint32_t dt_soc_proxy_primary_reg_block(
249 dt_soc_proxy_t dt) {
250 return dt_soc_proxy_reg_block(dt, kDtSocProxyRegBlockCore);
251}
252
253/**
254 * Get the PLIC ID of a soc_proxy IRQ for a given instance.
255 *
256 * If the instance is not connected to the PLIC, this function
257 * will return `kDtPlicIrqIdNone`.
258 *
259 * @param dt Instance of soc_proxy.
260 * @param irq A soc_proxy IRQ.
261 * @return The PLIC ID of the IRQ of this instance.
262 */
266
267/**
268 * Convert a global IRQ ID to a local soc_proxy IRQ type.
269 *
270 * @param dt Instance of soc_proxy.
271 * @param irq A PLIC ID that belongs to this instance.
272 * @return The soc_proxy IRQ, or `kDtSocProxyIrqCount`.
273 *
274 * **Note:** This function assumes that the PLIC ID belongs to the instance
275 * of soc_proxy passed in parameter. In other words, it must be the case that
276 * `dt_soc_proxy_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
277 * will return `kDtSocProxyIrqCount`.
278 */
281 dt_plic_irq_id_t irq);
282
283
284/**
285 * Get the alert ID of a soc_proxy alert for a given instance.
286 *
287 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
288 * instances where the instance is not connected, the return value is unspecified.
289 *
290 * @param dt Instance of soc_proxy.
291 * @param alert A soc_proxy alert.
292 * @return The Alert Handler alert ID of the alert of this instance.
293 */
297
298/**
299 * Convert a global alert ID to a local soc_proxy alert type.
300 *
301 * @param dt Instance of soc_proxy.
302 * @param alert A global alert ID that belongs to this instance.
303 * @return The soc_proxy alert, or `kDtSocProxyAlertCount`.
304 *
305 * **Note:** This function assumes that the global alert ID belongs to the
306 * instance of soc_proxy passed in parameter. In other words, it must be the case
307 * that `dt_soc_proxy_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
308 * this function will return `kDtSocProxyAlertCount`.
309 */
312 dt_alert_id_t alert);
313
314
315/**
316 * Get the peripheral I/O description of an instance.
317 *
318 * @param dt Instance of soc_proxy.
319 * @param sig Requested peripheral I/O.
320 * @return Description of the requested peripheral I/O for this instance.
321 */
325
326/**
327 * Get the clock signal connected to a clock port of an instance.
328 *
329 * @param dt Instance of soc_proxy.
330 * @param clk Clock port.
331 * @return Clock signal.
332 */
336
337/**
338 * Get the reset signal connected to a reset port of an instance.
339 *
340 * @param dt Instance of soc_proxy.
341 * @param rst Reset port.
342 * @return Reset signal.
343 */
347
348
349
350#endif // OPENTITAN_DT_SOC_PROXY_H_