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