Software APIs
dif_soc_proxy_autogen.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
6
7#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SOC_PROXY_AUTOGEN_H_
8#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SOC_PROXY_AUTOGEN_H_
9
10// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
11// util/autogen_dif.py -i
12// hw/top_darjeeling/ip/soc_proxy/data/soc_proxy.hjson -o
13// bazel-out/k8-fastbuild-ST-24cc6a2908d2/bin/sw/device/lib/dif/autogen
14
15
16/**
17 * @file
18 * @brief <a href="/book/hw/ip/soc_proxy/">SOC_PROXY</a> Device Interface Functions
19 */
20
21#include <stdbool.h>
22#include <stdint.h>
23
27#include "dt/dt_soc_proxy.h" // Generated.
28
29#ifdef __cplusplus
30extern "C" {
31#endif // __cplusplus
32
33/**
34 * A handle to soc_proxy.
35 *
36 * This type should be treated as opaque by users.
37 */
38typedef struct dif_soc_proxy {
39 /**
40 * The base address for the soc_proxy hardware registers.
41 */
43 /**
44 * The instance, set to `kDtSocProxyCount` if not initialized
45 * through `dif_soc_proxy_init_from_dt`.
46 */
49
50/**
51 * Creates a new handle for a(n) soc_proxy peripheral.
52 *
53 * This function does not actuate the hardware.
54 *
55 * @param base_addr The MMIO base address of the soc_proxy peripheral.
56 * @param[out] soc_proxy Out param for the initialized handle.
57 * @return The result of the operation.
58 *
59 * DEPRECATED This function exists solely for the transition to
60 * dt-based DIFs and will be removed in the future.
61 */
64 mmio_region_t base_addr,
65 dif_soc_proxy_t *soc_proxy);
66
67/**
68 * Creates a new handle for a(n) soc_proxy peripheral.
69 *
70 * This function does not actuate the hardware.
71 *
72 * @param dt The devicetable description of the device.
73 * @param[out] soc_proxy Out param for the initialized handle.
74 * @return The result of the operation.
75 */
79 dif_soc_proxy_t *soc_proxy);
80
81/**
82 * Get the DT handle from this DIF.
83 *
84 * If this DIF was initialized by `dif_soc_proxy_init_from_dt(dt, ..)`
85 * then this function will return `dt`. Otherwise it will return an error.
86 *
87 * @param soc_proxy A soc_proxy handle.
88 * @param[out] dt DT handle.
89 * @return `kDifBadArg` if the DIF has no DT information, `kDifOk` otherwise.
90 */
93 const dif_soc_proxy_t *soc_proxy,
94 dt_soc_proxy_t *dt);
95
96 /**
97 * A soc_proxy alert type.
98 */
99 typedef enum dif_soc_proxy_alert {
100 /**
101 * Fatal bus integrity alert
102 */
104 /**
105 * Fatal external alert channel 0
106 */
108 /**
109 * Fatal external alert channel 1
110 */
112 /**
113 * Fatal external alert channel 2
114 */
116 /**
117 * Fatal external alert channel 3
118 */
120 /**
121 * Fatal external alert channel 4
122 */
124 /**
125 * Fatal external alert channel 5
126 */
128 /**
129 * Fatal external alert channel 6
130 */
132 /**
133 * Fatal external alert channel 7
134 */
136 /**
137 * Fatal external alert channel 8
138 */
140 /**
141 * Fatal external alert channel 9
142 */
144 /**
145 * Fatal external alert channel 10
146 */
148 /**
149 * Fatal external alert channel 11
150 */
152 /**
153 * Fatal external alert channel 12
154 */
156 /**
157 * Fatal external alert channel 13
158 */
160 /**
161 * Fatal external alert channel 14
162 */
164 /**
165 * Fatal external alert channel 15
166 */
168 /**
169 * Fatal external alert channel 16
170 */
172 /**
173 * Fatal external alert channel 17
174 */
176 /**
177 * Fatal external alert channel 18
178 */
180 /**
181 * Fatal external alert channel 19
182 */
184 /**
185 * Fatal external alert channel 20
186 */
188 /**
189 * Fatal external alert channel 21
190 */
192 /**
193 * Fatal external alert channel 22
194 */
196 /**
197 * Fatal external alert channel 23
198 */
200 /**
201 * Recoverable external alert channel 0
202 */
204 /**
205 * Recoverable external alert channel 1
206 */
208 /**
209 * Recoverable external alert channel 2
210 */
212 /**
213 * Recoverable external alert channel 3
214 */
217
218 /**
219 * Forces a particular alert, causing it to be escalated as if the hardware
220 * had raised it.
221 *
222 * @param soc_proxy A soc_proxy handle.
223 * @param alert The alert to force.
224 * @return The result of the operation.
225 */
228 const dif_soc_proxy_t *soc_proxy,
230
231 // DEPRECATED This typedef exists solely for the transition to
232 // dt-based interrupt numbers and will be removed in the future.
233 typedef dt_soc_proxy_irq_t dif_soc_proxy_irq_t;
234
235 /**
236 * A soc_proxy interrupt request type.
237 *
238 * DEPRECATED Use `dt_soc_proxy_irq_t` instead.
239 * This enumeration exists solely for the transition to
240 * dt-based interrupt numbers and will be removed in the future.
241 *
242 * The following are defines to keep the types consistent with DT.
243 */
244 /**
245 * External interrupt request
246 */
247#define kDifSocProxyIrqExternal0 kDtSocProxyIrqExternal0
248#define kDifSocProxyIrqExternal1 kDtSocProxyIrqExternal1
249#define kDifSocProxyIrqExternal2 kDtSocProxyIrqExternal2
250#define kDifSocProxyIrqExternal3 kDtSocProxyIrqExternal3
251#define kDifSocProxyIrqExternal4 kDtSocProxyIrqExternal4
252#define kDifSocProxyIrqExternal5 kDtSocProxyIrqExternal5
253#define kDifSocProxyIrqExternal6 kDtSocProxyIrqExternal6
254#define kDifSocProxyIrqExternal7 kDtSocProxyIrqExternal7
255#define kDifSocProxyIrqExternal8 kDtSocProxyIrqExternal8
256#define kDifSocProxyIrqExternal9 kDtSocProxyIrqExternal9
257#define kDifSocProxyIrqExternal10 kDtSocProxyIrqExternal10
258#define kDifSocProxyIrqExternal11 kDtSocProxyIrqExternal11
259#define kDifSocProxyIrqExternal12 kDtSocProxyIrqExternal12
260#define kDifSocProxyIrqExternal13 kDtSocProxyIrqExternal13
261#define kDifSocProxyIrqExternal14 kDtSocProxyIrqExternal14
262#define kDifSocProxyIrqExternal15 kDtSocProxyIrqExternal15
263#define kDifSocProxyIrqExternal16 kDtSocProxyIrqExternal16
264#define kDifSocProxyIrqExternal17 kDtSocProxyIrqExternal17
265#define kDifSocProxyIrqExternal18 kDtSocProxyIrqExternal18
266#define kDifSocProxyIrqExternal19 kDtSocProxyIrqExternal19
267#define kDifSocProxyIrqExternal20 kDtSocProxyIrqExternal20
268#define kDifSocProxyIrqExternal21 kDtSocProxyIrqExternal21
269#define kDifSocProxyIrqExternal22 kDtSocProxyIrqExternal22
270#define kDifSocProxyIrqExternal23 kDtSocProxyIrqExternal23
271#define kDifSocProxyIrqExternal24 kDtSocProxyIrqExternal24
272#define kDifSocProxyIrqExternal25 kDtSocProxyIrqExternal25
273#define kDifSocProxyIrqExternal26 kDtSocProxyIrqExternal26
274#define kDifSocProxyIrqExternal27 kDtSocProxyIrqExternal27
275#define kDifSocProxyIrqExternal28 kDtSocProxyIrqExternal28
276#define kDifSocProxyIrqExternal29 kDtSocProxyIrqExternal29
277#define kDifSocProxyIrqExternal30 kDtSocProxyIrqExternal30
278#define kDifSocProxyIrqExternal31 kDtSocProxyIrqExternal31
279
280 /**
281 * A snapshot of the state of the interrupts for this IP.
282 *
283 * This is an opaque type, to be used with the `dif_soc_proxy_irq_get_state()`
284 * and `dif_soc_proxy_irq_acknowledge_state()` functions.
285 */
287
288 /**
289 * Returns the type of a given interrupt (i.e., event or status) for this IP.
290 *
291 * @param soc_proxy A soc_proxy handle.
292 * @param irq An interrupt request.
293 * @param[out] type Out-param for the interrupt type.
294 * @return The result of the operation.
295 */
298 const dif_soc_proxy_t *soc_proxy,
299 dif_soc_proxy_irq_t,
300 dif_irq_type_t *type);
301
302 /**
303 * Returns the state of all interrupts (i.e., pending or not) for this IP.
304 *
305 * @param soc_proxy A soc_proxy handle.
306 * @param[out] snapshot Out-param for interrupt state snapshot.
307 * @return The result of the operation.
308 */
311 const dif_soc_proxy_t *soc_proxy,
313
314 /**
315 * Returns whether a particular interrupt is currently pending.
316 *
317 * @param soc_proxy A soc_proxy handle.
318 * @param irq An interrupt request.
319 * @param[out] is_pending Out-param for whether the interrupt is pending.
320 * @return The result of the operation.
321 */
324 const dif_soc_proxy_t *soc_proxy,
325 dif_soc_proxy_irq_t,
326 bool *is_pending);
327
328 /**
329 * Acknowledges all interrupts that were pending at the time of the state
330 * snapshot.
331 *
332 * @param soc_proxy A soc_proxy handle.
333 * @param snapshot Interrupt state snapshot.
334 * @return The result of the operation.
335 */
338 const dif_soc_proxy_t *soc_proxy,
340
341 /**
342 * Acknowledges all interrupts, indicating to the hardware that all
343 * interrupts have been successfully serviced.
344 *
345 * @param soc_proxy A soc_proxy handle.
346 * @return The result of the operation.
347 */
350 const dif_soc_proxy_t *soc_proxy
351 );
352
353 /**
354 * Acknowledges a particular interrupt, indicating to the hardware that it has
355 * been successfully serviced.
356 *
357 * @param soc_proxy A soc_proxy handle.
358 * @param irq An interrupt request.
359 * @return The result of the operation.
360 */
363 const dif_soc_proxy_t *soc_proxy,
364 dif_soc_proxy_irq_t);
365
366 /**
367 * Forces a particular interrupt, causing it to be serviced as if hardware had
368 * asserted it.
369 *
370 * @param soc_proxy A soc_proxy handle.
371 * @param irq An interrupt request.
372 * @param val Value to be set.
373 * @return The result of the operation.
374 */
377 const dif_soc_proxy_t *soc_proxy,
378 dif_soc_proxy_irq_t,
379 const bool val);
380
381 /**
382 * A snapshot of the enablement state of the interrupts for this IP.
383 *
384 * This is an opaque type, to be used with the
385 * `dif_soc_proxy_irq_disable_all()` and `dif_soc_proxy_irq_restore_all()`
386 * functions.
387 */
389
390 /**
391 * Checks whether a particular interrupt is currently enabled or disabled.
392 *
393 * @param soc_proxy A soc_proxy handle.
394 * @param irq An interrupt request.
395 * @param[out] state Out-param toggle state of the interrupt.
396 * @return The result of the operation.
397 */
400 const dif_soc_proxy_t *soc_proxy,
401 dif_soc_proxy_irq_t,
402 dif_toggle_t *state);
403
404 /**
405 * Sets whether a particular interrupt is currently enabled or disabled.
406 *
407 * @param soc_proxy A soc_proxy handle.
408 * @param irq An interrupt request.
409 * @param state The new toggle state for the interrupt.
410 * @return The result of the operation.
411 */
414 const dif_soc_proxy_t *soc_proxy,
415 dif_soc_proxy_irq_t,
416 dif_toggle_t state);
417
418 /**
419 * Disables all interrupts, optionally snapshotting all enable states for later
420 * restoration.
421 *
422 * @param soc_proxy A soc_proxy handle.
423 * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
424 * @return The result of the operation.
425 */
428 const dif_soc_proxy_t *soc_proxy,
430
431 /**
432 * Restores interrupts from the given (enable) snapshot.
433 *
434 * @param soc_proxy A soc_proxy handle.
435 * @param snapshot A snapshot to restore from.
436 * @return The result of the operation.
437 */
440 const dif_soc_proxy_t *soc_proxy,
442
443
444#ifdef __cplusplus
445} // extern "C"
446#endif // __cplusplus
447
448#endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SOC_PROXY_AUTOGEN_H_