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