Software APIs
dif_racl_ctrl_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_RACL_CTRL_AUTOGEN_H_
8#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_RACL_CTRL_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_autogen/racl_ctrl/data/racl_ctrl.hjson -o
13// bazel-out/k8-fastbuild-ST-ae23cdef058d/bin/sw/device/lib/dif/autogen
14
15
16/**
17 * @file
18 * @brief <a href="/book/hw/ip/racl_ctrl/">RACL_CTRL</a> Device Interface Functions
19 */
20
21#include <stdbool.h>
22#include <stdint.h>
23
27#include "dt/dt_racl_ctrl.h" // Generated.
28
29#ifdef __cplusplus
30extern "C" {
31#endif // __cplusplus
32
33/**
34 * A handle to racl_ctrl.
35 *
36 * This type should be treated as opaque by users.
37 */
38typedef struct dif_racl_ctrl {
39 /**
40 * The base address for the racl_ctrl hardware registers.
41 */
43 /**
44 * The instance, set to `kDtRaclCtrlCount` if not initialized
45 * through `dif_racl_ctrl_init_from_dt`.
46 */
49
50/**
51 * Creates a new handle for a(n) racl_ctrl peripheral.
52 *
53 * This function does not actuate the hardware.
54 *
55 * @param base_addr The MMIO base address of the racl_ctrl peripheral.
56 * @param[out] racl_ctrl 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_racl_ctrl_t *racl_ctrl);
66
67/**
68 * Creates a new handle for a(n) racl_ctrl peripheral.
69 *
70 * This function does not actuate the hardware.
71 *
72 * @param dt The devicetable description of the device.
73 * @param[out] racl_ctrl Out param for the initialized handle.
74 * @return The result of the operation.
75 */
79 dif_racl_ctrl_t *racl_ctrl);
80
81/**
82 * Get the DT handle from this DIF.
83 *
84 * If this DIF was initialized by `dif_racl_ctrl_init_from_dt(dt, ..)`
85 * then this function will return `dt`. Otherwise it will return an error.
86 *
87 * @param racl_ctrl A racl_ctrl handle.
88 * @param[out] dt DT handle.
89 * @return `kDifBadArg` if the DIF has no DT information, `kDifOk` otherwise.
90 */
93 const dif_racl_ctrl_t *racl_ctrl,
94 dt_racl_ctrl_t *dt);
95
96 /**
97 * A racl_ctrl alert type.
98 */
99 typedef enum dif_racl_ctrl_alert {
100 /**
101 * This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
102 */
104 /**
105 * This recoverable alert is triggered upon detecting an update error in the shadowed Control Register.
106 */
109
110 /**
111 * Forces a particular alert, causing it to be escalated as if the hardware
112 * had raised it.
113 *
114 * @param racl_ctrl A racl_ctrl handle.
115 * @param alert The alert to force.
116 * @return The result of the operation.
117 */
120 const dif_racl_ctrl_t *racl_ctrl,
122
123 // DEPRECATED This typedef exists solely for the transition to
124 // dt-based interrupt numbers and will be removed in the future.
125 typedef dt_racl_ctrl_irq_t dif_racl_ctrl_irq_t;
126
127 /**
128 * A racl_ctrl interrupt request type.
129 *
130 * DEPRECATED Use `dt_racl_ctrl_irq_t` instead.
131 * This enumeration exists solely for the transition to
132 * dt-based interrupt numbers and will be removed in the future.
133 *
134 * The following are defines to keep the types consistent with DT.
135 */
136 /**
137 * RACL error has occurred.
138 */
139#define kDifRaclCtrlIrqRaclError kDtRaclCtrlIrqRaclError
140
141 /**
142 * A snapshot of the state of the interrupts for this IP.
143 *
144 * This is an opaque type, to be used with the `dif_racl_ctrl_irq_get_state()`
145 * and `dif_racl_ctrl_irq_acknowledge_state()` functions.
146 */
148
149 /**
150 * Returns the type of a given interrupt (i.e., event or status) for this IP.
151 *
152 * @param racl_ctrl A racl_ctrl handle.
153 * @param irq An interrupt request.
154 * @param[out] type Out-param for the interrupt type.
155 * @return The result of the operation.
156 */
159 const dif_racl_ctrl_t *racl_ctrl,
160 dif_racl_ctrl_irq_t,
161 dif_irq_type_t *type);
162
163 /**
164 * Returns the state of all interrupts (i.e., pending or not) for this IP.
165 *
166 * @param racl_ctrl A racl_ctrl handle.
167 * @param[out] snapshot Out-param for interrupt state snapshot.
168 * @return The result of the operation.
169 */
172 const dif_racl_ctrl_t *racl_ctrl,
174
175 /**
176 * Returns whether a particular interrupt is currently pending.
177 *
178 * @param racl_ctrl A racl_ctrl handle.
179 * @param irq An interrupt request.
180 * @param[out] is_pending Out-param for whether the interrupt is pending.
181 * @return The result of the operation.
182 */
185 const dif_racl_ctrl_t *racl_ctrl,
186 dif_racl_ctrl_irq_t,
187 bool *is_pending);
188
189 /**
190 * Acknowledges all interrupts that were pending at the time of the state
191 * snapshot.
192 *
193 * @param racl_ctrl A racl_ctrl handle.
194 * @param snapshot Interrupt state snapshot.
195 * @return The result of the operation.
196 */
199 const dif_racl_ctrl_t *racl_ctrl,
201
202 /**
203 * Acknowledges all interrupts, indicating to the hardware that all
204 * interrupts have been successfully serviced.
205 *
206 * @param racl_ctrl A racl_ctrl handle.
207 * @return The result of the operation.
208 */
211 const dif_racl_ctrl_t *racl_ctrl
212 );
213
214 /**
215 * Acknowledges a particular interrupt, indicating to the hardware that it has
216 * been successfully serviced.
217 *
218 * @param racl_ctrl A racl_ctrl handle.
219 * @param irq An interrupt request.
220 * @return The result of the operation.
221 */
224 const dif_racl_ctrl_t *racl_ctrl,
225 dif_racl_ctrl_irq_t);
226
227 /**
228 * Forces a particular interrupt, causing it to be serviced as if hardware had
229 * asserted it.
230 *
231 * @param racl_ctrl A racl_ctrl handle.
232 * @param irq An interrupt request.
233 * @param val Value to be set.
234 * @return The result of the operation.
235 */
238 const dif_racl_ctrl_t *racl_ctrl,
239 dif_racl_ctrl_irq_t,
240 const bool val);
241
242 /**
243 * A snapshot of the enablement state of the interrupts for this IP.
244 *
245 * This is an opaque type, to be used with the
246 * `dif_racl_ctrl_irq_disable_all()` and `dif_racl_ctrl_irq_restore_all()`
247 * functions.
248 */
250
251 /**
252 * Checks whether a particular interrupt is currently enabled or disabled.
253 *
254 * @param racl_ctrl A racl_ctrl handle.
255 * @param irq An interrupt request.
256 * @param[out] state Out-param toggle state of the interrupt.
257 * @return The result of the operation.
258 */
261 const dif_racl_ctrl_t *racl_ctrl,
262 dif_racl_ctrl_irq_t,
263 dif_toggle_t *state);
264
265 /**
266 * Sets whether a particular interrupt is currently enabled or disabled.
267 *
268 * @param racl_ctrl A racl_ctrl handle.
269 * @param irq An interrupt request.
270 * @param state The new toggle state for the interrupt.
271 * @return The result of the operation.
272 */
275 const dif_racl_ctrl_t *racl_ctrl,
276 dif_racl_ctrl_irq_t,
277 dif_toggle_t state);
278
279 /**
280 * Disables all interrupts, optionally snapshotting all enable states for later
281 * restoration.
282 *
283 * @param racl_ctrl A racl_ctrl handle.
284 * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
285 * @return The result of the operation.
286 */
289 const dif_racl_ctrl_t *racl_ctrl,
291
292 /**
293 * Restores interrupts from the given (enable) snapshot.
294 *
295 * @param racl_ctrl A racl_ctrl handle.
296 * @param snapshot A snapshot to restore from.
297 * @return The result of the operation.
298 */
301 const dif_racl_ctrl_t *racl_ctrl,
303
304
305#ifdef __cplusplus
306} // extern "C"
307#endif // __cplusplus
308
309#endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_RACL_CTRL_AUTOGEN_H_