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