Software APIs
sw
device
lib
dif
autogen
dif_aes_autogen.c
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
// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
6
// util/make_new_dif.py --mode=regen --only=autogen
7
8
#include "
sw/device/lib/dif/autogen/dif_aes_autogen.h
"
9
10
#include <
stdint.h
>
11
12
#include "
sw/device/lib/dif/dif_base.h
"
13
14
#include "aes_regs.h"
// Generated.
15
16
OT_WARN_UNUSED_RESULT
17
dif_result_t
dif_aes_init
(
mmio_region_t
base_addr,
dif_aes_t
*aes) {
18
if
(aes == NULL) {
19
return
kDifBadArg
;
20
}
21
22
aes->
base_addr
= base_addr;
23
24
return
kDifOk
;
25
}
26
27
dif_result_t
dif_aes_alert_force
(
const
dif_aes_t
*aes,
dif_aes_alert_t
alert) {
28
if
(aes == NULL) {
29
return
kDifBadArg
;
30
}
31
32
bitfield_bit32_index_t
alert_idx;
33
switch
(alert) {
34
case
kDifAesAlertRecovCtrlUpdateErr
:
35
alert_idx = AES_ALERT_TEST_RECOV_CTRL_UPDATE_ERR_BIT;
36
break
;
37
case
kDifAesAlertFatalFault
:
38
alert_idx = AES_ALERT_TEST_FATAL_FAULT_BIT;
39
break
;
40
default
:
41
return
kDifBadArg
;
42
}
43
44
uint32_t alert_test_reg =
bitfield_bit32_write
(0, alert_idx,
true
);
45
mmio_region_write32(aes->
base_addr
, (ptrdiff_t)AES_ALERT_TEST_REG_OFFSET,
46
alert_test_reg);
47
48
return
kDifOk
;
49
}
Return to
OpenTitan Documentation