Software APIs
dif_aon_timer_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
6
7#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AON_TIMER_AUTOGEN_H_
8#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AON_TIMER_AUTOGEN_H_
9
10// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
11// util/autogen_dif.py -i hw/ip/aon_timer/data/aon_timer.hjson -o
12// bazel-out/k8-fastbuild/bin/sw/device/lib/dif/autogen
13
14
15/**
16 * @file
17 * @brief <a href="/book/hw/ip/aon_timer/">AON_TIMER</a> Device Interface Functions
18 */
19
20#include <stdbool.h>
21#include <stdint.h>
22
26#include "hw/top/dt/aon_timer.h" // Generated.
27
28#ifdef __cplusplus
29extern "C" {
30#endif // __cplusplus
31
32/**
33 * A handle to aon_timer.
34 *
35 * This type should be treated as opaque by users.
36 */
37typedef struct dif_aon_timer {
38 /**
39 * The base address for the aon_timer hardware registers.
40 */
42 /**
43 * The instance, set to `kDtAonTimerCount` if not initialized
44 * through `dif_aon_timer_init_from_dt`.
45 */
48
49/**
50 * Creates a new handle for a(n) aon_timer peripheral.
51 *
52 * This function does not actuate the hardware.
53 *
54 * @param base_addr The MMIO base address of the aon_timer peripheral.
55 * @param[out] aon_timer Out param for the initialized handle.
56 * @return The result of the operation.
57 *
58 * DEPRECATED This function exists solely for the transition to
59 * dt-based DIFs and will be removed in the future.
60 */
63 mmio_region_t base_addr,
64 dif_aon_timer_t *aon_timer);
65
66/**
67 * Creates a new handle for a(n) aon_timer peripheral.
68 *
69 * This function does not actuate the hardware.
70 *
71 * @param dt The devicetable description of the device.
72 * @param[out] aon_timer Out param for the initialized handle.
73 * @return The result of the operation.
74 */
78 dif_aon_timer_t *aon_timer);
79
80/**
81 * Get the DT handle from this DIF.
82 *
83 * If this DIF was initialized by `dif_aon_timer_init_from_dt(dt, ..)`
84 * then this function will return `dt`. Otherwise it will return an error.
85 *
86 * @param aon_timer A aon_timer handle.
87 * @param[out] dt DT handle.
88 * @return `kDifBadArg` if the DIF has no DT information, `kDifOk` otherwise.
89 */
92 const dif_aon_timer_t *aon_timer,
93 dt_aon_timer_t *dt);
94
95 /**
96 * A aon_timer alert type.
97 */
98 typedef enum dif_aon_timer_alert {
99 /**
100 * This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
101 */
104
105 /**
106 * Forces a particular alert, causing it to be escalated as if the hardware
107 * had raised it.
108 *
109 * @param aon_timer A aon_timer handle.
110 * @param alert The alert to force.
111 * @return The result of the operation.
112 */
115 const dif_aon_timer_t *aon_timer,
117
118 // DEPRECATED This typedef exists solely for the transition to
119 // dt-based interrupt numbers and will be removed in the future.
120 typedef dt_aon_timer_irq_t dif_aon_timer_irq_t;
121
122 /**
123 * A aon_timer interrupt request type.
124 *
125 * DEPRECATED Use `dt_aon_timer_irq_t` instead.
126 * This enumeration exists solely for the transition to
127 * dt-based interrupt numbers and will be removed in the future.
128 *
129 * The following are defines to keep the types consistent with DT.
130 */
131 /**
132 * Raised if the wakeup timer has hit the specified threshold.
133 */
134#define kDifAonTimerIrqWkupTimerExpired kDtAonTimerIrqWkupTimerExpired
135 /**
136 * Raised if the watchdog timer has hit the bark threshold.
137 */
138#define kDifAonTimerIrqWdogTimerBark kDtAonTimerIrqWdogTimerBark
139
140 /**
141 * A snapshot of the state of the interrupts for this IP.
142 *
143 * This is an opaque type, to be used with the `dif_aon_timer_irq_get_state()`
144 * and `dif_aon_timer_irq_acknowledge_state()` functions.
145 */
147
148 /**
149 * Returns the type of a given interrupt (i.e., event or status) for this IP.
150 *
151 * @param aon_timer A aon_timer handle.
152 * @param irq An interrupt request.
153 * @param[out] type Out-param for the interrupt type.
154 * @return The result of the operation.
155 */
158 const dif_aon_timer_t *aon_timer,
159 dif_aon_timer_irq_t,
160 dif_irq_type_t *type);
161
162 /**
163 * Returns the state of all interrupts (i.e., pending or not) for this IP.
164 *
165 * @param aon_timer A aon_timer handle.
166 * @param[out] snapshot Out-param for interrupt state snapshot.
167 * @return The result of the operation.
168 */
171 const dif_aon_timer_t *aon_timer,
173
174 /**
175 * Returns whether a particular interrupt is currently pending.
176 *
177 * @param aon_timer A aon_timer handle.
178 * @param irq An interrupt request.
179 * @param[out] is_pending Out-param for whether the interrupt is pending.
180 * @return The result of the operation.
181 */
184 const dif_aon_timer_t *aon_timer,
185 dif_aon_timer_irq_t,
186 bool *is_pending);
187
188 /**
189 * Acknowledges all interrupts that were pending at the time of the state
190 * snapshot.
191 *
192 * @param aon_timer A aon_timer handle.
193 * @param snapshot Interrupt state snapshot.
194 * @return The result of the operation.
195 */
198 const dif_aon_timer_t *aon_timer,
200
201 /**
202 * Acknowledges all interrupts, indicating to the hardware that all
203 * interrupts have been successfully serviced.
204 *
205 * @param aon_timer A aon_timer handle.
206 * @return The result of the operation.
207 */
210 const dif_aon_timer_t *aon_timer
211 );
212
213 /**
214 * Acknowledges a particular interrupt, indicating to the hardware that it has
215 * been successfully serviced.
216 *
217 * @param aon_timer A aon_timer handle.
218 * @param irq An interrupt request.
219 * @return The result of the operation.
220 */
223 const dif_aon_timer_t *aon_timer,
224 dif_aon_timer_irq_t);
225
226 /**
227 * Forces a particular interrupt, causing it to be serviced as if hardware had
228 * asserted it.
229 *
230 * @param aon_timer A aon_timer handle.
231 * @param irq An interrupt request.
232 * @param val Value to be set.
233 * @return The result of the operation.
234 */
237 const dif_aon_timer_t *aon_timer,
238 dif_aon_timer_irq_t,
239 const bool val);
240
241
242
243#ifdef __cplusplus
244} // extern "C"
245#endif // __cplusplus
246
247#endif // OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AON_TIMER_AUTOGEN_H_