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/** Primary register block (associated with the "primary" set of registers that control the IP). */
46static const dt_soc_proxy_reg_block_t kDtSocProxyRegBlockPrimary = kDtSocProxyRegBlockCore;
47
48/**
49 * List of memories.
50 *
51 * Memories are guaranteed to start at 0 and to be consecutively numbered.
52 */
53typedef enum dt_soc_proxy_memory {
54 kDtSocProxyMemoryCtn = 0, /**< */
55 kDtSocProxyMemoryCount = 1, /**< \internal Number of memories */
57
58/**
59 * List of Alerts.
60 *
61 * Alerts are guaranteed to be numbered consecutively from 0.
62 */
63typedef enum dt_soc_proxy_alert {
64 kDtSocProxyAlertFatalAlertIntg = 0, /**< Fatal bus integrity alert */
65 kDtSocProxyAlertCount = 1, /**< \internal Number of Alerts */
67
68/**
69 * List of clock ports.
70 *
71 * Clock ports are guaranteed to be numbered consecutively from 0.
72 */
73typedef enum dt_soc_proxy_clock {
74 kDtSocProxyClockClk = 0, /**< Clock port clk_i */
75 kDtSocProxyClockAon = 1, /**< Clock port clk_aon_i */
76 kDtSocProxyClockCount = 2, /**< \internal Number of clock ports */
78
79/**
80 * List of reset requests.
81 *
82 * Reset requests are guaranteed to be numbered consecutively from 0.
83 */
85 kDtSocProxyResetReqExternal = 0, /**< External reset request */
86 kDtSocProxyResetReqCount = 1, /**< \internal Number of reset requests */
88
89/**
90 * List of reset ports.
91 *
92 * Reset ports are guaranteed to be numbered consecutively from 0.
93 */
94typedef enum dt_soc_proxy_reset {
95 kDtSocProxyResetRst = 0, /**< Reset port rst_ni */
96 kDtSocProxyResetPor = 1, /**< Reset port rst_por_ni */
97 kDtSocProxyResetCount = 2, /**< \internal Number of reset ports */
99
100/**
101 * List of peripheral I/O.
102 *
103 * Peripheral I/O are guaranteed to be numbered consecutively from 0.
104 */
106 kDtSocProxyPeriphIoSocGpi0 = 0, /**< */
107 kDtSocProxyPeriphIoSocGpi1 = 1, /**< */
108 kDtSocProxyPeriphIoSocGpi2 = 2, /**< */
109 kDtSocProxyPeriphIoSocGpi3 = 3, /**< */
110 kDtSocProxyPeriphIoSocGpi4 = 4, /**< */
111 kDtSocProxyPeriphIoSocGpi5 = 5, /**< */
112 kDtSocProxyPeriphIoSocGpi6 = 6, /**< */
113 kDtSocProxyPeriphIoSocGpi7 = 7, /**< */
114 kDtSocProxyPeriphIoSocGpi8 = 8, /**< */
115 kDtSocProxyPeriphIoSocGpi9 = 9, /**< */
116 kDtSocProxyPeriphIoSocGpi10 = 10, /**< */
117 kDtSocProxyPeriphIoSocGpi11 = 11, /**< */
118 kDtSocProxyPeriphIoSocGpi12 = 12, /**< */
119 kDtSocProxyPeriphIoSocGpi13 = 13, /**< */
120 kDtSocProxyPeriphIoSocGpi14 = 14, /**< */
121 kDtSocProxyPeriphIoSocGpi15 = 15, /**< */
122 kDtSocProxyPeriphIoSocGpo0 = 16, /**< */
123 kDtSocProxyPeriphIoSocGpo1 = 17, /**< */
124 kDtSocProxyPeriphIoSocGpo2 = 18, /**< */
125 kDtSocProxyPeriphIoSocGpo3 = 19, /**< */
126 kDtSocProxyPeriphIoSocGpo4 = 20, /**< */
127 kDtSocProxyPeriphIoSocGpo5 = 21, /**< */
128 kDtSocProxyPeriphIoSocGpo6 = 22, /**< */
129 kDtSocProxyPeriphIoSocGpo7 = 23, /**< */
130 kDtSocProxyPeriphIoSocGpo8 = 24, /**< */
131 kDtSocProxyPeriphIoSocGpo9 = 25, /**< */
132 kDtSocProxyPeriphIoSocGpo10 = 26, /**< */
133 kDtSocProxyPeriphIoSocGpo11 = 27, /**< */
134 kDtSocProxyPeriphIoSocGpo12 = 28, /**< */
135 kDtSocProxyPeriphIoSocGpo13 = 29, /**< */
136 kDtSocProxyPeriphIoSocGpo14 = 30, /**< */
137 kDtSocProxyPeriphIoSocGpo15 = 31, /**< */
138 kDtSocProxyPeriphIoCount = 32, /**< \internal Number of peripheral I/O */
140
141/**
142 * List of wakeups.
143 *
144 * Wakeups are guaranteed to be numbered consecutively from 0.
145 */
147 kDtSocProxyWakeupWkupExternalReq = 0, /**< External wakeup request */
148 kDtSocProxyWakeupCount = 1, /**< \internal Number of wakeups */
150
151
152/**
153 * Get the soc_proxy instance from an instance ID
154 *
155 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
156 *
157 * @param inst_id Instance ID.
158 * @return A soc_proxy instance.
159 *
160 * **Note:** This function only makes sense if the instance ID has device type soc_proxy,
161 * otherwise the returned value is unspecified.
162 */
164
165/**
166 * Get the instance ID of an instance.
167 *
168 * @param dt Instance of soc_proxy.
169 * @return The instance ID of that instance.
170 */
172
173/**
174 * Get the register base address of an instance.
175 *
176 * @param dt Instance of soc_proxy.
177 * @param reg_block The register block requested.
178 * @return The register base address of the requested block.
179 */
182 dt_soc_proxy_reg_block_t reg_block);
183
184/**
185 * Get the primary register base address of an instance.
186 *
187 * This is just a convenience function, equivalent to
188 * `dt_soc_proxy_reg_block(dt, kDtSocProxyRegBlockCore)`
189 *
190 * @param dt Instance of soc_proxy.
191 * @return The register base address of the primary register block.
192 */
193static inline uint32_t dt_soc_proxy_primary_reg_block(
194 dt_soc_proxy_t dt) {
195 return dt_soc_proxy_reg_block(dt, kDtSocProxyRegBlockCore);
196}
197
198/**
199 * Get the base address of a memory.
200 *
201 * @param dt Instance of soc_proxy.
202 * @param mem The memory requested.
203 * @return The base address of the requested memory.
204 */
208
209/**
210 * Get the size of a memory.
211 *
212 * @param dt Instance of soc_proxy.
213 * @param mem The memory requested.
214 * @return The size of the requested memory.
215 */
219
220
221/**
222 * Get the alert ID of a soc_proxy alert for a given instance.
223 *
224 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
225 * instances where the instance is not connected, the return value is unspecified.
226 *
227 * @param dt Instance of soc_proxy.
228 * @param alert A soc_proxy alert.
229 * @return The Alert Handler alert ID of the alert of this instance.
230 */
234
235/**
236 * Convert a global alert ID to a local soc_proxy alert type.
237 *
238 * @param dt Instance of soc_proxy.
239 * @param alert A global alert ID that belongs to this instance.
240 * @return The soc_proxy alert, or `kDtSocProxyAlertCount`.
241 *
242 * **Note:** This function assumes that the global alert ID belongs to the
243 * instance of soc_proxy passed in parameter. In other words, it must be the case
244 * that `dt_soc_proxy_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
245 * this function will return `kDtSocProxyAlertCount`.
246 */
249 dt_alert_id_t alert);
250
251
252/**
253 * Get the peripheral I/O description of an instance.
254 *
255 * @param dt Instance of soc_proxy.
256 * @param sig Requested peripheral I/O.
257 * @return Description of the requested peripheral I/O for this instance.
258 */
262
263/**
264 * Get the clock signal connected to a clock port of an instance.
265 *
266 * @param dt Instance of soc_proxy.
267 * @param clk Clock port.
268 * @return Clock signal.
269 */
273
274/**
275 * Get the reset signal connected to a reset port of an instance.
276 *
277 * @param dt Instance of soc_proxy.
278 * @param rst Reset port.
279 * @return Reset signal.
280 */
284
285
286
287#ifdef __cplusplus
288} // extern "C"
289#endif // __cplusplus
290
291#endif // OPENTITAN_DT_SOC_PROXY_H_