Software APIs
soc_dbg_ctrl.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// Device table API auto-generated by `dtgen`
6
7#ifndef OPENTITAN_DT_SOC_DBG_CTRL_H_
8#define OPENTITAN_DT_SOC_DBG_CTRL_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP soc_dbg_ctrl and top darjeeling.
17 *
18 * This file contains the type definitions and global functions of the soc_dbg_ctrl.
19 */
20
21#include "hw/top/dt/api.h"
22#include <stdint.h>
23
24
25
26/**
27 * List of instances.
28 */
29typedef enum dt_soc_dbg_ctrl {
30 kDtSocDbgCtrlFirst = 0, /**< First instance */
31 kDtSocDbgCtrl = 0, /**< soc_dbg_ctrl */
33
34enum {
35 kDtSocDbgCtrlCount = 1, /**< Number of instances */
36};
37
38
39/**
40 * List of register blocks.
41 *
42 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
43 */
45 kDtSocDbgCtrlRegBlockCore = 0, /**< */
46 kDtSocDbgCtrlRegBlockJtag = 1, /**< */
48
49enum {
50 kDtSocDbgCtrlRegBlockCount = 2, /**< Number of register blocks */
51};
52
53
54/** Primary register block (associated with the "primary" set of registers that control the IP). */
55static const dt_soc_dbg_ctrl_reg_block_t kDtSocDbgCtrlRegBlockPrimary = kDtSocDbgCtrlRegBlockCore;
56
57/**
58 * List of Alerts.
59 *
60 * Alerts are guaranteed to be numbered consecutively from 0.
61 */
63 kDtSocDbgCtrlAlertFatalFault = 0, /**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
64 kDtSocDbgCtrlAlertRecovCtrlUpdateErr = 1, /**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
66
67enum {
68 kDtSocDbgCtrlAlertCount = 2, /**< Number of Alerts */
69};
70
71
72/**
73 * List of clock ports.
74 *
75 * Clock ports are guaranteed to be numbered consecutively from 0.
76 */
78 kDtSocDbgCtrlClockClk = 0, /**< Clock port clk_i */
80
81enum {
82 kDtSocDbgCtrlClockCount = 1, /**< Number of clock ports */
83};
84
85
86/**
87 * List of reset ports.
88 *
89 * Reset ports are guaranteed to be numbered consecutively from 0.
90 */
92 kDtSocDbgCtrlResetRst = 0, /**< Reset port rst_ni */
94
95enum {
96 kDtSocDbgCtrlResetCount = 1, /**< Number of reset ports */
97};
98
99
100
101/**
102 * Get the soc_dbg_ctrl instance from an instance ID
103 *
104 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
105 *
106 * @param inst_id Instance ID.
107 * @return A soc_dbg_ctrl instance.
108 *
109 * **Note:** This function only makes sense if the instance ID has device type soc_dbg_ctrl,
110 * otherwise the returned value is unspecified.
111 */
113
114/**
115 * Get the instance ID of an instance.
116 *
117 * @param dt Instance of soc_dbg_ctrl.
118 * @return The instance ID of that instance.
119 */
121
122/**
123 * Get the register base address of an instance.
124 *
125 * @param dt Instance of soc_dbg_ctrl.
126 * @param reg_block The register block requested.
127 * @return The register base address of the requested block.
128 */
132
133/**
134 * Get the primary register base address of an instance.
135 *
136 * This is just a convenience function, equivalent to
137 * `dt_soc_dbg_ctrl_reg_block(dt, kDtSocDbgCtrlRegBlockCore)`
138 *
139 * @param dt Instance of soc_dbg_ctrl.
140 * @return The register base address of the primary register block.
141 */
142static inline uint32_t dt_soc_dbg_ctrl_primary_reg_block(
144 return dt_soc_dbg_ctrl_reg_block(dt, kDtSocDbgCtrlRegBlockCore);
145}
146
147
148/**
149 * Get the alert ID of a soc_dbg_ctrl alert for a given instance.
150 *
151 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
152 * instances where the instance is not connected, the return value is unspecified.
153 *
154 * @param dt Instance of soc_dbg_ctrl.
155 * @param alert A soc_dbg_ctrl alert.
156 * @return The Alert Handler alert ID of the alert of this instance.
157 */
161
162/**
163 * Convert a global alert ID to a local soc_dbg_ctrl alert type.
164 *
165 * @param dt Instance of soc_dbg_ctrl.
166 * @param alert A global alert ID that belongs to this instance.
167 * @return The soc_dbg_ctrl alert, or `kDtSocDbgCtrlAlertCount`.
168 *
169 * **Note:** This function assumes that the global alert ID belongs to the
170 * instance of soc_dbg_ctrl passed in parameter. In other words, it must be the case
171 * that `dt_soc_dbg_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
172 * this function will return `kDtSocDbgCtrlAlertCount`.
173 */
176 dt_alert_id_t alert);
177
178
179
180/**
181 * Get the clock signal connected to a clock port of an instance.
182 *
183 * @param dt Instance of soc_dbg_ctrl.
184 * @param clk Clock port.
185 * @return Clock signal.
186 */
190
191/**
192 * Get the reset signal connected to a reset port of an instance.
193 *
194 * @param dt Instance of soc_dbg_ctrl.
195 * @param rst Reset port.
196 * @return Reset signal.
197 */
201
202
203
204#ifdef __cplusplus
205} // extern "C"
206#endif // __cplusplus
207
208#endif // OPENTITAN_DT_SOC_DBG_CTRL_H_