Software APIs
dt_lc_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_LC_CTRL_H_
8
#define OPENTITAN_DT_LC_CTRL_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP lc_ctrl and top darjeeling.
17
*
18
* This file contains the type definitions and global functions of the lc_ctrl.
19
*/
20
21
#include "hw/top/dt/dt_api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_lc_ctrl
{
30
kDtLcCtrl
= 0,
/**< lc_ctrl */
31
kDtLcCtrlFirst = 0,
/**< \internal First instance */
32
kDtLcCtrlCount = 1,
/**< \internal Number of instances */
33
}
dt_lc_ctrl_t
;
34
35
/**
36
* List of register blocks.
37
*
38
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
39
*/
40
typedef
enum
dt_lc_ctrl_reg_block
{
41
kDtLcCtrlRegBlockRegs = 0,
/**< */
42
kDtLcCtrlRegBlockDmi = 1,
/**< */
43
kDtLcCtrlRegBlockCount = 2,
/**< \internal Number of register blocks */
44
}
dt_lc_ctrl_reg_block_t
;
45
46
/** Primary register block (associated with the "primary" set of registers that control the IP). */
47
static
const
dt_lc_ctrl_reg_block_t
kDtLcCtrlRegBlockPrimary = kDtLcCtrlRegBlockRegs;
48
49
/**
50
* List of memories.
51
*
52
* Memories are guaranteed to start at 0 and to be consecutively numbered.
53
*/
54
typedef
enum
dt_lc_ctrl_memory
{
55
kDtLcCtrlMemoryCount = 0,
/**< \internal Number of memories */
56
}
dt_lc_ctrl_memory_t
;
57
58
/**
59
* List of Alerts.
60
*
61
* Alerts are guaranteed to be numbered consecutively from 0.
62
*/
63
typedef
enum
dt_lc_ctrl_alert
{
64
kDtLcCtrlAlertFatalProgError
= 0,
/**< This alert triggers if an error occurred during an OTP programming operation. */
65
kDtLcCtrlAlertFatalStateError
= 1,
/**< This alert triggers if an error in the life cycle state or life cycle controller FSM is detected. */
66
kDtLcCtrlAlertFatalBusIntegError
= 2,
/**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
67
kDtLcCtrlAlertCount = 3,
/**< \internal Number of Alerts */
68
}
dt_lc_ctrl_alert_t
;
69
70
/**
71
* List of clock ports.
72
*
73
* Clock ports are guaranteed to be numbered consecutively from 0.
74
*/
75
typedef
enum
dt_lc_ctrl_clock
{
76
kDtLcCtrlClockClk
= 0,
/**< Clock port clk_i */
77
kDtLcCtrlClockKmac
= 1,
/**< Clock port clk_kmac_i */
78
kDtLcCtrlClockCount = 2,
/**< \internal Number of clock ports */
79
}
dt_lc_ctrl_clock_t
;
80
81
/**
82
* List of reset ports.
83
*
84
* Reset ports are guaranteed to be numbered consecutively from 0.
85
*/
86
typedef
enum
dt_lc_ctrl_reset
{
87
kDtLcCtrlResetRst
= 0,
/**< Reset port rst_ni */
88
kDtLcCtrlResetKmac
= 1,
/**< Reset port rst_kmac_ni */
89
kDtLcCtrlResetCount = 2,
/**< \internal Number of reset ports */
90
}
dt_lc_ctrl_reset_t
;
91
92
/**
93
* List of supported hardware features.
94
*/
95
#define OPENTITAN_LC_CTRL_HAS_STATE_RAW 1
96
#define OPENTITAN_LC_CTRL_HAS_STATE_TEST_UNLOCKED 1
97
#define OPENTITAN_LC_CTRL_HAS_STATE_TEST_LOCKED 1
98
#define OPENTITAN_LC_CTRL_HAS_STATE_DEV 1
99
#define OPENTITAN_LC_CTRL_HAS_STATE_PROD 1
100
#define OPENTITAN_LC_CTRL_HAS_STATE_PROD_END 1
101
#define OPENTITAN_LC_CTRL_HAS_STATE_RMA 1
102
#define OPENTITAN_LC_CTRL_HAS_STATE_SCRAP 1
103
#define OPENTITAN_LC_CTRL_HAS_ACCESS_JTAG 1
104
#define OPENTITAN_LC_CTRL_HAS_ACCESS_EXT_CLK 1
105
#define OPENTITAN_LC_CTRL_HAS_AUTHENTICATED_TRANSITIONS 1
106
#define OPENTITAN_LC_CTRL_HAS_LOGICAL_SCRAP 1
107
108
109
110
/**
111
* Get the lc_ctrl instance from an instance ID
112
*
113
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
114
*
115
* @param inst_id Instance ID.
116
* @return A lc_ctrl instance.
117
*
118
* **Note:** This function only makes sense if the instance ID has device type lc_ctrl,
119
* otherwise the returned value is unspecified.
120
*/
121
dt_lc_ctrl_t
dt_lc_ctrl_from_instance_id
(
dt_instance_id_t
inst_id);
122
123
/**
124
* Get the instance ID of an instance.
125
*
126
* @param dt Instance of lc_ctrl.
127
* @return The instance ID of that instance.
128
*/
129
dt_instance_id_t
dt_lc_ctrl_instance_id
(
dt_lc_ctrl_t
dt);
130
131
/**
132
* Get the register base address of an instance.
133
*
134
* @param dt Instance of lc_ctrl.
135
* @param reg_block The register block requested.
136
* @return The register base address of the requested block.
137
*/
138
uint32_t
dt_lc_ctrl_reg_block
(
139
dt_lc_ctrl_t
dt,
140
dt_lc_ctrl_reg_block_t
reg_block);
141
142
/**
143
* Get the primary register base address of an instance.
144
*
145
* This is just a convenience function, equivalent to
146
* `dt_lc_ctrl_reg_block(dt, kDtLcCtrlRegBlockRegs)`
147
*
148
* @param dt Instance of lc_ctrl.
149
* @return The register base address of the primary register block.
150
*/
151
static
inline
uint32_t dt_lc_ctrl_primary_reg_block(
152
dt_lc_ctrl_t
dt) {
153
return
dt_lc_ctrl_reg_block
(dt, kDtLcCtrlRegBlockRegs);
154
}
155
156
/**
157
* Get the base address of a memory.
158
*
159
* @param dt Instance of lc_ctrl.
160
* @param mem The memory requested.
161
* @return The base address of the requested memory.
162
*/
163
uint32_t
dt_lc_ctrl_memory_base
(
164
dt_lc_ctrl_t
dt,
165
dt_lc_ctrl_memory_t
mem);
166
167
/**
168
* Get the size of a memory.
169
*
170
* @param dt Instance of lc_ctrl.
171
* @param mem The memory requested.
172
* @return The size of the requested memory.
173
*/
174
uint32_t
dt_lc_ctrl_memory_size
(
175
dt_lc_ctrl_t
dt,
176
dt_lc_ctrl_memory_t
mem);
177
178
179
/**
180
* Get the alert ID of a lc_ctrl alert for a given instance.
181
*
182
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
183
* instances where the instance is not connected, the return value is unspecified.
184
*
185
* @param dt Instance of lc_ctrl.
186
* @param alert A lc_ctrl alert.
187
* @return The Alert Handler alert ID of the alert of this instance.
188
*/
189
dt_alert_id_t
dt_lc_ctrl_alert_to_alert_id
(
190
dt_lc_ctrl_t
dt,
191
dt_lc_ctrl_alert_t
alert);
192
193
/**
194
* Convert a global alert ID to a local lc_ctrl alert type.
195
*
196
* @param dt Instance of lc_ctrl.
197
* @param alert A global alert ID that belongs to this instance.
198
* @return The lc_ctrl alert, or `kDtLcCtrlAlertCount`.
199
*
200
* **Note:** This function assumes that the global alert ID belongs to the
201
* instance of lc_ctrl passed in parameter. In other words, it must be the case
202
* that `dt_lc_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
203
* this function will return `kDtLcCtrlAlertCount`.
204
*/
205
dt_lc_ctrl_alert_t
dt_lc_ctrl_alert_from_alert_id
(
206
dt_lc_ctrl_t
dt,
207
dt_alert_id_t
alert);
208
209
210
211
/**
212
* Get the clock signal connected to a clock port of an instance.
213
*
214
* @param dt Instance of lc_ctrl.
215
* @param clk Clock port.
216
* @return Clock signal.
217
*/
218
dt_clock_t
dt_lc_ctrl_clock
(
219
dt_lc_ctrl_t
dt,
220
dt_lc_ctrl_clock_t
clk);
221
222
/**
223
* Get the reset signal connected to a reset port of an instance.
224
*
225
* @param dt Instance of lc_ctrl.
226
* @param rst Reset port.
227
* @return Reset signal.
228
*/
229
dt_reset_t
dt_lc_ctrl_reset
(
230
dt_lc_ctrl_t
dt,
231
dt_lc_ctrl_reset_t
rst);
232
233
234
235
#ifdef __cplusplus
236
}
// extern "C"
237
#endif
// __cplusplus
238
239
#endif
// OPENTITAN_DT_LC_CTRL_H_
(darjeeling)
hw
top
dt
dt_lc_ctrl.h
Return to
OpenTitan Documentation