Software APIs
dt_aon_timer.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
// Device table API auto-generated by `dtgen`
6
7
#ifndef OPENTITAN_DT_AON_TIMER_H_
8
#define OPENTITAN_DT_AON_TIMER_H_
9
10
/**
11
* @file
12
* @brief Device Tables (DT) for IP aon_timer and top earlgrey.
13
*
14
* This file contains the type definitions and global functions of the aon_timer.
15
*/
16
17
#include "
dt_api.h
"
18
#include <stdint.h>
19
20
21
22
/**
23
* List of instances.
24
*/
25
typedef
enum
dt_aon_timer
{
26
kDtAonTimerAon
= 0,
/**< aon_timer_aon */
27
kDtAonTimerFirst = 0,
/**< \internal First instance */
28
kDtAonTimerCount = 1,
/**< \internal Number of instances */
29
}
dt_aon_timer_t
;
30
31
/**
32
* List of register blocks.
33
*
34
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
35
*/
36
typedef
enum
dt_aon_timer_reg_block
{
37
kDtAonTimerRegBlockCore = 0,
/**< */
38
kDtAonTimerRegBlockCount = 1,
/**< \internal Number of register blocks */
39
}
dt_aon_timer_reg_block_t
;
40
41
/** Primary register block (associated with the "primary" set of registers that control the IP). */
42
static
const
dt_aon_timer_reg_block_t
kDtAonTimerRegBlockPrimary = kDtAonTimerRegBlockCore;
43
44
/**
45
* List of IRQs.
46
*
47
* IRQs are guaranteed to be numbered consecutively from 0.
48
*/
49
typedef
enum
dt_aon_timer_irq
{
50
kDtAonTimerIrqWkupTimerExpired
= 0,
/**< Raised if the wakeup timer has hit the specified threshold. */
51
kDtAonTimerIrqWdogTimerBark
= 1,
/**< Raised if the watchdog timer has hit the bark threshold. */
52
kDtAonTimerIrqCount = 2,
/**< \internal Number of IRQs */
53
}
dt_aon_timer_irq_t
;
54
55
/**
56
* List of Alerts.
57
*
58
* Alerts are guaranteed to be numbered consecutively from 0.
59
*/
60
typedef
enum
dt_aon_timer_alert
{
61
kDtAonTimerAlertFatalFault
= 0,
/**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
62
kDtAonTimerAlertCount = 1,
/**< \internal Number of Alerts */
63
}
dt_aon_timer_alert_t
;
64
65
/**
66
* List of clock ports.
67
*
68
* Clock ports are guaranteed to be numbered consecutively from 0.
69
*/
70
typedef
enum
dt_aon_timer_clock
{
71
kDtAonTimerClockClk
= 0,
/**< Clock port clk_i */
72
kDtAonTimerClockAon
= 1,
/**< Clock port clk_aon_i */
73
kDtAonTimerClockCount = 2,
/**< \internal Number of clock ports */
74
}
dt_aon_timer_clock_t
;
75
76
/**
77
* List of reset requests.
78
*
79
* Reset requests are guaranteed to be numbered consecutively from 0.
80
*/
81
typedef
enum
dt_aon_timer_reset_req
{
82
kDtAonTimerResetReqAonTimer
= 0,
/**< Watchdog reset request. */
83
kDtAonTimerResetReqCount = 1,
/**< \internal Number of reset requests */
84
}
dt_aon_timer_reset_req_t
;
85
86
/**
87
* List of reset ports.
88
*
89
* Reset ports are guaranteed to be numbered consecutively from 0.
90
*/
91
typedef
enum
dt_aon_timer_reset
{
92
kDtAonTimerResetRst
= 0,
/**< Reset port rst_ni */
93
kDtAonTimerResetAon
= 1,
/**< Reset port rst_aon_ni */
94
kDtAonTimerResetCount = 2,
/**< \internal Number of reset ports */
95
}
dt_aon_timer_reset_t
;
96
97
/**
98
* List of wakeups.
99
*
100
* Wakeups are guaranteed to be numbered consecutively from 0.
101
*/
102
typedef
enum
dt_aon_timer_wakeup
{
103
kDtAonTimerWakeupWkupReq
= 0,
/**< Raised if the wakeup or watchdog timer has hit the specified threshold. */
104
kDtAonTimerWakeupCount = 1,
/**< \internal Number of wakeups */
105
}
dt_aon_timer_wakeup_t
;
106
107
/**
108
* List of supported hardware features.
109
*/
110
#define OPENTITAN_AON_TIMER_HAS_WAKEUP_WAKEUP_CONFIG 1
111
#define OPENTITAN_AON_TIMER_HAS_WAKEUP_WAKEUP_REQUEST 1
112
#define OPENTITAN_AON_TIMER_HAS_WAKEUP_INTERRUPT 1
113
#define OPENTITAN_AON_TIMER_HAS_WATCHDOG_BARK 1
114
#define OPENTITAN_AON_TIMER_HAS_WATCHDOG_BITE 1
115
#define OPENTITAN_AON_TIMER_HAS_WATCHDOG_PAUSE 1
116
#define OPENTITAN_AON_TIMER_HAS_WATCHDOG_DISABLE_BY_LC_CTRL 1
117
#define OPENTITAN_AON_TIMER_HAS_WATCHDOG_INTERRUPT 1
118
119
120
121
/**
122
* Get the aon_timer instance from an instance ID
123
*
124
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
125
*
126
* @param inst_id Instance ID.
127
* @return A aon_timer instance.
128
*
129
* **Note:** This function only makes sense if the instance ID has device type aon_timer,
130
* otherwise the returned value is unspecified.
131
*/
132
dt_aon_timer_t
dt_aon_timer_from_instance_id
(
dt_instance_id_t
inst_id);
133
134
/**
135
* Get the instance ID of an instance.
136
*
137
* @param dt Instance of aon_timer.
138
* @return The instance ID of that instance.
139
*/
140
dt_instance_id_t
dt_aon_timer_instance_id
(
dt_aon_timer_t
dt);
141
142
/**
143
* Get the register base address of an instance.
144
*
145
* @param dt Instance of aon_timer.
146
* @param reg_block The register block requested.
147
* @return The register base address of the requested block.
148
*/
149
uint32_t
dt_aon_timer_reg_block
(
150
dt_aon_timer_t
dt,
151
dt_aon_timer_reg_block_t
reg_block);
152
153
/**
154
* Get the primary register base address of an instance.
155
*
156
* This is just a convenience function, equivalent to
157
* `dt_aon_timer_reg_block(dt, kDtAonTimerRegBlockCore)`
158
*
159
* @param dt Instance of aon_timer.
160
* @return The register base address of the primary register block.
161
*/
162
static
inline
uint32_t dt_aon_timer_primary_reg_block(
163
dt_aon_timer_t
dt) {
164
return
dt_aon_timer_reg_block
(dt, kDtAonTimerRegBlockCore);
165
}
166
167
/**
168
* Get the PLIC ID of a aon_timer IRQ for a given instance.
169
*
170
* If the instance is not connected to the PLIC, this function
171
* will return `kDtPlicIrqIdNone`.
172
*
173
* @param dt Instance of aon_timer.
174
* @param irq A aon_timer IRQ.
175
* @return The PLIC ID of the IRQ of this instance.
176
*/
177
dt_plic_irq_id_t
dt_aon_timer_irq_to_plic_id
(
178
dt_aon_timer_t
dt,
179
dt_aon_timer_irq_t
irq);
180
181
/**
182
* Convert a global IRQ ID to a local aon_timer IRQ type.
183
*
184
* @param dt Instance of aon_timer.
185
* @param irq A PLIC ID that belongs to this instance.
186
* @return The aon_timer IRQ, or `kDtAonTimerIrqCount`.
187
*
188
* **Note:** This function assumes that the PLIC ID belongs to the instance
189
* of aon_timer passed in parameter. In other words, it must be the case that
190
* `dt_aon_timer_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
191
* will return `kDtAonTimerIrqCount`.
192
*/
193
dt_aon_timer_irq_t
dt_aon_timer_irq_from_plic_id
(
194
dt_aon_timer_t
dt,
195
dt_plic_irq_id_t
irq);
196
197
198
/**
199
* Get the alert ID of a aon_timer alert for a given instance.
200
*
201
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
202
* instances where the instance is not connected, the return value is unspecified.
203
*
204
* @param dt Instance of aon_timer.
205
* @param alert A aon_timer alert.
206
* @return The Alert Handler alert ID of the alert of this instance.
207
*/
208
dt_alert_id_t
dt_aon_timer_alert_to_alert_id
(
209
dt_aon_timer_t
dt,
210
dt_aon_timer_alert_t
alert);
211
212
/**
213
* Convert a global alert ID to a local aon_timer alert type.
214
*
215
* @param dt Instance of aon_timer.
216
* @param alert A global alert ID that belongs to this instance.
217
* @return The aon_timer alert, or `kDtAonTimerAlertCount`.
218
*
219
* **Note:** This function assumes that the global alert ID belongs to the
220
* instance of aon_timer passed in parameter. In other words, it must be the case
221
* that `dt_aon_timer_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
222
* this function will return `kDtAonTimerAlertCount`.
223
*/
224
dt_aon_timer_alert_t
dt_aon_timer_alert_from_alert_id
(
225
dt_aon_timer_t
dt,
226
dt_alert_id_t
alert);
227
228
229
230
/**
231
* Get the clock signal connected to a clock port of an instance.
232
*
233
* @param dt Instance of aon_timer.
234
* @param clk Clock port.
235
* @return Clock signal.
236
*/
237
dt_clock_t
dt_aon_timer_clock
(
238
dt_aon_timer_t
dt,
239
dt_aon_timer_clock_t
clk);
240
241
/**
242
* Get the reset signal connected to a reset port of an instance.
243
*
244
* @param dt Instance of aon_timer.
245
* @param rst Reset port.
246
* @return Reset signal.
247
*/
248
dt_reset_t
dt_aon_timer_reset
(
249
dt_aon_timer_t
dt,
250
dt_aon_timer_reset_t
rst);
251
252
253
254
#endif
// OPENTITAN_DT_AON_TIMER_H_
(earlgrey)
hw
top
dt
dt_aon_timer.h
Return to
OpenTitan Documentation