Software APIs
dif_adc_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_ADC_CTRL_AUTOGEN_H_
6 #define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_ADC_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/adc_ctrl/">ADC_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 adc_ctrl.
30  *
31  * This type should be treated as opaque by users.
32  */
33 typedef struct dif_adc_ctrl {
34  /**
35  * The base address for the adc_ctrl hardware registers.
36  */
39 
40 /**
41  * Creates a new handle for a(n) adc_ctrl peripheral.
42  *
43  * This function does not actuate the hardware.
44  *
45  * @param base_addr The MMIO base address of the adc_ctrl peripheral.
46  * @param[out] adc_ctrl Out param for the initialized handle.
47  * @return The result of the operation.
48  */
51  dif_adc_ctrl_t *adc_ctrl);
52 
53 /**
54  * A adc_ctrl alert type.
55  */
56 typedef enum dif_adc_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 adc_ctrl A adc_ctrl handle.
69  * @param alert The alert to force.
70  * @return The result of the operation.
71  */
74  dif_adc_ctrl_alert_t alert);
75 
76 /**
77  * A adc_ctrl interrupt request type.
78  */
79 typedef enum dif_adc_ctrl_irq {
80  /**
81  * ADC match or measurement event has occurred
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_adc_ctrl_irq_get_state()`
90  * and `dif_adc_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 adc_ctrl A adc_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  */
104  dif_adc_ctrl_irq_t irq,
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 adc_ctrl A adc_ctrl handle.
111  * @param[out] snapshot Out-param for interrupt state snapshot.
112  * @return The result of the operation.
113  */
116  const dif_adc_ctrl_t *adc_ctrl,
118 
119 /**
120  * Returns whether a particular interrupt is currently pending.
121  *
122  * @param adc_ctrl A adc_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  dif_adc_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 adc_ctrl A adc_ctrl handle.
137  * @param snapshot Interrupt state snapshot.
138  * @return The result of the operation.
139  */
142  const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_irq_state_snapshot_t snapshot);
143 
144 /**
145  * Acknowledges all interrupts, indicating to the hardware that all
146  * interrupts have been successfully serviced.
147  *
148  * @param adc_ctrl A adc_ctrl handle.
149  * @return The result of the operation.
150  */
153 
154 /**
155  * Acknowledges a particular interrupt, indicating to the hardware that it has
156  * been successfully serviced.
157  *
158  * @param adc_ctrl A adc_ctrl handle.
159  * @param irq An interrupt request.
160  * @return The result of the operation.
161  */
164  dif_adc_ctrl_irq_t irq);
165 
166 /**
167  * Forces a particular interrupt, causing it to be serviced as if hardware had
168  * asserted it.
169  *
170  * @param adc_ctrl A adc_ctrl handle.
171  * @param irq An interrupt request.
172  * @param val Value to be set.
173  * @return The result of the operation.
174  */
177  dif_adc_ctrl_irq_t irq, const bool val);
178 
179 /**
180  * A snapshot of the enablement state of the interrupts for this IP.
181  *
182  * This is an opaque type, to be used with the
183  * `dif_adc_ctrl_irq_disable_all()` and `dif_adc_ctrl_irq_restore_all()`
184  * functions.
185  */
187 
188 /**
189  * Checks whether a particular interrupt is currently enabled or disabled.
190  *
191  * @param adc_ctrl A adc_ctrl handle.
192  * @param irq An interrupt request.
193  * @param[out] state Out-param toggle state of the interrupt.
194  * @return The result of the operation.
195  */
198  dif_adc_ctrl_irq_t irq,
199  dif_toggle_t *state);
200 
201 /**
202  * Sets whether a particular interrupt is currently enabled or disabled.
203  *
204  * @param adc_ctrl A adc_ctrl handle.
205  * @param irq An interrupt request.
206  * @param state The new toggle state for the interrupt.
207  * @return The result of the operation.
208  */
211  dif_adc_ctrl_irq_t irq,
212  dif_toggle_t state);
213 
214 /**
215  * Disables all interrupts, optionally snapshotting all enable states for later
216  * restoration.
217  *
218  * @param adc_ctrl A adc_ctrl handle.
219  * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
220  * @return The result of the operation.
221  */
224  const dif_adc_ctrl_t *adc_ctrl,
226 
227 /**
228  * Restores interrupts from the given (enable) snapshot.
229  *
230  * @param adc_ctrl A adc_ctrl handle.
231  * @param snapshot A snapshot to restore from.
232  * @return The result of the operation.
233  */
236  const dif_adc_ctrl_t *adc_ctrl,
237  const dif_adc_ctrl_irq_enable_snapshot_t *snapshot);
238 
239 #ifdef __cplusplus
240 } // extern "C"
241 #endif // __cplusplus
242 
243 #endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_ADC_CTRL_AUTOGEN_H_