Software APIs
sw
device
lib
dif
autogen
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
#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AON_TIMER_AUTOGEN_H_
6
#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AON_TIMER_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/aon_timer/">AON_TIMER</a> Device Interface
14
* Functions
15
*/
16
17
#include <
stdbool.h
>
18
#include <
stdint.h
>
19
20
#include "
sw/device/lib/base/macros.h
"
21
#include "
sw/device/lib/base/mmio.h
"
22
#include "
sw/device/lib/dif/dif_base.h
"
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
// __cplusplus
27
28
/**
29
* A handle to aon_timer.
30
*
31
* This type should be treated as opaque by users.
32
*/
33
typedef
struct
dif_aon_timer
{
34
/**
35
* The base address for the aon_timer hardware registers.
36
*/
37
mmio_region_t
base_addr
;
38
}
dif_aon_timer_t
;
39
40
/**
41
* Creates a new handle for a(n) aon_timer peripheral.
42
*
43
* This function does not actuate the hardware.
44
*
45
* @param base_addr The MMIO base address of the aon_timer peripheral.
46
* @param[out] aon_timer Out param for the initialized handle.
47
* @return The result of the operation.
48
*/
49
OT_WARN_UNUSED_RESULT
50
dif_result_t
dif_aon_timer_init
(
mmio_region_t
base_addr,
51
dif_aon_timer_t
*aon_timer);
52
53
/**
54
* A aon_timer alert type.
55
*/
56
typedef
enum
dif_aon_timer_alert
{
57
/**
58
* This fatal alert is triggered when a fatal TL-UL bus integrity fault is
59
* detected.
60
*/
61
kDifAonTimerAlertFatalFault
= 0,
62
}
dif_aon_timer_alert_t
;
63
64
/**
65
* Forces a particular alert, causing it to be escalated as if the hardware
66
* had raised it.
67
*
68
* @param aon_timer A aon_timer handle.
69
* @param alert The alert to force.
70
* @return The result of the operation.
71
*/
72
OT_WARN_UNUSED_RESULT
73
dif_result_t
dif_aon_timer_alert_force
(
const
dif_aon_timer_t
*aon_timer,
74
dif_aon_timer_alert_t
alert);
75
76
/**
77
* A aon_timer interrupt request type.
78
*/
79
typedef
enum
dif_aon_timer_irq
{
80
/**
81
* Raised if the wakeup timer has hit the specified threshold
82
*/
83
kDifAonTimerIrqWkupTimerExpired
= 0,
84
/**
85
* Raised if the watchdog timer has hit the bark threshold
86
*/
87
kDifAonTimerIrqWdogTimerBark
= 1,
88
}
dif_aon_timer_irq_t
;
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_aon_timer_irq_get_state()`
94
* and `dif_aon_timer_irq_acknowledge_state()` functions.
95
*/
96
typedef
uint32_t
dif_aon_timer_irq_state_snapshot_t
;
97
98
/**
99
* Returns the type of a given interrupt (i.e., event or status) for this IP.
100
*
101
* @param aon_timer A aon_timer 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
*/
106
OT_WARN_UNUSED_RESULT
107
dif_result_t
dif_aon_timer_irq_get_type
(
const
dif_aon_timer_t
*aon_timer,
108
dif_aon_timer_irq_t
irq,
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 aon_timer A aon_timer handle.
115
* @param[out] snapshot Out-param for interrupt state snapshot.
116
* @return The result of the operation.
117
*/
118
OT_WARN_UNUSED_RESULT
119
dif_result_t
dif_aon_timer_irq_get_state
(
120
const
dif_aon_timer_t
*aon_timer,
121
dif_aon_timer_irq_state_snapshot_t
*snapshot);
122
123
/**
124
* Returns whether a particular interrupt is currently pending.
125
*
126
* @param aon_timer A aon_timer 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
*/
131
OT_WARN_UNUSED_RESULT
132
dif_result_t
dif_aon_timer_irq_is_pending
(
const
dif_aon_timer_t
*aon_timer,
133
dif_aon_timer_irq_t
irq,
134
bool
*is_pending);
135
136
/**
137
* Acknowledges all interrupts that were pending at the time of the state
138
* snapshot.
139
*
140
* @param aon_timer A aon_timer handle.
141
* @param snapshot Interrupt state snapshot.
142
* @return The result of the operation.
143
*/
144
OT_WARN_UNUSED_RESULT
145
dif_result_t
dif_aon_timer_irq_acknowledge_state
(
146
const
dif_aon_timer_t
*aon_timer,
147
dif_aon_timer_irq_state_snapshot_t
snapshot);
148
149
/**
150
* Acknowledges all interrupts, indicating to the hardware that all
151
* interrupts have been successfully serviced.
152
*
153
* @param aon_timer A aon_timer handle.
154
* @return The result of the operation.
155
*/
156
OT_WARN_UNUSED_RESULT
157
dif_result_t
dif_aon_timer_irq_acknowledge_all
(
158
const
dif_aon_timer_t
*aon_timer);
159
160
/**
161
* Acknowledges a particular interrupt, indicating to the hardware that it has
162
* been successfully serviced.
163
*
164
* @param aon_timer A aon_timer handle.
165
* @param irq An interrupt request.
166
* @return The result of the operation.
167
*/
168
OT_WARN_UNUSED_RESULT
169
dif_result_t
dif_aon_timer_irq_acknowledge
(
const
dif_aon_timer_t
*aon_timer,
170
dif_aon_timer_irq_t
irq);
171
172
/**
173
* Forces a particular interrupt, causing it to be serviced as if hardware had
174
* asserted it.
175
*
176
* @param aon_timer A aon_timer handle.
177
* @param irq An interrupt request.
178
* @param val Value to be set.
179
* @return The result of the operation.
180
*/
181
OT_WARN_UNUSED_RESULT
182
dif_result_t
dif_aon_timer_irq_force
(
const
dif_aon_timer_t
*aon_timer,
183
dif_aon_timer_irq_t
irq,
const
bool
val);
184
185
#ifdef __cplusplus
186
}
// extern "C"
187
#endif
// __cplusplus
188
189
#endif
// OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_AON_TIMER_AUTOGEN_H_
Return to
OpenTitan Documentation