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