Software APIs
rom_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_ROM_CTRL_H_
8
#define OPENTITAN_DT_ROM_CTRL_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP rom_ctrl and top darjeeling.
17
*
18
* This file contains the type definitions and global functions of the rom_ctrl.
19
*/
20
21
#include "hw/top/dt/api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_rom_ctrl
{
30
kDtRomCtrlFirst
= 0,
/**< First instance */
31
kDtRomCtrl0
= 0,
/**< rom_ctrl0 */
32
kDtRomCtrl1
= 1,
/**< rom_ctrl1 */
33
}
dt_rom_ctrl_t
;
34
35
enum
{
36
kDtRomCtrlCount
= 2,
/**< Number of instances */
37
};
38
39
40
/**
41
* List of register blocks.
42
*
43
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
44
*/
45
typedef
enum
dt_rom_ctrl_reg_block
{
46
kDtRomCtrlRegBlockRegs = 0,
/**< */
47
}
dt_rom_ctrl_reg_block_t
;
48
49
enum
{
50
kDtRomCtrlRegBlockCount
= 1,
/**< Number of register blocks */
51
};
52
53
54
/** Primary register block (associated with the "primary" set of registers that control the IP). */
55
static
const
dt_rom_ctrl_reg_block_t
kDtRomCtrlRegBlockPrimary = kDtRomCtrlRegBlockRegs;
56
57
/**
58
* List of memories.
59
*
60
* Memories are guaranteed to start at 0 and to be consecutively numbered.
61
*/
62
typedef
enum
dt_rom_ctrl_memory
{
63
kDtRomCtrlMemoryRom = 0,
/**< */
64
}
dt_rom_ctrl_memory_t
;
65
66
enum
{
67
kDtRomCtrlMemoryCount
= 1,
/**< Number of memories */
68
};
69
70
71
/**
72
* List of Alerts.
73
*
74
* Alerts are guaranteed to be numbered consecutively from 0.
75
*/
76
typedef
enum
dt_rom_ctrl_alert
{
77
kDtRomCtrlAlertFatal
= 0,
/**< A fatal error. Fatal alerts are non-recoverable and will be asserted until a hard reset. */
78
}
dt_rom_ctrl_alert_t
;
79
80
enum
{
81
kDtRomCtrlAlertCount
= 1,
/**< Number of Alerts */
82
};
83
84
85
/**
86
* List of clock ports.
87
*
88
* Clock ports are guaranteed to be numbered consecutively from 0.
89
*/
90
typedef
enum
dt_rom_ctrl_clock
{
91
kDtRomCtrlClockClk
= 0,
/**< Clock port clk_i */
92
}
dt_rom_ctrl_clock_t
;
93
94
enum
{
95
kDtRomCtrlClockCount
= 1,
/**< Number of clock ports */
96
};
97
98
99
/**
100
* List of reset ports.
101
*
102
* Reset ports are guaranteed to be numbered consecutively from 0.
103
*/
104
typedef
enum
dt_rom_ctrl_reset
{
105
kDtRomCtrlResetRst
= 0,
/**< Reset port rst_ni */
106
}
dt_rom_ctrl_reset_t
;
107
108
enum
{
109
kDtRomCtrlResetCount
= 1,
/**< Number of reset ports */
110
};
111
112
113
/**
114
* List of supported hardware features.
115
*/
116
#define OPENTITAN_ROM_CTRL_HAS_SCRAMBLED 1
117
#define OPENTITAN_ROM_CTRL_HAS_DIGESTS 1
118
#define OPENTITAN_ROM_CTRL_HAS_EXP_DIGESTS 1
119
120
121
122
/**
123
* Get the rom_ctrl instance from an instance ID
124
*
125
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
126
*
127
* @param inst_id Instance ID.
128
* @return A rom_ctrl instance.
129
*
130
* **Note:** This function only makes sense if the instance ID has device type rom_ctrl,
131
* otherwise the returned value is unspecified.
132
*/
133
dt_rom_ctrl_t
dt_rom_ctrl_from_instance_id
(
dt_instance_id_t
inst_id);
134
135
/**
136
* Get the instance ID of an instance.
137
*
138
* @param dt Instance of rom_ctrl.
139
* @return The instance ID of that instance.
140
*/
141
dt_instance_id_t
dt_rom_ctrl_instance_id
(
dt_rom_ctrl_t
dt);
142
143
/**
144
* Get the register base address of an instance.
145
*
146
* @param dt Instance of rom_ctrl.
147
* @param reg_block The register block requested.
148
* @return The register base address of the requested block.
149
*/
150
uint32_t
dt_rom_ctrl_reg_block
(
151
dt_rom_ctrl_t
dt,
152
dt_rom_ctrl_reg_block_t
reg_block);
153
154
/**
155
* Get the primary register base address of an instance.
156
*
157
* This is just a convenience function, equivalent to
158
* `dt_rom_ctrl_reg_block(dt, kDtRomCtrlRegBlockRegs)`
159
*
160
* @param dt Instance of rom_ctrl.
161
* @return The register base address of the primary register block.
162
*/
163
static
inline
uint32_t dt_rom_ctrl_primary_reg_block(
164
dt_rom_ctrl_t
dt) {
165
return
dt_rom_ctrl_reg_block
(dt, kDtRomCtrlRegBlockRegs);
166
}
167
168
/**
169
* Get the base address of a memory.
170
*
171
* @param dt Instance of rom_ctrl.
172
* @param mem The memory requested.
173
* @return The base address of the requested memory.
174
*/
175
uint32_t
dt_rom_ctrl_memory_base
(
176
dt_rom_ctrl_t
dt,
177
dt_rom_ctrl_memory_t
mem);
178
179
/**
180
* Get the size of a memory.
181
*
182
* @param dt Instance of rom_ctrl.
183
* @param mem The memory requested.
184
* @return The size of the requested memory.
185
*/
186
uint32_t
dt_rom_ctrl_memory_size
(
187
dt_rom_ctrl_t
dt,
188
dt_rom_ctrl_memory_t
mem);
189
190
191
/**
192
* Get the alert ID of a rom_ctrl alert for a given instance.
193
*
194
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
195
* instances where the instance is not connected, the return value is unspecified.
196
*
197
* @param dt Instance of rom_ctrl.
198
* @param alert A rom_ctrl alert.
199
* @return The Alert Handler alert ID of the alert of this instance.
200
*/
201
dt_alert_id_t
dt_rom_ctrl_alert_to_alert_id
(
202
dt_rom_ctrl_t
dt,
203
dt_rom_ctrl_alert_t
alert);
204
205
/**
206
* Convert a global alert ID to a local rom_ctrl alert type.
207
*
208
* @param dt Instance of rom_ctrl.
209
* @param alert A global alert ID that belongs to this instance.
210
* @return The rom_ctrl alert, or `kDtRomCtrlAlertCount`.
211
*
212
* **Note:** This function assumes that the global alert ID belongs to the
213
* instance of rom_ctrl passed in parameter. In other words, it must be the case
214
* that `dt_rom_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
215
* this function will return `kDtRomCtrlAlertCount`.
216
*/
217
dt_rom_ctrl_alert_t
dt_rom_ctrl_alert_from_alert_id
(
218
dt_rom_ctrl_t
dt,
219
dt_alert_id_t
alert);
220
221
222
223
/**
224
* Get the clock signal connected to a clock port of an instance.
225
*
226
* @param dt Instance of rom_ctrl.
227
* @param clk Clock port.
228
* @return Clock signal.
229
*/
230
dt_clock_t
dt_rom_ctrl_clock
(
231
dt_rom_ctrl_t
dt,
232
dt_rom_ctrl_clock_t
clk);
233
234
/**
235
* Get the reset signal connected to a reset port of an instance.
236
*
237
* @param dt Instance of rom_ctrl.
238
* @param rst Reset port.
239
* @return Reset signal.
240
*/
241
dt_reset_t
dt_rom_ctrl_reset
(
242
dt_rom_ctrl_t
dt,
243
dt_rom_ctrl_reset_t
rst);
244
245
246
247
#ifdef __cplusplus
248
}
// extern "C"
249
#endif
// __cplusplus
250
251
#endif
// OPENTITAN_DT_ROM_CTRL_H_
(darjeeling)
hw
top
dt
rom_ctrl.h
Return to
OpenTitan Documentation