Software APIs
dif_sensor_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_SENSOR_CTRL_AUTOGEN_H_
6 #define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SENSOR_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/sensor_ctrl/">SENSOR_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 sensor_ctrl.
30  *
31  * This type should be treated as opaque by users.
32  */
33 typedef struct dif_sensor_ctrl {
34  /**
35  * The base address for the sensor_ctrl hardware registers.
36  */
39 
40 /**
41  * Creates a new handle for a(n) sensor_ctrl peripheral.
42  *
43  * This function does not actuate the hardware.
44  *
45  * @param base_addr The MMIO base address of the sensor_ctrl peripheral.
46  * @param[out] sensor_ctrl Out param for the initialized handle.
47  * @return The result of the operation.
48  */
51  dif_sensor_ctrl_t *sensor_ctrl);
52 
53 /**
54  * A sensor_ctrl alert type.
55  */
56 typedef enum dif_sensor_ctrl_alert {
57  /**
58  * Recoverable sensor_ctrl alerts
59  */
61  /**
62  * Fatal sensor_ctrl alerts
63  */
66 
67 /**
68  * Forces a particular alert, causing it to be escalated as if the hardware
69  * had raised it.
70  *
71  * @param sensor_ctrl A sensor_ctrl handle.
72  * @param alert The alert to force.
73  * @return The result of the operation.
74  */
78 
79 /**
80  * A sensor_ctrl interrupt request type.
81  */
82 typedef enum dif_sensor_ctrl_irq {
83  /**
84  * Io power status has changed
85  */
87  /**
88  * Ast init status has changed
89  */
92 
93 /**
94  * A snapshot of the state of the interrupts for this IP.
95  *
96  * This is an opaque type, to be used with the `dif_sensor_ctrl_irq_get_state()`
97  * and `dif_sensor_ctrl_irq_acknowledge_state()` functions.
98  */
100 
101 /**
102  * Returns the type of a given interrupt (i.e., event or status) for this IP.
103  *
104  * @param sensor_ctrl A sensor_ctrl handle.
105  * @param irq An interrupt request.
106  * @param[out] type Out-param for the interrupt type.
107  * @return The result of the operation.
108  */
112  dif_irq_type_t *type);
113 
114 /**
115  * Returns the state of all interrupts (i.e., pending or not) for this IP.
116  *
117  * @param sensor_ctrl A sensor_ctrl handle.
118  * @param[out] snapshot Out-param for interrupt state snapshot.
119  * @return The result of the operation.
120  */
123  const dif_sensor_ctrl_t *sensor_ctrl,
125 
126 /**
127  * Returns whether a particular interrupt is currently pending.
128  *
129  * @param sensor_ctrl A sensor_ctrl handle.
130  * @param irq An interrupt request.
131  * @param[out] is_pending Out-param for whether the interrupt is pending.
132  * @return The result of the operation.
133  */
136  const dif_sensor_ctrl_t *sensor_ctrl, dif_sensor_ctrl_irq_t irq,
137  bool *is_pending);
138 
139 /**
140  * Acknowledges all interrupts that were pending at the time of the state
141  * snapshot.
142  *
143  * @param sensor_ctrl A sensor_ctrl handle.
144  * @param snapshot Interrupt state snapshot.
145  * @return The result of the operation.
146  */
149  const dif_sensor_ctrl_t *sensor_ctrl,
151 
152 /**
153  * Acknowledges all interrupts, indicating to the hardware that all
154  * interrupts have been successfully serviced.
155  *
156  * @param sensor_ctrl A sensor_ctrl handle.
157  * @return The result of the operation.
158  */
161  const dif_sensor_ctrl_t *sensor_ctrl);
162 
163 /**
164  * Acknowledges a particular interrupt, indicating to the hardware that it has
165  * been successfully serviced.
166  *
167  * @param sensor_ctrl A sensor_ctrl handle.
168  * @param irq An interrupt request.
169  * @return The result of the operation.
170  */
173  const dif_sensor_ctrl_t *sensor_ctrl, dif_sensor_ctrl_irq_t irq);
174 
175 /**
176  * Forces a particular interrupt, causing it to be serviced as if hardware had
177  * asserted it.
178  *
179  * @param sensor_ctrl A sensor_ctrl handle.
180  * @param irq An interrupt request.
181  * @param val Value to be set.
182  * @return The result of the operation.
183  */
187  const bool val);
188 
189 /**
190  * A snapshot of the enablement state of the interrupts for this IP.
191  *
192  * This is an opaque type, to be used with the
193  * `dif_sensor_ctrl_irq_disable_all()` and `dif_sensor_ctrl_irq_restore_all()`
194  * functions.
195  */
197 
198 /**
199  * Checks whether a particular interrupt is currently enabled or disabled.
200  *
201  * @param sensor_ctrl A sensor_ctrl handle.
202  * @param irq An interrupt request.
203  * @param[out] state Out-param toggle state of the interrupt.
204  * @return The result of the operation.
205  */
208  const dif_sensor_ctrl_t *sensor_ctrl, dif_sensor_ctrl_irq_t irq,
209  dif_toggle_t *state);
210 
211 /**
212  * Sets whether a particular interrupt is currently enabled or disabled.
213  *
214  * @param sensor_ctrl A sensor_ctrl handle.
215  * @param irq An interrupt request.
216  * @param state The new toggle state for the interrupt.
217  * @return The result of the operation.
218  */
221  const dif_sensor_ctrl_t *sensor_ctrl, dif_sensor_ctrl_irq_t irq,
222  dif_toggle_t state);
223 
224 /**
225  * Disables all interrupts, optionally snapshotting all enable states for later
226  * restoration.
227  *
228  * @param sensor_ctrl A sensor_ctrl handle.
229  * @param[out] snapshot Out-param for the snapshot; may be `NULL`.
230  * @return The result of the operation.
231  */
234  const dif_sensor_ctrl_t *sensor_ctrl,
236 
237 /**
238  * Restores interrupts from the given (enable) snapshot.
239  *
240  * @param sensor_ctrl A sensor_ctrl handle.
241  * @param snapshot A snapshot to restore from.
242  * @return The result of the operation.
243  */
246  const dif_sensor_ctrl_t *sensor_ctrl,
247  const dif_sensor_ctrl_irq_enable_snapshot_t *snapshot);
248 
249 #ifdef __cplusplus
250 } // extern "C"
251 #endif // __cplusplus
252 
253 #endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_SENSOR_CTRL_AUTOGEN_H_