Software APIs
sw
device
lib
dif
autogen
dif_keymgr_dpe_autogen.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
#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_KEYMGR_DPE_AUTOGEN_H_
6
#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_KEYMGR_DPE_AUTOGEN_H_
7
8
// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
9
// util/make_new_dif.py --mode=regen --only=autogen
10
11
/**
12
* @file
13
* @brief <a href="/book/hw/ip/keymgr_dpe/">KEYMGR_DPE</a> Device Interface
14
* Functions
15
*/
16
17
#include <
stdbool.h
>
18
#include <
stdint.h
>
19
20
#include "
sw/device/lib/base/macros.h
"
21
#include "
sw/device/lib/base/mmio.h
"
22
#include "
sw/device/lib/dif/dif_base.h
"
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
// __cplusplus
27
28
/**
29
* A handle to keymgr_dpe.
30
*
31
* This type should be treated as opaque by users.
32
*/
33
typedef
struct
dif_keymgr_dpe
{
34
/**
35
* The base address for the keymgr_dpe hardware registers.
36
*/
37
mmio_region_t
base_addr
;
38
}
dif_keymgr_dpe_t
;
39
40
/**
41
* Creates a new handle for a(n) keymgr_dpe peripheral.
42
*
43
* This function does not actuate the hardware.
44
*
45
* @param base_addr The MMIO base address of the keymgr_dpe peripheral.
46
* @param[out] keymgr_dpe Out param for the initialized handle.
47
* @return The result of the operation.
48
*/
49
OT_WARN_UNUSED_RESULT
50
dif_result_t
dif_keymgr_dpe_init
(
mmio_region_t
base_addr,
51
dif_keymgr_dpe_t
*keymgr_dpe);
52
53
/**
54
* A keymgr_dpe alert type.
55
*/
56
typedef
enum
dif_keymgr_dpe_alert
{
57
/**
58
* Alert for key manager operation errors. These errors could have been
59
* caused by software
60
*/
61
kDifKeymgrDpeAlertRecovOperationErr
= 0,
62
/**
63
* Alert for key manager faults. These errors cannot be caused by software
64
*/
65
kDifKeymgrDpeAlertFatalFaultErr
= 1,
66
}
dif_keymgr_dpe_alert_t
;
67
68
/**
69
* Forces a particular alert, causing it to be escalated as if the hardware
70
* had raised it.
71
*
72
* @param keymgr_dpe A keymgr_dpe handle.
73
* @param alert The alert to force.
74
* @return The result of the operation.
75
*/
76
OT_WARN_UNUSED_RESULT
77
dif_result_t
dif_keymgr_dpe_alert_force
(
const
dif_keymgr_dpe_t
*keymgr_dpe,
78
dif_keymgr_dpe_alert_t
alert);
79
80
/**
81
* A keymgr_dpe interrupt request type.
82
*/
83
typedef
enum
dif_keymgr_dpe_irq
{
84
/**
85
* Operation complete
86
*/
87
kDifKeymgrDpeIrqOpDone
= 0,
88
}
dif_keymgr_dpe_irq_t
;
89
90
/**
91
* A snapshot of the state of the interrupts for this IP.
92
*
93
* This is an opaque type, to be used with the `dif_keymgr_dpe_irq_get_state()`
94
* and `dif_keymgr_dpe_irq_acknowledge_state()` functions.
95
*/
96
typedef
uint32_t
dif_keymgr_dpe_irq_state_snapshot_t
;
97
98
/**
99
* Returns the type of a given interrupt (i.e., event or status) for this IP.
100
*
101
* @param keymgr_dpe A keymgr_dpe handle.
102
* @param irq An interrupt request.
103
* @param[out] type Out-param for the interrupt type.
104
* @return The result of the operation.
105
*/
106
OT_WARN_UNUSED_RESULT
107
dif_result_t
dif_keymgr_dpe_irq_get_type
(
const
dif_keymgr_dpe_t
*keymgr_dpe,
108
dif_keymgr_dpe_irq_t
irq,
109
dif_irq_type_t
*type);
110
111
/**
112
* Returns the state of all interrupts (i.e., pending or not) for this IP.
113
*
114
* @param keymgr_dpe A keymgr_dpe handle.
115
* @param[out] snapshot Out-param for interrupt state snapshot.
116
* @return The result of the operation.
117
*/
118
OT_WARN_UNUSED_RESULT
119
dif_result_t
dif_keymgr_dpe_irq_get_state
(
120
const
dif_keymgr_dpe_t
*keymgr_dpe,
121
dif_keymgr_dpe_irq_state_snapshot_t
*snapshot);
122
123
/**
124
* Returns whether a particular interrupt is currently pending.
125
*
126
* @param keymgr_dpe A keymgr_dpe handle.
127
* @param irq An interrupt request.
128
* @param[out] is_pending Out-param for whether the interrupt is pending.
129
* @return The result of the operation.
130
*/
131
OT_WARN_UNUSED_RESULT
132
dif_result_t
dif_keymgr_dpe_irq_is_pending
(
const
dif_keymgr_dpe_t
*keymgr_dpe,
133
dif_keymgr_dpe_irq_t
irq,
134
bool
*is_pending);
135
136
/**
137
* Acknowledges all interrupts that were pending at the time of the state
138
* snapshot.
139
*
140
* @param keymgr_dpe A keymgr_dpe handle.
141
* @param snapshot Interrupt state snapshot.
142
* @return The result of the operation.
143
*/
144
OT_WARN_UNUSED_RESULT
145
dif_result_t
dif_keymgr_dpe_irq_acknowledge_state
(
146
const
dif_keymgr_dpe_t
*keymgr_dpe,
147
dif_keymgr_dpe_irq_state_snapshot_t
snapshot);
148
149
/**
150
* Acknowledges all interrupts, indicating to the hardware that all
151
* interrupts have been successfully serviced.
152
*
153
* @param keymgr_dpe A keymgr_dpe handle.
154
* @return The result of the operation.
155
*/
156
OT_WARN_UNUSED_RESULT
157
dif_result_t
dif_keymgr_dpe_irq_acknowledge_all
(
158
const
dif_keymgr_dpe_t
*keymgr_dpe);
159
160
/**
161
* Acknowledges a particular interrupt, indicating to the hardware that it has
162
* been successfully serviced.
163
*
164
* @param keymgr_dpe A keymgr_dpe handle.
165
* @param irq An interrupt request.
166
* @return The result of the operation.
167
*/
168
OT_WARN_UNUSED_RESULT
169
dif_result_t
dif_keymgr_dpe_irq_acknowledge
(
const
dif_keymgr_dpe_t
*keymgr_dpe,
170
dif_keymgr_dpe_irq_t
irq);
171
172
/**
173
* Forces a particular interrupt, causing it to be serviced as if hardware had
174
* asserted it.
175
*
176
* @param keymgr_dpe A keymgr_dpe handle.
177
* @param irq An interrupt request.
178
* @param val Value to be set.
179
* @return The result of the operation.
180
*/
181
OT_WARN_UNUSED_RESULT
182
dif_result_t
dif_keymgr_dpe_irq_force
(
const
dif_keymgr_dpe_t
*keymgr_dpe,
183
dif_keymgr_dpe_irq_t
irq,
const
bool
val);
184
185
/**
186
* A snapshot of the enablement state of the interrupts for this IP.
187
*
188
* This is an opaque type, to be used with the
189
* `dif_keymgr_dpe_irq_disable_all()` and `dif_keymgr_dpe_irq_restore_all()`
190
* functions.
191
*/
192
typedef
uint32_t
dif_keymgr_dpe_irq_enable_snapshot_t
;
193
194
/**
195
* Checks whether a particular interrupt is currently enabled or disabled.
196
*
197
* @param keymgr_dpe A keymgr_dpe handle.
198
* @param irq An interrupt request.
199
* @param[out] state Out-param toggle state of the interrupt.
200
* @return The result of the operation.
201
*/
202
OT_WARN_UNUSED_RESULT
203
dif_result_t
dif_keymgr_dpe_irq_get_enabled
(
const
dif_keymgr_dpe_t
*keymgr_dpe,
204
dif_keymgr_dpe_irq_t
irq,
205
dif_toggle_t
*state);
206
207
/**
208
* Sets whether a particular interrupt is currently enabled or disabled.
209
*
210
* @param keymgr_dpe A keymgr_dpe handle.
211
* @param irq An interrupt request.
212
* @param state The new toggle state for the interrupt.
213
* @return The result of the operation.
214
*/
215
OT_WARN_UNUSED_RESULT
216
dif_result_t
dif_keymgr_dpe_irq_set_enabled
(
const
dif_keymgr_dpe_t
*keymgr_dpe,
217
dif_keymgr_dpe_irq_t
irq,
218
dif_toggle_t
state);
219
220
/**
221
* Disables all interrupts, optionally snapshotting all enable states for later
222
* restoration.
223
*
224
* @param keymgr_dpe A keymgr_dpe handle.
225
* @param[out] snapshot Out-param for the snapshot; may be `NULL`.
226
* @return The result of the operation.
227
*/
228
OT_WARN_UNUSED_RESULT
229
dif_result_t
dif_keymgr_dpe_irq_disable_all
(
230
const
dif_keymgr_dpe_t
*keymgr_dpe,
231
dif_keymgr_dpe_irq_enable_snapshot_t
*snapshot);
232
233
/**
234
* Restores interrupts from the given (enable) snapshot.
235
*
236
* @param keymgr_dpe A keymgr_dpe handle.
237
* @param snapshot A snapshot to restore from.
238
* @return The result of the operation.
239
*/
240
OT_WARN_UNUSED_RESULT
241
dif_result_t
dif_keymgr_dpe_irq_restore_all
(
242
const
dif_keymgr_dpe_t
*keymgr_dpe,
243
const
dif_keymgr_dpe_irq_enable_snapshot_t
*snapshot);
244
245
#ifdef __cplusplus
246
}
// extern "C"
247
#endif
// __cplusplus
248
249
#endif
// OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_KEYMGR_DPE_AUTOGEN_H_
Return to
OpenTitan Documentation