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
11extern "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 */
29typedef enum dt_rom_ctrl {
30 kDtRomCtrlFirst = 0, /**< First instance */
31 kDtRomCtrl = 0, /**< rom_ctrl */
33
34enum {
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 */
45 kDtRomCtrlRegBlockRegs = 0, /**< */
47
48enum {
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). */
54static 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 */
61typedef enum dt_rom_ctrl_memory {
62 kDtRomCtrlMemoryRom = 0, /**< */
64
65enum {
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 */
75typedef enum dt_rom_ctrl_clock {
76 kDtRomCtrlClockClk = 0, /**< Clock port clk_i */
78
79enum {
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 */
89typedef enum dt_rom_ctrl_reset {
90 kDtRomCtrlResetRst = 0, /**< Reset port rst_ni */
92
93enum {
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 */
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 */
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 */
135uint32_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 */
148static 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 */
161 dt_rom_ctrl_t dt,
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 */
172 dt_rom_ctrl_t dt,
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 */
186 dt_rom_ctrl_t dt,
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 */
197 dt_rom_ctrl_t dt,
199
200
201
202#ifdef __cplusplus
203} // extern "C"
204#endif // __cplusplus
205
206#endif // OPENTITAN_DT_ROM_CTRL_H_