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