Software APIs
dif_ac_range_check_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_AC_RANGE_CHECK_AUTOGEN_H_
8#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AC_RANGE_CHECK_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/ac_range_check/data/ac_range_check.hjson
13// -o
14// bazel-out/k8-fastbuild-ST-ae23cdef058d/bin/sw/device/lib/dif/autogen
15
16
17/**
18 * @file
19 * @brief <a href="/book/hw/ip/ac_range_check/">AC_RANGE_CHECK</a> Device Interface Functions
20 */
21
22#include <stdbool.h>
23#include <stdint.h>
24
28#include "dt/dt_ac_range_check.h" // Generated.
29
30#ifdef __cplusplus
31extern "C" {
32#endif // __cplusplus
33
34/**
35 * A handle to ac_range_check.
36 *
37 * This type should be treated as opaque by users.
38 */
39typedef struct dif_ac_range_check {
40 /**
41 * The base address for the ac_range_check hardware registers.
42 */
44 /**
45 * The instance, set to `kDtAcRangeCheckCount` if not initialized
46 * through `dif_ac_range_check_init_from_dt`.
47 */
50
51/**
52 * Creates a new handle for a(n) ac_range_check peripheral.
53 *
54 * This function does not actuate the hardware.
55 *
56 * @param base_addr The MMIO base address of the ac_range_check peripheral.
57 * @param[out] ac_range_check Out param for the initialized handle.
58 * @return The result of the operation.
59 *
60 * DEPRECATED This function exists solely for the transition to
61 * dt-based DIFs and will be removed in the future.
62 */
65 mmio_region_t base_addr,
66 dif_ac_range_check_t *ac_range_check);
67
68/**
69 * Creates a new handle for a(n) ac_range_check peripheral.
70 *
71 * This function does not actuate the hardware.
72 *
73 * @param dt The devicetable description of the device.
74 * @param[out] ac_range_check Out param for the initialized handle.
75 * @return The result of the operation.
76 */
80 dif_ac_range_check_t *ac_range_check);
81
82/**
83 * Get the DT handle from this DIF.
84 *
85 * If this DIF was initialized by `dif_ac_range_check_init_from_dt(dt, ..)`
86 * then this function will return `dt`. Otherwise it will return an error.
87 *
88 * @param ac_range_check A ac_range_check handle.
89 * @param[out] dt DT handle.
90 * @return `kDifBadArg` if the DIF has no DT information, `kDifOk` otherwise.
91 */
94 const dif_ac_range_check_t *ac_range_check,
96
97 /**
98 * A ac_range_check alert type.
99 */
101 /**
102 * This recoverable alert is triggered upon detecting an update error in the shadowed Control Register.
103 */
105 /**
106 * This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected or the internal counter has an error.
107 */
110
111 /**
112 * Forces a particular alert, causing it to be escalated as if the hardware
113 * had raised it.
114 *
115 * @param ac_range_check A ac_range_check handle.
116 * @param alert The alert to force.
117 * @return The result of the operation.
118 */
121 const dif_ac_range_check_t *ac_range_check,
123
124 // DEPRECATED This typedef exists solely for the transition to
125 // dt-based interrupt numbers and will be removed in the future.
126 typedef dt_ac_range_check_irq_t dif_ac_range_check_irq_t;
127
128 /**
129 * A ac_range_check interrupt request type.
130 *
131 * DEPRECATED Use `dt_ac_range_check_irq_t` instead.
132 * This enumeration exists solely for the transition to
133 * dt-based interrupt numbers and will be removed in the future.
134 *
135 * The following are defines to keep the types consistent with DT.
136 */
137 /**
138 * Deny counter has reached threshold.
139 */
140#define kDifAcRangeCheckIrqDenyCntReached kDtAcRangeCheckIrqDenyCntReached
141
142 /**
143 * A snapshot of the state of the interrupts for this IP.
144 *
145 * This is an opaque type, to be used with the `dif_ac_range_check_irq_get_state()`
146 * and `dif_ac_range_check_irq_acknowledge_state()` functions.
147 */
149
150 /**
151 * Returns the type of a given interrupt (i.e., event or status) for this IP.
152 *
153 * @param ac_range_check A ac_range_check handle.
154 * @param irq An interrupt request.
155 * @param[out] type Out-param for the interrupt type.
156 * @return The result of the operation.
157 */
160 const dif_ac_range_check_t *ac_range_check,
161 dif_ac_range_check_irq_t,
162 dif_irq_type_t *type);
163
164 /**
165 * Returns the state of all interrupts (i.e., pending or not) for this IP.
166 *
167 * @param ac_range_check A ac_range_check handle.
168 * @param[out] snapshot Out-param for interrupt state snapshot.
169 * @return The result of the operation.
170 */
173 const dif_ac_range_check_t *ac_range_check,
175
176 /**
177 * Returns whether a particular interrupt is currently pending.
178 *
179 * @param ac_range_check A ac_range_check handle.
180 * @param irq An interrupt request.
181 * @param[out] is_pending Out-param for whether the interrupt is pending.
182 * @return The result of the operation.
183 */
186 const dif_ac_range_check_t *ac_range_check,
187 dif_ac_range_check_irq_t,
188 bool *is_pending);
189
190 /**
191 * Acknowledges all interrupts that were pending at the time of the state
192 * snapshot.
193 *
194 * @param ac_range_check A ac_range_check handle.
195 * @param snapshot Interrupt state snapshot.
196 * @return The result of the operation.
197 */
200 const dif_ac_range_check_t *ac_range_check,
202
203 /**
204 * Acknowledges all interrupts, indicating to the hardware that all
205 * interrupts have been successfully serviced.
206 *
207 * @param ac_range_check A ac_range_check handle.
208 * @return The result of the operation.
209 */
212 const dif_ac_range_check_t *ac_range_check
213 );
214
215 /**
216 * Acknowledges a particular interrupt, indicating to the hardware that it has
217 * been successfully serviced.
218 *
219 * @param ac_range_check A ac_range_check handle.
220 * @param irq An interrupt request.
221 * @return The result of the operation.
222 */
225 const dif_ac_range_check_t *ac_range_check,
226 dif_ac_range_check_irq_t);
227
228 /**
229 * Forces a particular interrupt, causing it to be serviced as if hardware had
230 * asserted it.
231 *
232 * @param ac_range_check A ac_range_check handle.
233 * @param irq An interrupt request.
234 * @param val Value to be set.
235 * @return The result of the operation.
236 */
239 const dif_ac_range_check_t *ac_range_check,
240 dif_ac_range_check_irq_t,
241 const bool val);
242
243 /**
244 * A snapshot of the enablement state of the interrupts for this IP.
245 *
246 * This is an opaque type, to be used with the
247 * `dif_ac_range_check_irq_disable_all()` and `dif_ac_range_check_irq_restore_all()`
248 * functions.
249 */
251
252 /**
253 * Checks whether a particular interrupt is currently enabled or disabled.
254 *
255 * @param ac_range_check A ac_range_check handle.
256 * @param irq An interrupt request.
257 * @param[out] state Out-param toggle state of the interrupt.
258 * @return The result of the operation.
259 */
262 const dif_ac_range_check_t *ac_range_check,
263 dif_ac_range_check_irq_t,
264 dif_toggle_t *state);
265
266 /**
267 * Sets whether a particular interrupt is currently enabled or disabled.
268 *
269 * @param ac_range_check A ac_range_check handle.
270 * @param irq An interrupt request.
271 * @param state The new toggle state for the interrupt.
272 * @return The result of the operation.
273 */
276 const dif_ac_range_check_t *ac_range_check,
277 dif_ac_range_check_irq_t,
278 dif_toggle_t state);
279
280 /**
281 * Disables all interrupts, optionally snapshotting all enable states for later
282 * restoration.
283 *
284 * @param ac_range_check A ac_range_check handle.
285 * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
286 * @return The result of the operation.
287 */
290 const dif_ac_range_check_t *ac_range_check,
292
293 /**
294 * Restores interrupts from the given (enable) snapshot.
295 *
296 * @param ac_range_check A ac_range_check handle.
297 * @param snapshot A snapshot to restore from.
298 * @return The result of the operation.
299 */
302 const dif_ac_range_check_t *ac_range_check,
304
305
306#ifdef __cplusplus
307} // extern "C"
308#endif // __cplusplus
309
310#endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AC_RANGE_CHECK_AUTOGEN_H_