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