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