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