Software APIs
dt_ac_range_check.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_AC_RANGE_CHECK_H_
8
#define OPENTITAN_DT_AC_RANGE_CHECK_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP ac_range_check and top darjeeling.
17
*
18
* This file contains the type definitions and global functions of the ac_range_check.
19
*/
20
21
#include "hw/top/dt/dt_api.h"
22
#include <stdint.h>
23
24
25
26
27
28
/**
29
* List of instances.
30
*/
31
typedef
enum
dt_ac_range_check
{
32
kDtAcRangeCheck
= 0,
/**< ac_range_check */
33
kDtAcRangeCheckFirst = 0,
/**< \internal First instance */
34
kDtAcRangeCheckCount = 1,
/**< \internal Number of instances */
35
}
dt_ac_range_check_t
;
36
37
/**
38
* List of register blocks.
39
*
40
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
41
*/
42
typedef
enum
dt_ac_range_check_reg_block
{
43
kDtAcRangeCheckRegBlockCore = 0,
/**< */
44
kDtAcRangeCheckRegBlockCount = 1,
/**< \internal Number of register blocks */
45
}
dt_ac_range_check_reg_block_t
;
46
47
/**
48
* List of memories.
49
*
50
* Memories are guaranteed to start at 0 and to be consecutively numbered.
51
*/
52
typedef
enum
dt_ac_range_check_memory
{
53
kDtAcRangeCheckMemoryCount = 0,
/**< \internal Number of memories */
54
}
dt_ac_range_check_memory_t
;
55
56
/** Primary register block (associated with the "primary" set of registers that control the IP). */
57
static
const
dt_ac_range_check_reg_block_t
kDtAcRangeCheckRegBlockPrimary = kDtAcRangeCheckRegBlockCore;
58
59
/**
60
* List of IRQs.
61
*
62
* IRQs are guaranteed to be numbered consecutively from 0.
63
*/
64
typedef
enum
dt_ac_range_check_irq
{
65
kDtAcRangeCheckIrqDenyCntReached
= 0,
/**< Deny counter has exceeded threshold. */
66
kDtAcRangeCheckIrqCount = 1,
/**< \internal Number of IRQs */
67
}
dt_ac_range_check_irq_t
;
68
69
/**
70
* List of Alerts.
71
*
72
* Alerts are guaranteed to be numbered consecutively from 0.
73
*/
74
typedef
enum
dt_ac_range_check_alert
{
75
kDtAcRangeCheckAlertRecovCtrlUpdateErr
= 0,
/**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
76
kDtAcRangeCheckAlertFatalFault
= 1,
/**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected or the internal counter has an error. */
77
kDtAcRangeCheckAlertCount = 2,
/**< \internal Number of Alerts */
78
}
dt_ac_range_check_alert_t
;
79
80
/**
81
* List of clock ports.
82
*
83
* Clock ports are guaranteed to be numbered consecutively from 0.
84
*/
85
typedef
enum
dt_ac_range_check_clock
{
86
kDtAcRangeCheckClockClk
= 0,
/**< Clock port clk_i */
87
kDtAcRangeCheckClockCount = 1,
/**< \internal Number of clock ports */
88
}
dt_ac_range_check_clock_t
;
89
90
/**
91
* List of reset ports.
92
*
93
* Reset ports are guaranteed to be numbered consecutively from 0.
94
*/
95
typedef
enum
dt_ac_range_check_reset
{
96
kDtAcRangeCheckResetRst
= 0,
/**< Reset port rst_ni */
97
kDtAcRangeCheckResetCount = 1,
/**< \internal Number of reset ports */
98
}
dt_ac_range_check_reset_t
;
99
100
101
/**
102
* Get the ac_range_check instance from an instance ID
103
*
104
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
105
*
106
* @param inst_id Instance ID.
107
* @return A ac_range_check instance.
108
*
109
* **Note:** This function only makes sense if the instance ID has device type ac_range_check,
110
* otherwise the returned value is unspecified.
111
*/
112
dt_ac_range_check_t
dt_ac_range_check_from_instance_id
(
dt_instance_id_t
inst_id);
113
114
/**
115
* Get the instance ID of an instance.
116
*
117
* @param dt Instance of ac_range_check.
118
* @return The instance ID of that instance.
119
*/
120
dt_instance_id_t
dt_ac_range_check_instance_id
(
dt_ac_range_check_t
dt);
121
122
/**
123
* Get the register base address of an instance.
124
*
125
* @param dt Instance of ac_range_check.
126
* @param reg_block The register block requested.
127
* @return The register base address of the requested block.
128
*/
129
uint32_t
dt_ac_range_check_reg_block
(
130
dt_ac_range_check_t
dt,
131
dt_ac_range_check_reg_block_t
reg_block);
132
133
/**
134
* Get the primary register base address of an instance.
135
*
136
* This is just a convenience function, equivalent to
137
* `dt_ac_range_check_reg_block(dt, kDtAcRangeCheckRegBlockCore)`
138
*
139
* @param dt Instance of ac_range_check.
140
* @return The register base address of the primary register block.
141
*/
142
static
inline
uint32_t dt_ac_range_check_primary_reg_block(
143
dt_ac_range_check_t
dt) {
144
return
dt_ac_range_check_reg_block
(dt, kDtAcRangeCheckRegBlockCore);
145
}
146
147
/**
148
* Get the base address of a memory.
149
*
150
* @param dt Instance of ac_range_check.
151
* @param mem The memory requested.
152
* @return The base address of the requested memory.
153
*/
154
uint32_t
dt_ac_range_check_memory_base
(
155
dt_ac_range_check_t
dt,
156
dt_ac_range_check_memory_t
mem);
157
158
/**
159
* Get the size of a memory.
160
*
161
* @param dt Instance of ac_range_check.
162
* @param mem The memory requested.
163
* @return The size of the requested memory.
164
*/
165
uint32_t
dt_ac_range_check_memory_size
(
166
dt_ac_range_check_t
dt,
167
dt_ac_range_check_memory_t
mem);
168
169
/**
170
* Get the PLIC ID of a ac_range_check IRQ for a given instance.
171
*
172
* If the instance is not connected to the PLIC, this function
173
* will return `kDtPlicIrqIdNone`.
174
*
175
* @param dt Instance of ac_range_check.
176
* @param irq A ac_range_check IRQ.
177
* @return The PLIC ID of the IRQ of this instance.
178
*/
179
dt_plic_irq_id_t
dt_ac_range_check_irq_to_plic_id
(
180
dt_ac_range_check_t
dt,
181
dt_ac_range_check_irq_t
irq);
182
183
/**
184
* Convert a global IRQ ID to a local ac_range_check IRQ type.
185
*
186
* @param dt Instance of ac_range_check.
187
* @param irq A PLIC ID that belongs to this instance.
188
* @return The ac_range_check IRQ, or `kDtAcRangeCheckIrqCount`.
189
*
190
* **Note:** This function assumes that the PLIC ID belongs to the instance
191
* of ac_range_check passed in parameter. In other words, it must be the case that
192
* `dt_ac_range_check_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
193
* will return `kDtAcRangeCheckIrqCount`.
194
*/
195
dt_ac_range_check_irq_t
dt_ac_range_check_irq_from_plic_id
(
196
dt_ac_range_check_t
dt,
197
dt_plic_irq_id_t
irq);
198
199
200
/**
201
* Get the alert ID of a ac_range_check alert for a given instance.
202
*
203
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
204
* instances where the instance is not connected, the return value is unspecified.
205
*
206
* @param dt Instance of ac_range_check.
207
* @param alert A ac_range_check alert.
208
* @return The Alert Handler alert ID of the alert of this instance.
209
*/
210
dt_alert_id_t
dt_ac_range_check_alert_to_alert_id
(
211
dt_ac_range_check_t
dt,
212
dt_ac_range_check_alert_t
alert);
213
214
/**
215
* Convert a global alert ID to a local ac_range_check alert type.
216
*
217
* @param dt Instance of ac_range_check.
218
* @param alert A global alert ID that belongs to this instance.
219
* @return The ac_range_check alert, or `kDtAcRangeCheckAlertCount`.
220
*
221
* **Note:** This function assumes that the global alert ID belongs to the
222
* instance of ac_range_check passed in parameter. In other words, it must be the case
223
* that `dt_ac_range_check_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
224
* this function will return `kDtAcRangeCheckAlertCount`.
225
*/
226
dt_ac_range_check_alert_t
dt_ac_range_check_alert_from_alert_id
(
227
dt_ac_range_check_t
dt,
228
dt_alert_id_t
alert);
229
230
231
232
/**
233
* Get the clock signal connected to a clock port of an instance.
234
*
235
* @param dt Instance of ac_range_check.
236
* @param clk Clock port.
237
* @return Clock signal.
238
*/
239
dt_clock_t
dt_ac_range_check_clock
(
240
dt_ac_range_check_t
dt,
241
dt_ac_range_check_clock_t
clk);
242
243
/**
244
* Get the reset signal connected to a reset port of an instance.
245
*
246
* @param dt Instance of ac_range_check.
247
* @param rst Reset port.
248
* @return Reset signal.
249
*/
250
dt_reset_t
dt_ac_range_check_reset
(
251
dt_ac_range_check_t
dt,
252
dt_ac_range_check_reset_t
rst);
253
254
255
256
/**
257
* Get the Number of range registers.
258
*
259
* @param dt Instance of ac_range_check.
260
* @return Number of range registers.
261
*/
262
uint8_t
dt_ac_range_check_num_ranges
(
dt_ac_range_check_t
dt);
263
264
265
266
#ifdef __cplusplus
267
}
// extern "C"
268
#endif
// __cplusplus
269
270
#endif
// OPENTITAN_DT_AC_RANGE_CHECK_H_
(darjeeling)
hw
top
dt
dt_ac_range_check.h
Return to
OpenTitan Documentation