Software APIs
dif_keymgr_dpe_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_KEYMGR_DPE_AUTOGEN_H_
6 #define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_KEYMGR_DPE_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/keymgr_dpe/">KEYMGR_DPE</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 keymgr_dpe.
30  *
31  * This type should be treated as opaque by users.
32  */
33 typedef struct dif_keymgr_dpe {
34  /**
35  * The base address for the keymgr_dpe hardware registers.
36  */
39 
40 /**
41  * Creates a new handle for a(n) keymgr_dpe peripheral.
42  *
43  * This function does not actuate the hardware.
44  *
45  * @param base_addr The MMIO base address of the keymgr_dpe peripheral.
46  * @param[out] keymgr_dpe Out param for the initialized handle.
47  * @return The result of the operation.
48  */
51  dif_keymgr_dpe_t *keymgr_dpe);
52 
53 /**
54  * A keymgr_dpe alert type.
55  */
56 typedef enum dif_keymgr_dpe_alert {
57  /**
58  * Alert for key manager operation errors. These errors could have been
59  * caused by software
60  */
62  /**
63  * Alert for key manager faults. These errors cannot be caused by software
64  */
67 
68 /**
69  * Forces a particular alert, causing it to be escalated as if the hardware
70  * had raised it.
71  *
72  * @param keymgr_dpe A keymgr_dpe handle.
73  * @param alert The alert to force.
74  * @return The result of the operation.
75  */
79 
80 /**
81  * A keymgr_dpe interrupt request type.
82  */
83 typedef enum dif_keymgr_dpe_irq {
84  /**
85  * Operation complete
86  */
89 
90 /**
91  * A snapshot of the state of the interrupts for this IP.
92  *
93  * This is an opaque type, to be used with the `dif_keymgr_dpe_irq_get_state()`
94  * and `dif_keymgr_dpe_irq_acknowledge_state()` functions.
95  */
97 
98 /**
99  * Returns the type of a given interrupt (i.e., event or status) for this IP.
100  *
101  * @param keymgr_dpe A keymgr_dpe handle.
102  * @param irq An interrupt request.
103  * @param[out] type Out-param for the interrupt type.
104  * @return The result of the operation.
105  */
109  dif_irq_type_t *type);
110 
111 /**
112  * Returns the state of all interrupts (i.e., pending or not) for this IP.
113  *
114  * @param keymgr_dpe A keymgr_dpe handle.
115  * @param[out] snapshot Out-param for interrupt state snapshot.
116  * @return The result of the operation.
117  */
120  const dif_keymgr_dpe_t *keymgr_dpe,
122 
123 /**
124  * Returns whether a particular interrupt is currently pending.
125  *
126  * @param keymgr_dpe A keymgr_dpe handle.
127  * @param irq An interrupt request.
128  * @param[out] is_pending Out-param for whether the interrupt is pending.
129  * @return The result of the operation.
130  */
134  bool *is_pending);
135 
136 /**
137  * Acknowledges all interrupts that were pending at the time of the state
138  * snapshot.
139  *
140  * @param keymgr_dpe A keymgr_dpe handle.
141  * @param snapshot Interrupt state snapshot.
142  * @return The result of the operation.
143  */
146  const dif_keymgr_dpe_t *keymgr_dpe,
148 
149 /**
150  * Acknowledges all interrupts, indicating to the hardware that all
151  * interrupts have been successfully serviced.
152  *
153  * @param keymgr_dpe A keymgr_dpe handle.
154  * @return The result of the operation.
155  */
158  const dif_keymgr_dpe_t *keymgr_dpe);
159 
160 /**
161  * Acknowledges a particular interrupt, indicating to the hardware that it has
162  * been successfully serviced.
163  *
164  * @param keymgr_dpe A keymgr_dpe handle.
165  * @param irq An interrupt request.
166  * @return The result of the operation.
167  */
171 
172 /**
173  * Forces a particular interrupt, causing it to be serviced as if hardware had
174  * asserted it.
175  *
176  * @param keymgr_dpe A keymgr_dpe handle.
177  * @param irq An interrupt request.
178  * @param val Value to be set.
179  * @return The result of the operation.
180  */
183  dif_keymgr_dpe_irq_t irq, const bool val);
184 
185 /**
186  * A snapshot of the enablement state of the interrupts for this IP.
187  *
188  * This is an opaque type, to be used with the
189  * `dif_keymgr_dpe_irq_disable_all()` and `dif_keymgr_dpe_irq_restore_all()`
190  * functions.
191  */
193 
194 /**
195  * Checks whether a particular interrupt is currently enabled or disabled.
196  *
197  * @param keymgr_dpe A keymgr_dpe handle.
198  * @param irq An interrupt request.
199  * @param[out] state Out-param toggle state of the interrupt.
200  * @return The result of the operation.
201  */
205  dif_toggle_t *state);
206 
207 /**
208  * Sets whether a particular interrupt is currently enabled or disabled.
209  *
210  * @param keymgr_dpe A keymgr_dpe handle.
211  * @param irq An interrupt request.
212  * @param state The new toggle state for the interrupt.
213  * @return The result of the operation.
214  */
218  dif_toggle_t state);
219 
220 /**
221  * Disables all interrupts, optionally snapshotting all enable states for later
222  * restoration.
223  *
224  * @param keymgr_dpe A keymgr_dpe handle.
225  * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
226  * @return The result of the operation.
227  */
230  const dif_keymgr_dpe_t *keymgr_dpe,
232 
233 /**
234  * Restores interrupts from the given (enable) snapshot.
235  *
236  * @param keymgr_dpe A keymgr_dpe handle.
237  * @param snapshot A snapshot to restore from.
238  * @return The result of the operation.
239  */
242  const dif_keymgr_dpe_t *keymgr_dpe,
243  const dif_keymgr_dpe_irq_enable_snapshot_t *snapshot);
244 
245 #ifdef __cplusplus
246 } // extern "C"
247 #endif // __cplusplus
248 
249 #endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_KEYMGR_DPE_AUTOGEN_H_