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 "
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 Alerts.
51
*
52
* Alerts are guaranteed to be numbered consecutively from 0.
53
*/
54
typedef
enum
dt_lc_ctrl_alert
{
55
kDtLcCtrlAlertFatalProgError
= 0,
/**< This alert triggers if an error occurred during an OTP programming operation. */
56
kDtLcCtrlAlertFatalStateError
= 1,
/**< This alert triggers if an error in the life cycle state or life cycle controller FSM is detected. */
57
kDtLcCtrlAlertFatalBusIntegError
= 2,
/**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
58
kDtLcCtrlAlertCount = 3,
/**< \internal Number of Alerts */
59
}
dt_lc_ctrl_alert_t
;
60
61
/**
62
* List of clock ports.
63
*
64
* Clock ports are guaranteed to be numbered consecutively from 0.
65
*/
66
typedef
enum
dt_lc_ctrl_clock
{
67
kDtLcCtrlClockClk
= 0,
/**< Clock port clk_i */
68
kDtLcCtrlClockKmac
= 1,
/**< Clock port clk_kmac_i */
69
kDtLcCtrlClockCount = 2,
/**< \internal Number of clock ports */
70
}
dt_lc_ctrl_clock_t
;
71
72
/**
73
* List of reset ports.
74
*
75
* Reset ports are guaranteed to be numbered consecutively from 0.
76
*/
77
typedef
enum
dt_lc_ctrl_reset
{
78
kDtLcCtrlResetRst
= 0,
/**< Reset port rst_ni */
79
kDtLcCtrlResetKmac
= 1,
/**< Reset port rst_kmac_ni */
80
kDtLcCtrlResetCount = 2,
/**< \internal Number of reset ports */
81
}
dt_lc_ctrl_reset_t
;
82
83
/**
84
* List of supported hardware features.
85
*/
86
#define OPENTITAN_LC_CTRL_HAS_STATE_RAW 1
87
#define OPENTITAN_LC_CTRL_HAS_STATE_TEST_UNLOCKED 1
88
#define OPENTITAN_LC_CTRL_HAS_STATE_TEST_LOCKED 1
89
#define OPENTITAN_LC_CTRL_HAS_STATE_DEV 1
90
#define OPENTITAN_LC_CTRL_HAS_STATE_PROD 1
91
#define OPENTITAN_LC_CTRL_HAS_STATE_PROD_END 1
92
#define OPENTITAN_LC_CTRL_HAS_STATE_RMA 1
93
#define OPENTITAN_LC_CTRL_HAS_STATE_SCRAP 1
94
#define OPENTITAN_LC_CTRL_HAS_ACCESS_JTAG 1
95
#define OPENTITAN_LC_CTRL_HAS_ACCESS_EXT_CLK 1
96
#define OPENTITAN_LC_CTRL_HAS_AUTHENTICATED_TRANSITIONS 1
97
#define OPENTITAN_LC_CTRL_HAS_LOGICAL_SCRAP 1
98
99
100
101
/**
102
* Get the lc_ctrl instance from an instance ID
103
*
104
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
105
*
106
* @param inst_id Instance ID.
107
* @return A lc_ctrl instance.
108
*
109
* **Note:** This function only makes sense if the instance ID has device type lc_ctrl,
110
* otherwise the returned value is unspecified.
111
*/
112
dt_lc_ctrl_t
dt_lc_ctrl_from_instance_id
(
dt_instance_id_t
inst_id);
113
114
/**
115
* Get the instance ID of an instance.
116
*
117
* @param dt Instance of lc_ctrl.
118
* @return The instance ID of that instance.
119
*/
120
dt_instance_id_t
dt_lc_ctrl_instance_id
(
dt_lc_ctrl_t
dt);
121
122
/**
123
* Get the register base address of an instance.
124
*
125
* @param dt Instance of lc_ctrl.
126
* @param reg_block The register block requested.
127
* @return The register base address of the requested block.
128
*/
129
uint32_t
dt_lc_ctrl_reg_block
(
130
dt_lc_ctrl_t
dt,
131
dt_lc_ctrl_reg_block_t
reg_block);
132
133
/**
134
* Get the primary register base address of an instance.
135
*
136
* This is just a convenience function, equivalent to
137
* `dt_lc_ctrl_reg_block(dt, kDtLcCtrlRegBlockRegs)`
138
*
139
* @param dt Instance of lc_ctrl.
140
* @return The register base address of the primary register block.
141
*/
142
static
inline
uint32_t dt_lc_ctrl_primary_reg_block(
143
dt_lc_ctrl_t
dt) {
144
return
dt_lc_ctrl_reg_block
(dt, kDtLcCtrlRegBlockRegs);
145
}
146
147
148
/**
149
* Get the alert ID of a lc_ctrl alert for a given instance.
150
*
151
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
152
* instances where the instance is not connected, the return value is unspecified.
153
*
154
* @param dt Instance of lc_ctrl.
155
* @param alert A lc_ctrl alert.
156
* @return The Alert Handler alert ID of the alert of this instance.
157
*/
158
dt_alert_id_t
dt_lc_ctrl_alert_to_alert_id
(
159
dt_lc_ctrl_t
dt,
160
dt_lc_ctrl_alert_t
alert);
161
162
/**
163
* Convert a global alert ID to a local lc_ctrl alert type.
164
*
165
* @param dt Instance of lc_ctrl.
166
* @param alert A global alert ID that belongs to this instance.
167
* @return The lc_ctrl alert, or `kDtLcCtrlAlertCount`.
168
*
169
* **Note:** This function assumes that the global alert ID belongs to the
170
* instance of lc_ctrl passed in parameter. In other words, it must be the case
171
* that `dt_lc_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
172
* this function will return `kDtLcCtrlAlertCount`.
173
*/
174
dt_lc_ctrl_alert_t
dt_lc_ctrl_alert_from_alert_id
(
175
dt_lc_ctrl_t
dt,
176
dt_alert_id_t
alert);
177
178
179
180
/**
181
* Get the clock signal connected to a clock port of an instance.
182
*
183
* @param dt Instance of lc_ctrl.
184
* @param clk Clock port.
185
* @return Clock signal.
186
*/
187
dt_clock_t
dt_lc_ctrl_clock
(
188
dt_lc_ctrl_t
dt,
189
dt_lc_ctrl_clock_t
clk);
190
191
/**
192
* Get the reset signal connected to a reset port of an instance.
193
*
194
* @param dt Instance of lc_ctrl.
195
* @param rst Reset port.
196
* @return Reset signal.
197
*/
198
dt_reset_t
dt_lc_ctrl_reset
(
199
dt_lc_ctrl_t
dt,
200
dt_lc_ctrl_reset_t
rst);
201
202
203
204
#ifdef __cplusplus
205
}
// extern "C"
206
#endif
// __cplusplus
207
208
#endif
// OPENTITAN_DT_LC_CTRL_H_
(darjeeling)
hw
top
dt
dt_lc_ctrl.h
Return to
OpenTitan Documentation