Software APIs
keymgr_dpe.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_KEYMGR_DPE_H_
8
#define OPENTITAN_DT_KEYMGR_DPE_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP keymgr_dpe and top darjeeling.
17
*
18
* This file contains the type definitions and global functions of the keymgr_dpe.
19
*/
20
21
#include "hw/top/dt/api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_keymgr_dpe
{
30
kDtKeymgrDpeFirst
= 0,
/**< First instance */
31
kDtKeymgrDpe
= 0,
/**< keymgr_dpe */
32
}
dt_keymgr_dpe_t
;
33
34
enum
{
35
kDtKeymgrDpeCount
= 1,
/**< Number of instances */
36
};
37
38
39
/**
40
* List of register blocks.
41
*
42
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
43
*/
44
typedef
enum
dt_keymgr_dpe_reg_block
{
45
kDtKeymgrDpeRegBlockCore = 0,
/**< */
46
}
dt_keymgr_dpe_reg_block_t
;
47
48
enum
{
49
kDtKeymgrDpeRegBlockCount
= 1,
/**< Number of register blocks */
50
};
51
52
53
/** Primary register block (associated with the "primary" set of registers that control the IP). */
54
static
const
dt_keymgr_dpe_reg_block_t
kDtKeymgrDpeRegBlockPrimary = kDtKeymgrDpeRegBlockCore;
55
56
/**
57
* List of IRQs.
58
*
59
* IRQs are guaranteed to be numbered consecutively from 0.
60
*/
61
typedef
enum
dt_keymgr_dpe_irq
{
62
kDtKeymgrDpeIrqOpDone
= 0,
/**< Operation complete */
63
}
dt_keymgr_dpe_irq_t
;
64
65
enum
{
66
kDtKeymgrDpeIrqCount
= 1,
/**< Number of IRQs */
67
};
68
69
70
/**
71
* List of Alerts.
72
*
73
* Alerts are guaranteed to be numbered consecutively from 0.
74
*/
75
typedef
enum
dt_keymgr_dpe_alert
{
76
kDtKeymgrDpeAlertRecovOperationErr
= 0,
/**< Alert for key manager operation errors. These errors could have been caused by
77
software */
78
kDtKeymgrDpeAlertFatalFaultErr
= 1,
/**< Alert for key manager faults. These errors cannot be caused by software */
79
}
dt_keymgr_dpe_alert_t
;
80
81
enum
{
82
kDtKeymgrDpeAlertCount
= 2,
/**< Number of Alerts */
83
};
84
85
86
/**
87
* List of clock ports.
88
*
89
* Clock ports are guaranteed to be numbered consecutively from 0.
90
*/
91
typedef
enum
dt_keymgr_dpe_clock
{
92
kDtKeymgrDpeClockClk
= 0,
/**< Clock port clk_i */
93
kDtKeymgrDpeClockEdn
= 1,
/**< Clock port clk_edn_i */
94
}
dt_keymgr_dpe_clock_t
;
95
96
enum
{
97
kDtKeymgrDpeClockCount
= 2,
/**< Number of clock ports */
98
};
99
100
101
/**
102
* List of reset ports.
103
*
104
* Reset ports are guaranteed to be numbered consecutively from 0.
105
*/
106
typedef
enum
dt_keymgr_dpe_reset
{
107
kDtKeymgrDpeResetRst
= 0,
/**< Reset port rst_ni */
108
kDtKeymgrDpeResetEdn
= 1,
/**< Reset port rst_edn_ni */
109
}
dt_keymgr_dpe_reset_t
;
110
111
enum
{
112
kDtKeymgrDpeResetCount
= 2,
/**< Number of reset ports */
113
};
114
115
116
117
/**
118
* Get the keymgr_dpe instance from an instance ID
119
*
120
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
121
*
122
* @param inst_id Instance ID.
123
* @return A keymgr_dpe instance.
124
*
125
* **Note:** This function only makes sense if the instance ID has device type keymgr_dpe,
126
* otherwise the returned value is unspecified.
127
*/
128
dt_keymgr_dpe_t
dt_keymgr_dpe_from_instance_id
(
dt_instance_id_t
inst_id);
129
130
/**
131
* Get the instance ID of an instance.
132
*
133
* @param dt Instance of keymgr_dpe.
134
* @return The instance ID of that instance.
135
*/
136
dt_instance_id_t
dt_keymgr_dpe_instance_id
(
dt_keymgr_dpe_t
dt);
137
138
/**
139
* Get the register base address of an instance.
140
*
141
* @param dt Instance of keymgr_dpe.
142
* @param reg_block The register block requested.
143
* @return The register base address of the requested block.
144
*/
145
uint32_t
dt_keymgr_dpe_reg_block
(
146
dt_keymgr_dpe_t
dt,
147
dt_keymgr_dpe_reg_block_t
reg_block);
148
149
/**
150
* Get the primary register base address of an instance.
151
*
152
* This is just a convenience function, equivalent to
153
* `dt_keymgr_dpe_reg_block(dt, kDtKeymgrDpeRegBlockCore)`
154
*
155
* @param dt Instance of keymgr_dpe.
156
* @return The register base address of the primary register block.
157
*/
158
static
inline
uint32_t dt_keymgr_dpe_primary_reg_block(
159
dt_keymgr_dpe_t
dt) {
160
return
dt_keymgr_dpe_reg_block
(dt, kDtKeymgrDpeRegBlockCore);
161
}
162
163
/**
164
* Get the PLIC ID of a keymgr_dpe IRQ for a given instance.
165
*
166
* If the instance is not connected to the PLIC, this function
167
* will return `kDtPlicIrqIdNone`.
168
*
169
* @param dt Instance of keymgr_dpe.
170
* @param irq A keymgr_dpe IRQ.
171
* @return The PLIC ID of the IRQ of this instance.
172
*/
173
dt_plic_irq_id_t
dt_keymgr_dpe_irq_to_plic_id
(
174
dt_keymgr_dpe_t
dt,
175
dt_keymgr_dpe_irq_t
irq);
176
177
/**
178
* Convert a global IRQ ID to a local keymgr_dpe IRQ type.
179
*
180
* @param dt Instance of keymgr_dpe.
181
* @param irq A PLIC ID that belongs to this instance.
182
* @return The keymgr_dpe IRQ, or `kDtKeymgrDpeIrqCount`.
183
*
184
* **Note:** This function assumes that the PLIC ID belongs to the instance
185
* of keymgr_dpe passed in parameter. In other words, it must be the case that
186
* `dt_keymgr_dpe_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
187
* will return `kDtKeymgrDpeIrqCount`.
188
*/
189
dt_keymgr_dpe_irq_t
dt_keymgr_dpe_irq_from_plic_id
(
190
dt_keymgr_dpe_t
dt,
191
dt_plic_irq_id_t
irq);
192
193
194
/**
195
* Get the alert ID of a keymgr_dpe alert for a given instance.
196
*
197
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
198
* instances where the instance is not connected, the return value is unspecified.
199
*
200
* @param dt Instance of keymgr_dpe.
201
* @param alert A keymgr_dpe alert.
202
* @return The Alert Handler alert ID of the alert of this instance.
203
*/
204
dt_alert_id_t
dt_keymgr_dpe_alert_to_alert_id
(
205
dt_keymgr_dpe_t
dt,
206
dt_keymgr_dpe_alert_t
alert);
207
208
/**
209
* Convert a global alert ID to a local keymgr_dpe alert type.
210
*
211
* @param dt Instance of keymgr_dpe.
212
* @param alert A global alert ID that belongs to this instance.
213
* @return The keymgr_dpe alert, or `kDtKeymgrDpeAlertCount`.
214
*
215
* **Note:** This function assumes that the global alert ID belongs to the
216
* instance of keymgr_dpe passed in parameter. In other words, it must be the case
217
* that `dt_keymgr_dpe_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
218
* this function will return `kDtKeymgrDpeAlertCount`.
219
*/
220
dt_keymgr_dpe_alert_t
dt_keymgr_dpe_alert_from_alert_id
(
221
dt_keymgr_dpe_t
dt,
222
dt_alert_id_t
alert);
223
224
225
226
/**
227
* Get the clock signal connected to a clock port of an instance.
228
*
229
* @param dt Instance of keymgr_dpe.
230
* @param clk Clock port.
231
* @return Clock signal.
232
*/
233
dt_clock_t
dt_keymgr_dpe_clock
(
234
dt_keymgr_dpe_t
dt,
235
dt_keymgr_dpe_clock_t
clk);
236
237
/**
238
* Get the reset signal connected to a reset port of an instance.
239
*
240
* @param dt Instance of keymgr_dpe.
241
* @param rst Reset port.
242
* @return Reset signal.
243
*/
244
dt_reset_t
dt_keymgr_dpe_reset
(
245
dt_keymgr_dpe_t
dt,
246
dt_keymgr_dpe_reset_t
rst);
247
248
249
250
#ifdef __cplusplus
251
}
// extern "C"
252
#endif
// __cplusplus
253
254
#endif
// OPENTITAN_DT_KEYMGR_DPE_H_
(darjeeling)
hw
top
dt
keymgr_dpe.h
Return to
OpenTitan Documentation