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