Software APIs
dif_sysrst_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 #ifndef OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SYSRST_CTRL_AUTOGEN_H_
6 #define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SYSRST_CTRL_AUTOGEN_H_
7 
8 // THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
9 // util/make_new_dif.py --mode=regen --only=autogen
10 
11 /**
12  * @file
13  * @brief <a href="/book/hw/ip/sysrst_ctrl/">SYSRST_CTRL</a> Device Interface
14  * Functions
15  */
16 
17 #include <stdbool.h>
18 #include <stdint.h>
19 
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif // __cplusplus
27 
28 /**
29  * A handle to sysrst_ctrl.
30  *
31  * This type should be treated as opaque by users.
32  */
33 typedef struct dif_sysrst_ctrl {
34  /**
35  * The base address for the sysrst_ctrl hardware registers.
36  */
39 
40 /**
41  * Creates a new handle for a(n) sysrst_ctrl peripheral.
42  *
43  * This function does not actuate the hardware.
44  *
45  * @param base_addr The MMIO base address of the sysrst_ctrl peripheral.
46  * @param[out] sysrst_ctrl Out param for the initialized handle.
47  * @return The result of the operation.
48  */
51  dif_sysrst_ctrl_t *sysrst_ctrl);
52 
53 /**
54  * A sysrst_ctrl alert type.
55  */
56 typedef enum dif_sysrst_ctrl_alert {
57  /**
58  * This fatal alert is triggered when a fatal TL-UL bus integrity fault is
59  * detected.
60  */
63 
64 /**
65  * Forces a particular alert, causing it to be escalated as if the hardware
66  * had raised it.
67  *
68  * @param sysrst_ctrl A sysrst_ctrl handle.
69  * @param alert The alert to force.
70  * @return The result of the operation.
71  */
75 
76 /**
77  * A sysrst_ctrl interrupt request type.
78  */
79 typedef enum dif_sysrst_ctrl_irq {
80  /**
81  * Common interrupt triggered by combo or keyboard events.
82  */
85 
86 /**
87  * A snapshot of the state of the interrupts for this IP.
88  *
89  * This is an opaque type, to be used with the `dif_sysrst_ctrl_irq_get_state()`
90  * and `dif_sysrst_ctrl_irq_acknowledge_state()` functions.
91  */
93 
94 /**
95  * Returns the type of a given interrupt (i.e., event or status) for this IP.
96  *
97  * @param sysrst_ctrl A sysrst_ctrl handle.
98  * @param irq An interrupt request.
99  * @param[out] type Out-param for the interrupt type.
100  * @return The result of the operation.
101  */
105  dif_irq_type_t *type);
106 
107 /**
108  * Returns the state of all interrupts (i.e., pending or not) for this IP.
109  *
110  * @param sysrst_ctrl A sysrst_ctrl handle.
111  * @param[out] snapshot Out-param for interrupt state snapshot.
112  * @return The result of the operation.
113  */
116  const dif_sysrst_ctrl_t *sysrst_ctrl,
118 
119 /**
120  * Returns whether a particular interrupt is currently pending.
121  *
122  * @param sysrst_ctrl A sysrst_ctrl handle.
123  * @param irq An interrupt request.
124  * @param[out] is_pending Out-param for whether the interrupt is pending.
125  * @return The result of the operation.
126  */
129  const dif_sysrst_ctrl_t *sysrst_ctrl, dif_sysrst_ctrl_irq_t irq,
130  bool *is_pending);
131 
132 /**
133  * Acknowledges all interrupts that were pending at the time of the state
134  * snapshot.
135  *
136  * @param sysrst_ctrl A sysrst_ctrl handle.
137  * @param snapshot Interrupt state snapshot.
138  * @return The result of the operation.
139  */
142  const dif_sysrst_ctrl_t *sysrst_ctrl,
144 
145 /**
146  * Acknowledges all interrupts, indicating to the hardware that all
147  * interrupts have been successfully serviced.
148  *
149  * @param sysrst_ctrl A sysrst_ctrl handle.
150  * @return The result of the operation.
151  */
154  const dif_sysrst_ctrl_t *sysrst_ctrl);
155 
156 /**
157  * Acknowledges a particular interrupt, indicating to the hardware that it has
158  * been successfully serviced.
159  *
160  * @param sysrst_ctrl A sysrst_ctrl handle.
161  * @param irq An interrupt request.
162  * @return The result of the operation.
163  */
166  const dif_sysrst_ctrl_t *sysrst_ctrl, dif_sysrst_ctrl_irq_t irq);
167 
168 /**
169  * Forces a particular interrupt, causing it to be serviced as if hardware had
170  * asserted it.
171  *
172  * @param sysrst_ctrl A sysrst_ctrl handle.
173  * @param irq An interrupt request.
174  * @param val Value to be set.
175  * @return The result of the operation.
176  */
180  const bool val);
181 
182 /**
183  * A snapshot of the enablement state of the interrupts for this IP.
184  *
185  * This is an opaque type, to be used with the
186  * `dif_sysrst_ctrl_irq_disable_all()` and `dif_sysrst_ctrl_irq_restore_all()`
187  * functions.
188  */
190 
191 /**
192  * Checks whether a particular interrupt is currently enabled or disabled.
193  *
194  * @param sysrst_ctrl A sysrst_ctrl handle.
195  * @param irq An interrupt request.
196  * @param[out] state Out-param toggle state of the interrupt.
197  * @return The result of the operation.
198  */
201  const dif_sysrst_ctrl_t *sysrst_ctrl, dif_sysrst_ctrl_irq_t irq,
202  dif_toggle_t *state);
203 
204 /**
205  * Sets whether a particular interrupt is currently enabled or disabled.
206  *
207  * @param sysrst_ctrl A sysrst_ctrl handle.
208  * @param irq An interrupt request.
209  * @param state The new toggle state for the interrupt.
210  * @return The result of the operation.
211  */
214  const dif_sysrst_ctrl_t *sysrst_ctrl, dif_sysrst_ctrl_irq_t irq,
215  dif_toggle_t state);
216 
217 /**
218  * Disables all interrupts, optionally snapshotting all enable states for later
219  * restoration.
220  *
221  * @param sysrst_ctrl A sysrst_ctrl handle.
222  * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
223  * @return The result of the operation.
224  */
227  const dif_sysrst_ctrl_t *sysrst_ctrl,
229 
230 /**
231  * Restores interrupts from the given (enable) snapshot.
232  *
233  * @param sysrst_ctrl A sysrst_ctrl handle.
234  * @param snapshot A snapshot to restore from.
235  * @return The result of the operation.
236  */
239  const dif_sysrst_ctrl_t *sysrst_ctrl,
240  const dif_sysrst_ctrl_irq_enable_snapshot_t *snapshot);
241 
242 #ifdef __cplusplus
243 } // extern "C"
244 #endif // __cplusplus
245 
246 #endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SYSRST_CTRL_AUTOGEN_H_