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