Software APIs
sram_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_SRAM_CTRL_H_
8#define OPENTITAN_DT_SRAM_CTRL_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP sram_ctrl and top englishbreakfast.
17 *
18 * This file contains the type definitions and global functions of the sram_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_sram_ctrl {
30 kDtSramCtrlFirst = 0, /**< First instance */
31 kDtSramCtrlMain = 0, /**< sram_ctrl_main */
33
34enum {
35 kDtSramCtrlCount = 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 kDtSramCtrlRegBlockRegs = 0, /**< */
47
48enum {
49 kDtSramCtrlRegBlockCount = 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_sram_ctrl_reg_block_t kDtSramCtrlRegBlockPrimary = kDtSramCtrlRegBlockRegs;
55
56/**
57 * List of memories.
58 *
59 * Memories are guaranteed to start at 0 and to be consecutively numbered.
60 */
61typedef enum dt_sram_ctrl_memory {
62 kDtSramCtrlMemoryRam = 0, /**< */
64
65enum {
66 kDtSramCtrlMemoryCount = 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_sram_ctrl_clock {
76 kDtSramCtrlClockClk = 0, /**< Clock port clk_i */
77 kDtSramCtrlClockOtp = 1, /**< Clock port clk_otp_i */
79
80enum {
81 kDtSramCtrlClockCount = 2, /**< Number of clock ports */
82};
83
84
85/**
86 * List of reset ports.
87 *
88 * Reset ports are guaranteed to be numbered consecutively from 0.
89 */
90typedef enum dt_sram_ctrl_reset {
91 kDtSramCtrlResetRst = 0, /**< Reset port rst_ni */
92 kDtSramCtrlResetOtp = 1, /**< Reset port rst_otp_ni */
94
95enum {
96 kDtSramCtrlResetCount = 2, /**< Number of reset ports */
97};
98
99
100/**
101 * List of supported hardware features.
102 */
103#define OPENTITAN_SRAM_CTRL_HAS_INTEGRITY 1
104#define OPENTITAN_SRAM_CTRL_HAS_SCRAMBLED 1
105#define OPENTITAN_SRAM_CTRL_HAS_LOCK_ON_ERROR 1
106#define OPENTITAN_SRAM_CTRL_HAS_MEMSET 1
107#define OPENTITAN_SRAM_CTRL_HAS_FETCH_ALLOW 1
108#define OPENTITAN_SRAM_CTRL_HAS_SUBWORD_ACCESS 1
109#define OPENTITAN_SRAM_CTRL_HAS_REGWEN 1
110
111
112
113/**
114 * Get the sram_ctrl instance from an instance ID
115 *
116 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
117 *
118 * @param inst_id Instance ID.
119 * @return A sram_ctrl instance.
120 *
121 * **Note:** This function only makes sense if the instance ID has device type sram_ctrl,
122 * otherwise the returned value is unspecified.
123 */
125
126/**
127 * Get the instance ID of an instance.
128 *
129 * @param dt Instance of sram_ctrl.
130 * @return The instance ID of that instance.
131 */
133
134/**
135 * Get the register base address of an instance.
136 *
137 * @param dt Instance of sram_ctrl.
138 * @param reg_block The register block requested.
139 * @return The register base address of the requested block.
140 */
143 dt_sram_ctrl_reg_block_t reg_block);
144
145/**
146 * Get the primary register base address of an instance.
147 *
148 * This is just a convenience function, equivalent to
149 * `dt_sram_ctrl_reg_block(dt, kDtSramCtrlRegBlockRegs)`
150 *
151 * @param dt Instance of sram_ctrl.
152 * @return The register base address of the primary register block.
153 */
154static inline uint32_t dt_sram_ctrl_primary_reg_block(
155 dt_sram_ctrl_t dt) {
156 return dt_sram_ctrl_reg_block(dt, kDtSramCtrlRegBlockRegs);
157}
158
159/**
160 * Get the base address of a memory.
161 *
162 * @param dt Instance of sram_ctrl.
163 * @param mem The memory requested.
164 * @return The base address of the requested memory.
165 */
169
170/**
171 * Get the size of a memory.
172 *
173 * @param dt Instance of sram_ctrl.
174 * @param mem The memory requested.
175 * @return The size of the requested memory.
176 */
180
181
182
183
184/**
185 * Get the clock signal connected to a clock port of an instance.
186 *
187 * @param dt Instance of sram_ctrl.
188 * @param clk Clock port.
189 * @return Clock signal.
190 */
194
195/**
196 * Get the reset signal connected to a reset port of an instance.
197 *
198 * @param dt Instance of sram_ctrl.
199 * @param rst Reset port.
200 * @return Reset signal.
201 */
205
206
207
208#ifdef __cplusplus
209} // extern "C"
210#endif // __cplusplus
211
212#endif // OPENTITAN_DT_SRAM_CTRL_H_