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
27#include "hw/top/dt/clkmgr.h" // Generated.
28
29#ifdef __cplusplus
30extern "C" {
31#endif // __cplusplus
32
33/**
34 * A handle to clkmgr.
35 *
36 * This type should be treated as opaque by users.
37 */
38typedef struct dif_clkmgr {
39 /**
40 * The base address for the clkmgr hardware registers.
41 */
43 /**
44 * The instance, set to `kDtClkmgrCount` if not initialized
45 * through `dif_clkmgr_init_from_dt`.
46 */
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 */
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 */
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 */
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 */
104 /**
105 * This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
106 */
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 */
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_