Software APIs
dif_alert_handler_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_ALERT_HANDLER_AUTOGEN_H_
6 #define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_ALERT_HANDLER_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/alert_handler/">ALERT_HANDLER</a> Device
14  * Interface 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 alert_handler.
30  *
31  * This type should be treated as opaque by users.
32  */
33 typedef struct dif_alert_handler {
34  /**
35  * The base address for the alert_handler hardware registers.
36  */
39 
40 /**
41  * Creates a new handle for a(n) alert_handler peripheral.
42  *
43  * This function does not actuate the hardware.
44  *
45  * @param base_addr The MMIO base address of the alert_handler peripheral.
46  * @param[out] alert_handler Out param for the initialized handle.
47  * @return The result of the operation.
48  */
51  dif_alert_handler_t *alert_handler);
52 
53 /**
54  * A alert_handler interrupt request type.
55  */
56 typedef enum dif_alert_handler_irq {
57  /**
58  * Interrupt state bit of Class A. Set by HW in case an alert within this
59  * class triggered. Defaults true, write one to clear.
60  */
62  /**
63  * Interrupt state bit of Class B. Set by HW in case an alert within this
64  * class triggered. Defaults true, write one to clear.
65  */
67  /**
68  * Interrupt state bit of Class C. Set by HW in case an alert within this
69  * class triggered. Defaults true, write one to clear.
70  */
72  /**
73  * Interrupt state bit of Class D. Set by HW in case an alert within this
74  * class triggered. Defaults true, write one to clear.
75  */
78 
79 /**
80  * A snapshot of the state of the interrupts for this IP.
81  *
82  * This is an opaque type, to be used with the
83  * `dif_alert_handler_irq_get_state()` and
84  * `dif_alert_handler_irq_acknowledge_state()` functions.
85  */
87 
88 /**
89  * Returns the type of a given interrupt (i.e., event or status) for this IP.
90  *
91  * @param alert_handler A alert_handler handle.
92  * @param irq An interrupt request.
93  * @param[out] type Out-param for the interrupt type.
94  * @return The result of the operation.
95  */
98  const dif_alert_handler_t *alert_handler, dif_alert_handler_irq_t irq,
99  dif_irq_type_t *type);
100 
101 /**
102  * Returns the state of all interrupts (i.e., pending or not) for this IP.
103  *
104  * @param alert_handler A alert_handler handle.
105  * @param[out] snapshot Out-param for interrupt state snapshot.
106  * @return The result of the operation.
107  */
110  const dif_alert_handler_t *alert_handler,
112 
113 /**
114  * Returns whether a particular interrupt is currently pending.
115  *
116  * @param alert_handler A alert_handler handle.
117  * @param irq An interrupt request.
118  * @param[out] is_pending Out-param for whether the interrupt is pending.
119  * @return The result of the operation.
120  */
123  const dif_alert_handler_t *alert_handler, dif_alert_handler_irq_t irq,
124  bool *is_pending);
125 
126 /**
127  * Acknowledges all interrupts that were pending at the time of the state
128  * snapshot.
129  *
130  * @param alert_handler A alert_handler handle.
131  * @param snapshot Interrupt state snapshot.
132  * @return The result of the operation.
133  */
136  const dif_alert_handler_t *alert_handler,
138 
139 /**
140  * Acknowledges all interrupts, indicating to the hardware that all
141  * interrupts have been successfully serviced.
142  *
143  * @param alert_handler A alert_handler handle.
144  * @return The result of the operation.
145  */
148  const dif_alert_handler_t *alert_handler);
149 
150 /**
151  * Acknowledges a particular interrupt, indicating to the hardware that it has
152  * been successfully serviced.
153  *
154  * @param alert_handler A alert_handler handle.
155  * @param irq An interrupt request.
156  * @return The result of the operation.
157  */
160  const dif_alert_handler_t *alert_handler, dif_alert_handler_irq_t irq);
161 
162 /**
163  * Forces a particular interrupt, causing it to be serviced as if hardware had
164  * asserted it.
165  *
166  * @param alert_handler A alert_handler handle.
167  * @param irq An interrupt request.
168  * @param val Value to be set.
169  * @return The result of the operation.
170  */
173  const dif_alert_handler_t *alert_handler, dif_alert_handler_irq_t irq,
174  const bool val);
175 
176 /**
177  * A snapshot of the enablement state of the interrupts for this IP.
178  *
179  * This is an opaque type, to be used with the
180  * `dif_alert_handler_irq_disable_all()` and
181  * `dif_alert_handler_irq_restore_all()` functions.
182  */
184 
185 /**
186  * Checks whether a particular interrupt is currently enabled or disabled.
187  *
188  * @param alert_handler A alert_handler handle.
189  * @param irq An interrupt request.
190  * @param[out] state Out-param toggle state of the interrupt.
191  * @return The result of the operation.
192  */
195  const dif_alert_handler_t *alert_handler, dif_alert_handler_irq_t irq,
196  dif_toggle_t *state);
197 
198 /**
199  * Sets whether a particular interrupt is currently enabled or disabled.
200  *
201  * @param alert_handler A alert_handler handle.
202  * @param irq An interrupt request.
203  * @param state The new toggle state for the interrupt.
204  * @return The result of the operation.
205  */
208  const dif_alert_handler_t *alert_handler, dif_alert_handler_irq_t irq,
209  dif_toggle_t state);
210 
211 /**
212  * Disables all interrupts, optionally snapshotting all enable states for later
213  * restoration.
214  *
215  * @param alert_handler A alert_handler handle.
216  * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
217  * @return The result of the operation.
218  */
221  const dif_alert_handler_t *alert_handler,
223 
224 /**
225  * Restores interrupts from the given (enable) snapshot.
226  *
227  * @param alert_handler A alert_handler handle.
228  * @param snapshot A snapshot to restore from.
229  * @return The result of the operation.
230  */
233  const dif_alert_handler_t *alert_handler,
235 
236 #ifdef __cplusplus
237 } // extern "C"
238 #endif // __cplusplus
239 
240 #endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_ALERT_HANDLER_AUTOGEN_H_