Software APIs
dt_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/dt_api.h"
22#include <stdint.h>
23
24
25
26/**
27 * List of instances.
28 */
29typedef enum dt_sram_ctrl {
30 kDtSramCtrlMain = 0, /**< sram_ctrl_main */
31 kDtSramCtrlFirst = 0, /**< \internal First instance */
32 kDtSramCtrlCount = 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 kDtSramCtrlRegBlockRegs = 0, /**< */
42 kDtSramCtrlRegBlockCount = 1, /**< \internal Number of register blocks */
44
45/** Primary register block (associated with the "primary" set of registers that control the IP). */
46static const dt_sram_ctrl_reg_block_t kDtSramCtrlRegBlockPrimary = kDtSramCtrlRegBlockRegs;
47
48/**
49 * List of memories.
50 *
51 * Memories are guaranteed to start at 0 and to be consecutively numbered.
52 */
53typedef enum dt_sram_ctrl_memory {
54 kDtSramCtrlMemoryRam = 0, /**< */
55 kDtSramCtrlMemoryCount = 1, /**< \internal Number of memories */
57
58/**
59 * List of clock ports.
60 *
61 * Clock ports are guaranteed to be numbered consecutively from 0.
62 */
63typedef enum dt_sram_ctrl_clock {
64 kDtSramCtrlClockClk = 0, /**< Clock port clk_i */
65 kDtSramCtrlClockOtp = 1, /**< Clock port clk_otp_i */
66 kDtSramCtrlClockCount = 2, /**< \internal Number of clock ports */
68
69/**
70 * List of reset ports.
71 *
72 * Reset ports are guaranteed to be numbered consecutively from 0.
73 */
74typedef enum dt_sram_ctrl_reset {
75 kDtSramCtrlResetRst = 0, /**< Reset port rst_ni */
76 kDtSramCtrlResetOtp = 1, /**< Reset port rst_otp_ni */
77 kDtSramCtrlResetCount = 2, /**< \internal Number of reset ports */
79
80/**
81 * List of supported hardware features.
82 */
83#define OPENTITAN_SRAM_CTRL_HAS_INTEGRITY 1
84#define OPENTITAN_SRAM_CTRL_HAS_SCRAMBLED 1
85#define OPENTITAN_SRAM_CTRL_HAS_LOCK_ON_ERROR 1
86#define OPENTITAN_SRAM_CTRL_HAS_MEMSET 1
87#define OPENTITAN_SRAM_CTRL_HAS_FETCH_ALLOW 1
88#define OPENTITAN_SRAM_CTRL_HAS_SUBWORD_ACCESS 1
89#define OPENTITAN_SRAM_CTRL_HAS_REGWEN 1
90
91
92
93/**
94 * Get the sram_ctrl instance from an instance ID
95 *
96 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
97 *
98 * @param inst_id Instance ID.
99 * @return A sram_ctrl instance.
100 *
101 * **Note:** This function only makes sense if the instance ID has device type sram_ctrl,
102 * otherwise the returned value is unspecified.
103 */
105
106/**
107 * Get the instance ID of an instance.
108 *
109 * @param dt Instance of sram_ctrl.
110 * @return The instance ID of that instance.
111 */
113
114/**
115 * Get the register base address of an instance.
116 *
117 * @param dt Instance of sram_ctrl.
118 * @param reg_block The register block requested.
119 * @return The register base address of the requested block.
120 */
123 dt_sram_ctrl_reg_block_t reg_block);
124
125/**
126 * Get the primary register base address of an instance.
127 *
128 * This is just a convenience function, equivalent to
129 * `dt_sram_ctrl_reg_block(dt, kDtSramCtrlRegBlockRegs)`
130 *
131 * @param dt Instance of sram_ctrl.
132 * @return The register base address of the primary register block.
133 */
134static inline uint32_t dt_sram_ctrl_primary_reg_block(
135 dt_sram_ctrl_t dt) {
136 return dt_sram_ctrl_reg_block(dt, kDtSramCtrlRegBlockRegs);
137}
138
139/**
140 * Get the base address of a memory.
141 *
142 * @param dt Instance of sram_ctrl.
143 * @param mem The memory requested.
144 * @return The base address of the requested memory.
145 */
149
150/**
151 * Get the size of a memory.
152 *
153 * @param dt Instance of sram_ctrl.
154 * @param mem The memory requested.
155 * @return The size of the requested memory.
156 */
160
161
162
163
164/**
165 * Get the clock signal connected to a clock port of an instance.
166 *
167 * @param dt Instance of sram_ctrl.
168 * @param clk Clock port.
169 * @return Clock signal.
170 */
174
175/**
176 * Get the reset signal connected to a reset port of an instance.
177 *
178 * @param dt Instance of sram_ctrl.
179 * @param rst Reset port.
180 * @return Reset signal.
181 */
185
186
187
188#ifdef __cplusplus
189} // extern "C"
190#endif // __cplusplus
191
192#endif // OPENTITAN_DT_SRAM_CTRL_H_