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