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 englishbreakfast.
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
kDtRomCtrl
= 0,
/**< rom_ctrl */
32
}
dt_rom_ctrl_t
;
33
34
enum
{
35
kDtRomCtrlCount
= 1,
/**< Number of instances */
36
};
37
38
39
/**
40
* List of register blocks.
41
*
42
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
43
*/
44
typedef
enum
dt_rom_ctrl_reg_block
{
45
kDtRomCtrlRegBlockRegs = 0,
/**< */
46
}
dt_rom_ctrl_reg_block_t
;
47
48
enum
{
49
kDtRomCtrlRegBlockCount
= 1,
/**< Number of register blocks */
50
};
51
52
53
/** Primary register block (associated with the "primary" set of registers that control the IP). */
54
static
const
dt_rom_ctrl_reg_block_t
kDtRomCtrlRegBlockPrimary = kDtRomCtrlRegBlockRegs;
55
56
/**
57
* List of memories.
58
*
59
* Memories are guaranteed to start at 0 and to be consecutively numbered.
60
*/
61
typedef
enum
dt_rom_ctrl_memory
{
62
kDtRomCtrlMemoryRom = 0,
/**< */
63
}
dt_rom_ctrl_memory_t
;
64
65
enum
{
66
kDtRomCtrlMemoryCount
= 1,
/**< Number of memories */
67
};
68
69
70
/**
71
* List of clock ports.
72
*
73
* Clock ports are guaranteed to be numbered consecutively from 0.
74
*/
75
typedef
enum
dt_rom_ctrl_clock
{
76
kDtRomCtrlClockClk
= 0,
/**< Clock port clk_i */
77
}
dt_rom_ctrl_clock_t
;
78
79
enum
{
80
kDtRomCtrlClockCount
= 1,
/**< Number of clock ports */
81
};
82
83
84
/**
85
* List of reset ports.
86
*
87
* Reset ports are guaranteed to be numbered consecutively from 0.
88
*/
89
typedef
enum
dt_rom_ctrl_reset
{
90
kDtRomCtrlResetRst
= 0,
/**< Reset port rst_ni */
91
}
dt_rom_ctrl_reset_t
;
92
93
enum
{
94
kDtRomCtrlResetCount
= 1,
/**< Number of reset ports */
95
};
96
97
98
/**
99
* List of supported hardware features.
100
*/
101
#define OPENTITAN_ROM_CTRL_HAS_SCRAMBLED 1
102
#define OPENTITAN_ROM_CTRL_HAS_DIGESTS 1
103
#define OPENTITAN_ROM_CTRL_HAS_EXP_DIGESTS 1
104
105
106
107
/**
108
* Get the rom_ctrl instance from an instance ID
109
*
110
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
111
*
112
* @param inst_id Instance ID.
113
* @return A rom_ctrl instance.
114
*
115
* **Note:** This function only makes sense if the instance ID has device type rom_ctrl,
116
* otherwise the returned value is unspecified.
117
*/
118
dt_rom_ctrl_t
dt_rom_ctrl_from_instance_id
(
dt_instance_id_t
inst_id);
119
120
/**
121
* Get the instance ID of an instance.
122
*
123
* @param dt Instance of rom_ctrl.
124
* @return The instance ID of that instance.
125
*/
126
dt_instance_id_t
dt_rom_ctrl_instance_id
(
dt_rom_ctrl_t
dt);
127
128
/**
129
* Get the register base address of an instance.
130
*
131
* @param dt Instance of rom_ctrl.
132
* @param reg_block The register block requested.
133
* @return The register base address of the requested block.
134
*/
135
uint32_t
dt_rom_ctrl_reg_block
(
136
dt_rom_ctrl_t
dt,
137
dt_rom_ctrl_reg_block_t
reg_block);
138
139
/**
140
* Get the primary register base address of an instance.
141
*
142
* This is just a convenience function, equivalent to
143
* `dt_rom_ctrl_reg_block(dt, kDtRomCtrlRegBlockRegs)`
144
*
145
* @param dt Instance of rom_ctrl.
146
* @return The register base address of the primary register block.
147
*/
148
static
inline
uint32_t dt_rom_ctrl_primary_reg_block(
149
dt_rom_ctrl_t
dt) {
150
return
dt_rom_ctrl_reg_block
(dt, kDtRomCtrlRegBlockRegs);
151
}
152
153
/**
154
* Get the base address of a memory.
155
*
156
* @param dt Instance of rom_ctrl.
157
* @param mem The memory requested.
158
* @return The base address of the requested memory.
159
*/
160
uint32_t
dt_rom_ctrl_memory_base
(
161
dt_rom_ctrl_t
dt,
162
dt_rom_ctrl_memory_t
mem);
163
164
/**
165
* Get the size of a memory.
166
*
167
* @param dt Instance of rom_ctrl.
168
* @param mem The memory requested.
169
* @return The size of the requested memory.
170
*/
171
uint32_t
dt_rom_ctrl_memory_size
(
172
dt_rom_ctrl_t
dt,
173
dt_rom_ctrl_memory_t
mem);
174
175
176
177
178
/**
179
* Get the clock signal connected to a clock port of an instance.
180
*
181
* @param dt Instance of rom_ctrl.
182
* @param clk Clock port.
183
* @return Clock signal.
184
*/
185
dt_clock_t
dt_rom_ctrl_clock
(
186
dt_rom_ctrl_t
dt,
187
dt_rom_ctrl_clock_t
clk);
188
189
/**
190
* Get the reset signal connected to a reset port of an instance.
191
*
192
* @param dt Instance of rom_ctrl.
193
* @param rst Reset port.
194
* @return Reset signal.
195
*/
196
dt_reset_t
dt_rom_ctrl_reset
(
197
dt_rom_ctrl_t
dt,
198
dt_rom_ctrl_reset_t
rst);
199
200
201
202
#ifdef __cplusplus
203
}
// extern "C"
204
#endif
// __cplusplus
205
206
#endif
// OPENTITAN_DT_ROM_CTRL_H_
(englishbreakfast)
hw
top
dt
rom_ctrl.h
Return to
OpenTitan Documentation