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 darjeeling.
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
*/
23
typedef
enum
dt_sram_ctrl
{
24
kDtSramCtrlRetAon
= 0,
/**< sram_ctrl_ret_aon */
25
kDtSramCtrlMain
= 1,
/**< sram_ctrl_main */
26
kDtSramCtrlMbox
= 2,
/**< sram_ctrl_mbox */
27
kDtSramCtrlFirst = 0,
/**< \internal First instance */
28
kDtSramCtrlCount = 3,
/**< \internal Number of instances */
29
}
dt_sram_ctrl_t
;
30
31
/**
32
* List of register blocks.
33
*
34
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
35
*/
36
typedef
enum
dt_sram_ctrl_reg_block
{
37
kDtSramCtrlRegBlockRegs = 0,
/**< */
38
kDtSramCtrlRegBlockRam = 1,
/**< */
39
kDtSramCtrlRegBlockCount = 2,
/**< \internal Number of register blocks */
40
}
dt_sram_ctrl_reg_block_t
;
41
42
/** Primary register block (associated with the "primary" set of registers that control the IP). */
43
static
const
dt_sram_ctrl_reg_block_t
kDtSramCtrlRegBlockPrimary = kDtSramCtrlRegBlockRegs;
44
45
/**
46
* List of Alerts.
47
*
48
* Alerts are guaranteed to be numbered consecutively from 0.
49
*/
50
typedef
enum
dt_sram_ctrl_alert
{
51
kDtSramCtrlAlertFatalError
= 0,
/**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected,
52
or if the initialization mechanism has reached an invalid state. */
53
kDtSramCtrlAlertCount = 1,
/**< \internal Number of Alerts */
54
}
dt_sram_ctrl_alert_t
;
55
56
/**
57
* List of clock ports.
58
*
59
* Clock ports are guaranteed to be numbered consecutively from 0.
60
*/
61
typedef
enum
dt_sram_ctrl_clock
{
62
kDtSramCtrlClockClk
= 0,
/**< Clock port clk_i */
63
kDtSramCtrlClockOtp
= 1,
/**< Clock port clk_otp_i */
64
kDtSramCtrlClockCount = 2,
/**< \internal Number of clock ports */
65
}
dt_sram_ctrl_clock_t
;
66
67
/**
68
* List of reset ports.
69
*
70
* Reset ports are guaranteed to be numbered consecutively from 0.
71
*/
72
typedef
enum
dt_sram_ctrl_reset
{
73
kDtSramCtrlResetRst
= 0,
/**< Reset port rst_ni */
74
kDtSramCtrlResetOtp
= 1,
/**< Reset port rst_otp_ni */
75
kDtSramCtrlResetCount = 2,
/**< \internal Number of reset ports */
76
}
dt_sram_ctrl_reset_t
;
77
78
/**
79
* List of supported hardware features.
80
*/
81
#define OPENTITAN_SRAM_CTRL_HAS_INTEGRITY 1
82
#define OPENTITAN_SRAM_CTRL_HAS_SCRAMBLED 1
83
#define OPENTITAN_SRAM_CTRL_HAS_LOCK_ON_ERROR 1
84
#define OPENTITAN_SRAM_CTRL_HAS_MEMSET 1
85
#define OPENTITAN_SRAM_CTRL_HAS_FETCH_ALLOW 1
86
#define OPENTITAN_SRAM_CTRL_HAS_SUBWORD_ACCESS 1
87
#define OPENTITAN_SRAM_CTRL_HAS_REGWEN 1
88
89
90
91
/**
92
* Get the sram_ctrl instance from an instance ID
93
*
94
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
95
*
96
* @param inst_id Instance ID.
97
* @return A sram_ctrl instance.
98
*
99
* **Note:** This function only makes sense if the instance ID has device type sram_ctrl,
100
* otherwise the returned value is unspecified.
101
*/
102
dt_sram_ctrl_t
dt_sram_ctrl_from_instance_id
(
dt_instance_id_t
inst_id);
103
104
/**
105
* Get the instance ID of an instance.
106
*
107
* @param dt Instance of sram_ctrl.
108
* @return The instance ID of that instance.
109
*/
110
dt_instance_id_t
dt_sram_ctrl_instance_id
(
dt_sram_ctrl_t
dt);
111
112
/**
113
* Get the register base address of an instance.
114
*
115
* @param dt Instance of sram_ctrl.
116
* @param reg_block The register block requested.
117
* @return The register base address of the requested block.
118
*/
119
uint32_t
dt_sram_ctrl_reg_block
(
120
dt_sram_ctrl_t
dt,
121
dt_sram_ctrl_reg_block_t
reg_block);
122
123
/**
124
* Get the primary register base address of an instance.
125
*
126
* This is just a convenience function, equivalent to
127
* `dt_sram_ctrl_reg_block(dt, kDtSramCtrlRegBlockRegs)`
128
*
129
* @param dt Instance of sram_ctrl.
130
* @return The register base address of the primary register block.
131
*/
132
static
inline
uint32_t dt_sram_ctrl_primary_reg_block(
133
dt_sram_ctrl_t
dt) {
134
return
dt_sram_ctrl_reg_block
(dt, kDtSramCtrlRegBlockRegs);
135
}
136
137
138
/**
139
* Get the alert ID of a sram_ctrl alert for a given instance.
140
*
141
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
142
* instances where the instance is not connected, the return value is unspecified.
143
*
144
* @param dt Instance of sram_ctrl.
145
* @param alert A sram_ctrl alert.
146
* @return The Alert Handler alert ID of the alert of this instance.
147
*/
148
dt_alert_id_t
dt_sram_ctrl_alert_to_alert_id
(
149
dt_sram_ctrl_t
dt,
150
dt_sram_ctrl_alert_t
alert);
151
152
/**
153
* Convert a global alert ID to a local sram_ctrl alert type.
154
*
155
* @param dt Instance of sram_ctrl.
156
* @param alert A global alert ID that belongs to this instance.
157
* @return The sram_ctrl alert, or `kDtSramCtrlAlertCount`.
158
*
159
* **Note:** This function assumes that the global alert ID belongs to the
160
* instance of sram_ctrl passed in parameter. In other words, it must be the case
161
* that `dt_sram_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
162
* this function will return `kDtSramCtrlAlertCount`.
163
*/
164
dt_sram_ctrl_alert_t
dt_sram_ctrl_alert_from_alert_id
(
165
dt_sram_ctrl_t
dt,
166
dt_alert_id_t
alert);
167
168
169
170
/**
171
* Get the clock signal connected to a clock port of an instance.
172
*
173
* @param dt Instance of sram_ctrl.
174
* @param clk Clock port.
175
* @return Clock signal.
176
*/
177
dt_clock_t
dt_sram_ctrl_clock
(
178
dt_sram_ctrl_t
dt,
179
dt_sram_ctrl_clock_t
clk);
180
181
/**
182
* Get the reset signal connected to a reset port of an instance.
183
*
184
* @param dt Instance of sram_ctrl.
185
* @param rst Reset port.
186
* @return Reset signal.
187
*/
188
dt_reset_t
dt_sram_ctrl_reset
(
189
dt_sram_ctrl_t
dt,
190
dt_sram_ctrl_reset_t
rst);
191
192
193
194
#endif
// OPENTITAN_DT_SRAM_CTRL_H_
(darjeeling)
hw
top
dt
dt_sram_ctrl.h
Return to
OpenTitan Documentation