Software APIs
dif_otp_macro_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
6
7
8
9
10
11
// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
12
// util/autogen_dif.py -i hw/ip/otp_macro/data/otp_macro.hjson -o
13
// bazel-out/k8-fastbuild-ST-ae23cdef058d/bin/sw/device/lib/dif/autogen
14
15
16
#include <stdint.h>
17
18
#include "
sw/device/lib/dif/dif_base.h
"
19
#include "
sw/device/lib/dif/autogen/dif_otp_macro_autogen.h
"
20
21
#include "
hw/top/otp_macro_regs.h
"
// Generated.
22
23
24
OT_WARN_UNUSED_RESULT
25
dif_result_t
dif_otp_macro_init(
26
mmio_region_t
base_addr,
27
dif_otp_macro_t
*otp_macro) {
28
if
(otp_macro == NULL) {
29
return
kDifBadArg
;
30
}
31
32
otp_macro->
dt
=
kDtOtpMacroCount
;
33
otp_macro->
base_addr
= base_addr;
34
35
return
kDifOk
;
36
}
37
38
OT_WARN_UNUSED_RESULT
39
dif_result_t
dif_otp_macro_init_from_dt(
40
dt_otp_macro_t
dt,
41
dif_otp_macro_t
*otp_macro) {
42
if
(otp_macro == NULL) {
43
return
kDifBadArg
;
44
}
45
46
otp_macro->
dt
= dt;
47
otp_macro->
base_addr
= mmio_region_from_addr(dt_otp_macro_primary_reg_block(dt));
48
49
return
kDifOk
;
50
}
51
52
dif_result_t
dif_otp_macro_get_dt(
53
const
dif_otp_macro_t
*otp_macro,
54
dt_otp_macro_t
*dt) {
55
if
((
int
)otp_macro->
dt
==
kDtOtpMacroCount
|| dt == NULL) {
56
return
kDifBadArg
;
57
}
58
*dt = otp_macro->
dt
;
59
return
kDifOk
;
60
}
61
62
(darjeeling)
sw
device
lib
dif
autogen
dif_otp_macro_autogen.c
Return to
OpenTitan Documentation