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