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