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