Software APIs
dt_racl_ctrl.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_RACL_CTRL_H_
8
#define OPENTITAN_DT_RACL_CTRL_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP racl_ctrl and top darjeeling.
17
*
18
* This file contains the type definitions and global functions of the racl_ctrl.
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_racl_ctrl
{
30
kDtRaclCtrl
= 0,
/**< racl_ctrl */
31
kDtRaclCtrlFirst = 0,
/**< \internal First instance */
32
kDtRaclCtrlCount = 1,
/**< \internal Number of instances */
33
}
dt_racl_ctrl_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_racl_ctrl_reg_block
{
41
kDtRaclCtrlRegBlockCore = 0,
/**< */
42
kDtRaclCtrlRegBlockCount = 1,
/**< \internal Number of register blocks */
43
}
dt_racl_ctrl_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_racl_ctrl_memory
{
51
kDtRaclCtrlMemoryCount = 0,
/**< \internal Number of memories */
52
}
dt_racl_ctrl_memory_t
;
53
54
/** Primary register block (associated with the "primary" set of registers that control the IP). */
55
static
const
dt_racl_ctrl_reg_block_t
kDtRaclCtrlRegBlockPrimary = kDtRaclCtrlRegBlockCore;
56
57
/**
58
* List of IRQs.
59
*
60
* IRQs are guaranteed to be numbered consecutively from 0.
61
*/
62
typedef
enum
dt_racl_ctrl_irq
{
63
kDtRaclCtrlIrqRaclError
= 0,
/**< RACL error has occurred. */
64
kDtRaclCtrlIrqCount = 1,
/**< \internal Number of IRQs */
65
}
dt_racl_ctrl_irq_t
;
66
67
/**
68
* List of Alerts.
69
*
70
* Alerts are guaranteed to be numbered consecutively from 0.
71
*/
72
typedef
enum
dt_racl_ctrl_alert
{
73
kDtRaclCtrlAlertFatalFault
= 0,
/**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
74
kDtRaclCtrlAlertRecovCtrlUpdateErr
= 1,
/**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
75
kDtRaclCtrlAlertCount = 2,
/**< \internal Number of Alerts */
76
}
dt_racl_ctrl_alert_t
;
77
78
/**
79
* List of clock ports.
80
*
81
* Clock ports are guaranteed to be numbered consecutively from 0.
82
*/
83
typedef
enum
dt_racl_ctrl_clock
{
84
kDtRaclCtrlClockClk
= 0,
/**< Clock port clk_i */
85
kDtRaclCtrlClockCount = 1,
/**< \internal Number of clock ports */
86
}
dt_racl_ctrl_clock_t
;
87
88
/**
89
* List of reset ports.
90
*
91
* Reset ports are guaranteed to be numbered consecutively from 0.
92
*/
93
typedef
enum
dt_racl_ctrl_reset
{
94
kDtRaclCtrlResetRst
= 0,
/**< Reset port rst_ni */
95
kDtRaclCtrlResetCount = 1,
/**< \internal Number of reset ports */
96
}
dt_racl_ctrl_reset_t
;
97
98
99
/**
100
* Get the racl_ctrl instance from an instance ID
101
*
102
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
103
*
104
* @param inst_id Instance ID.
105
* @return A racl_ctrl instance.
106
*
107
* **Note:** This function only makes sense if the instance ID has device type racl_ctrl,
108
* otherwise the returned value is unspecified.
109
*/
110
dt_racl_ctrl_t
dt_racl_ctrl_from_instance_id
(
dt_instance_id_t
inst_id);
111
112
/**
113
* Get the instance ID of an instance.
114
*
115
* @param dt Instance of racl_ctrl.
116
* @return The instance ID of that instance.
117
*/
118
dt_instance_id_t
dt_racl_ctrl_instance_id
(
dt_racl_ctrl_t
dt);
119
120
/**
121
* Get the register base address of an instance.
122
*
123
* @param dt Instance of racl_ctrl.
124
* @param reg_block The register block requested.
125
* @return The register base address of the requested block.
126
*/
127
uint32_t
dt_racl_ctrl_reg_block
(
128
dt_racl_ctrl_t
dt,
129
dt_racl_ctrl_reg_block_t
reg_block);
130
131
/**
132
* Get the primary register base address of an instance.
133
*
134
* This is just a convenience function, equivalent to
135
* `dt_racl_ctrl_reg_block(dt, kDtRaclCtrlRegBlockCore)`
136
*
137
* @param dt Instance of racl_ctrl.
138
* @return The register base address of the primary register block.
139
*/
140
static
inline
uint32_t dt_racl_ctrl_primary_reg_block(
141
dt_racl_ctrl_t
dt) {
142
return
dt_racl_ctrl_reg_block
(dt, kDtRaclCtrlRegBlockCore);
143
}
144
145
/**
146
* Get the base address of a memory.
147
*
148
* @param dt Instance of racl_ctrl.
149
* @param mem The memory requested.
150
* @return The base address of the requested memory.
151
*/
152
uint32_t
dt_racl_ctrl_memory_base
(
153
dt_racl_ctrl_t
dt,
154
dt_racl_ctrl_memory_t
mem);
155
156
/**
157
* Get the size of a memory.
158
*
159
* @param dt Instance of racl_ctrl.
160
* @param mem The memory requested.
161
* @return The size of the requested memory.
162
*/
163
uint32_t
dt_racl_ctrl_memory_size
(
164
dt_racl_ctrl_t
dt,
165
dt_racl_ctrl_memory_t
mem);
166
167
/**
168
* Get the PLIC ID of a racl_ctrl IRQ for a given instance.
169
*
170
* If the instance is not connected to the PLIC, this function
171
* will return `kDtPlicIrqIdNone`.
172
*
173
* @param dt Instance of racl_ctrl.
174
* @param irq A racl_ctrl IRQ.
175
* @return The PLIC ID of the IRQ of this instance.
176
*/
177
dt_plic_irq_id_t
dt_racl_ctrl_irq_to_plic_id
(
178
dt_racl_ctrl_t
dt,
179
dt_racl_ctrl_irq_t
irq);
180
181
/**
182
* Convert a global IRQ ID to a local racl_ctrl IRQ type.
183
*
184
* @param dt Instance of racl_ctrl.
185
* @param irq A PLIC ID that belongs to this instance.
186
* @return The racl_ctrl IRQ, or `kDtRaclCtrlIrqCount`.
187
*
188
* **Note:** This function assumes that the PLIC ID belongs to the instance
189
* of racl_ctrl passed in parameter. In other words, it must be the case that
190
* `dt_racl_ctrl_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
191
* will return `kDtRaclCtrlIrqCount`.
192
*/
193
dt_racl_ctrl_irq_t
dt_racl_ctrl_irq_from_plic_id
(
194
dt_racl_ctrl_t
dt,
195
dt_plic_irq_id_t
irq);
196
197
198
/**
199
* Get the alert ID of a racl_ctrl alert for a given instance.
200
*
201
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
202
* instances where the instance is not connected, the return value is unspecified.
203
*
204
* @param dt Instance of racl_ctrl.
205
* @param alert A racl_ctrl alert.
206
* @return The Alert Handler alert ID of the alert of this instance.
207
*/
208
dt_alert_id_t
dt_racl_ctrl_alert_to_alert_id
(
209
dt_racl_ctrl_t
dt,
210
dt_racl_ctrl_alert_t
alert);
211
212
/**
213
* Convert a global alert ID to a local racl_ctrl alert type.
214
*
215
* @param dt Instance of racl_ctrl.
216
* @param alert A global alert ID that belongs to this instance.
217
* @return The racl_ctrl alert, or `kDtRaclCtrlAlertCount`.
218
*
219
* **Note:** This function assumes that the global alert ID belongs to the
220
* instance of racl_ctrl passed in parameter. In other words, it must be the case
221
* that `dt_racl_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
222
* this function will return `kDtRaclCtrlAlertCount`.
223
*/
224
dt_racl_ctrl_alert_t
dt_racl_ctrl_alert_from_alert_id
(
225
dt_racl_ctrl_t
dt,
226
dt_alert_id_t
alert);
227
228
229
230
/**
231
* Get the clock signal connected to a clock port of an instance.
232
*
233
* @param dt Instance of racl_ctrl.
234
* @param clk Clock port.
235
* @return Clock signal.
236
*/
237
dt_clock_t
dt_racl_ctrl_clock
(
238
dt_racl_ctrl_t
dt,
239
dt_racl_ctrl_clock_t
clk);
240
241
/**
242
* Get the reset signal connected to a reset port of an instance.
243
*
244
* @param dt Instance of racl_ctrl.
245
* @param rst Reset port.
246
* @return Reset signal.
247
*/
248
dt_reset_t
dt_racl_ctrl_reset
(
249
dt_racl_ctrl_t
dt,
250
dt_racl_ctrl_reset_t
rst);
251
252
253
254
#ifdef __cplusplus
255
}
// extern "C"
256
#endif
// __cplusplus
257
258
#endif
// OPENTITAN_DT_RACL_CTRL_H_
(darjeeling)
hw
top
dt
dt_racl_ctrl.h
Return to
OpenTitan Documentation