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/**
11 * @file
12 * @brief Device Tables (DT) for IP sram_ctrl and top englishbreakfast.
13 *
14 * This file contains the type definitions and global functions of the sram_ctrl.
15 */
16
17#include "dt_api.h"
18#include <stdint.h>
19
20/**
21 * List of instances.
22 */
23typedef enum dt_sram_ctrl {
24 kDtSramCtrlMain = 0, /**< sram_ctrl_main */
25 kDtSramCtrlFirst = 0, /**< \internal First instance */
26 kDtSramCtrlCount = 1, /**< \internal Number of instances */
28
29/**
30 * List of register blocks.
31 *
32 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
33 */
35 kDtSramCtrlRegBlockRegs = 0, /**< */
36 kDtSramCtrlRegBlockRam = 1, /**< */
37 kDtSramCtrlRegBlockCount = 2, /**< \internal Number of register blocks */
39
40/** Primary register block (associated with the "primary" set of registers that control the IP). */
41static const dt_sram_ctrl_reg_block_t kDtSramCtrlRegBlockPrimary = kDtSramCtrlRegBlockRegs;
42
43/**
44 * List of clock ports.
45 *
46 * Clock ports are guaranteed to be numbered consecutively from 0.
47 */
48typedef enum dt_sram_ctrl_clock {
49 kDtSramCtrlClockClk = 0, /**< Clock port clk_i */
50 kDtSramCtrlClockOtp = 1, /**< Clock port clk_otp_i */
51 kDtSramCtrlClockCount = 2, /**< \internal Number of clock ports */
53
54/**
55 * List of reset ports.
56 *
57 * Reset ports are guaranteed to be numbered consecutively from 0.
58 */
59typedef enum dt_sram_ctrl_reset {
60 kDtSramCtrlResetRst = 0, /**< Reset port rst_ni */
61 kDtSramCtrlResetOtp = 1, /**< Reset port rst_otp_ni */
62 kDtSramCtrlResetCount = 2, /**< \internal Number of reset ports */
64
65/**
66 * List of supported hardware features.
67 */
68#define OPENTITAN_SRAM_CTRL_HAS_INTEGRITY 1
69#define OPENTITAN_SRAM_CTRL_HAS_SCRAMBLED 1
70#define OPENTITAN_SRAM_CTRL_HAS_LOCK_ON_ERROR 1
71#define OPENTITAN_SRAM_CTRL_HAS_MEMSET 1
72#define OPENTITAN_SRAM_CTRL_HAS_FETCH_ALLOW 1
73#define OPENTITAN_SRAM_CTRL_HAS_SUBWORD_ACCESS 1
74#define OPENTITAN_SRAM_CTRL_HAS_REGWEN 1
75
76
77
78/**
79 * Get the sram_ctrl instance from an instance ID
80 *
81 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
82 *
83 * @param inst_id Instance ID.
84 * @return A sram_ctrl instance.
85 *
86 * **Note:** This function only makes sense if the instance ID has device type sram_ctrl,
87 * otherwise the returned value is unspecified.
88 */
90
91/**
92 * Get the instance ID of an instance.
93 *
94 * @param dt Instance of sram_ctrl.
95 * @return The instance ID of that instance.
96 */
98
99/**
100 * Get the register base address of an instance.
101 *
102 * @param dt Instance of sram_ctrl.
103 * @param reg_block The register block requested.
104 * @return The register base address of the requested block.
105 */
108 dt_sram_ctrl_reg_block_t reg_block);
109
110/**
111 * Get the primary register base address of an instance.
112 *
113 * This is just a convenience function, equivalent to
114 * `dt_sram_ctrl_reg_block(dt, kDtSramCtrlRegBlockRegs)`
115 *
116 * @param dt Instance of sram_ctrl.
117 * @return The register base address of the primary register block.
118 */
119static inline uint32_t dt_sram_ctrl_primary_reg_block(
120 dt_sram_ctrl_t dt) {
121 return dt_sram_ctrl_reg_block(dt, kDtSramCtrlRegBlockRegs);
122}
123
124
125
126
127/**
128 * Get the clock signal connected to a clock port of an instance.
129 *
130 * @param dt Instance of sram_ctrl.
131 * @param clk Clock port.
132 * @return Clock signal.
133 */
137
138/**
139 * Get the reset signal connected to a reset port of an instance.
140 *
141 * @param dt Instance of sram_ctrl.
142 * @param rst Reset port.
143 * @return Reset signal.
144 */
148
149
150
151#endif // OPENTITAN_DT_SRAM_CTRL_H_