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