Software APIs
dif_clkmgr_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
6
7
#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_CLKMGR_AUTOGEN_H_
8
#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_CLKMGR_AUTOGEN_H_
9
10
// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
11
// util/autogen_dif.py -i
12
// hw/top_earlgrey/ip_autogen/clkmgr/data/clkmgr.hjson -o
13
// bazel-out/k8-fastbuild/bin/sw/device/lib/dif/autogen
14
15
16
/**
17
* @file
18
* @brief <a href="/book/hw/ip/clkmgr/">CLKMGR</a> Device Interface Functions
19
*/
20
21
#include <stdbool.h>
22
#include <stdint.h>
23
24
#include "
sw/device/lib/base/macros.h
"
25
#include "
sw/device/lib/base/mmio.h
"
26
#include "
sw/device/lib/dif/dif_base.h
"
27
#include "hw/top/dt/clkmgr.h"
// Generated.
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
// __cplusplus
32
33
/**
34
* A handle to clkmgr.
35
*
36
* This type should be treated as opaque by users.
37
*/
38
typedef
struct
dif_clkmgr
{
39
/**
40
* The base address for the clkmgr hardware registers.
41
*/
42
mmio_region_t
base_addr
;
43
/**
44
* The instance, set to `kDtClkmgrCount` if not initialized
45
* through `dif_clkmgr_init_from_dt`.
46
*/
47
dt_clkmgr_t
dt
;
48
}
dif_clkmgr_t
;
49
50
/**
51
* Creates a new handle for a(n) clkmgr peripheral.
52
*
53
* This function does not actuate the hardware.
54
*
55
* @param base_addr The MMIO base address of the clkmgr peripheral.
56
* @param[out] clkmgr Out param for the initialized handle.
57
* @return The result of the operation.
58
*
59
* DEPRECATED This function exists solely for the transition to
60
* dt-based DIFs and will be removed in the future.
61
*/
62
OT_WARN_UNUSED_RESULT
63
dif_result_t
dif_clkmgr_init
(
64
mmio_region_t
base_addr,
65
dif_clkmgr_t
*clkmgr);
66
67
/**
68
* Creates a new handle for a(n) clkmgr peripheral.
69
*
70
* This function does not actuate the hardware.
71
*
72
* @param dt The devicetable description of the device.
73
* @param[out] clkmgr Out param for the initialized handle.
74
* @return The result of the operation.
75
*/
76
OT_WARN_UNUSED_RESULT
77
dif_result_t
dif_clkmgr_init_from_dt
(
78
dt_clkmgr_t
dt,
79
dif_clkmgr_t
*clkmgr);
80
81
/**
82
* Get the DT handle from this DIF.
83
*
84
* If this DIF was initialized by `dif_clkmgr_init_from_dt(dt, ..)`
85
* then this function will return `dt`. Otherwise it will return an error.
86
*
87
* @param clkmgr A clkmgr handle.
88
* @param[out] dt DT handle.
89
* @return `kDifBadArg` if the DIF has no DT information, `kDifOk` otherwise.
90
*/
91
OT_WARN_UNUSED_RESULT
92
dif_result_t
dif_clkmgr_get_dt
(
93
const
dif_clkmgr_t
*clkmgr,
94
dt_clkmgr_t
*dt);
95
96
/**
97
* A clkmgr alert type.
98
*/
99
typedef
enum
dif_clkmgr_alert
{
100
/**
101
* This recoverable alert is triggered when there are measurement errors.
102
*/
103
kDifClkmgrAlertRecovFault
= 0,
104
/**
105
* This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
106
*/
107
kDifClkmgrAlertFatalFault
= 1,
108
}
dif_clkmgr_alert_t
;
109
110
/**
111
* Forces a particular alert, causing it to be escalated as if the hardware
112
* had raised it.
113
*
114
* @param clkmgr A clkmgr handle.
115
* @param alert The alert to force.
116
* @return The result of the operation.
117
*/
118
OT_WARN_UNUSED_RESULT
119
dif_result_t
dif_clkmgr_alert_force
(
120
const
dif_clkmgr_t
*clkmgr,
121
dif_clkmgr_alert_t
alert);
122
123
124
#ifdef __cplusplus
125
}
// extern "C"
126
#endif
// __cplusplus
127
128
#endif
// OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_CLKMGR_AUTOGEN_H_
(earlgrey)
sw
device
lib
dif
autogen
dif_clkmgr_autogen.h
Return to
OpenTitan Documentation