Pavona 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 dragonfly.
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 * List of supported hardware features.
102 */
103#define OPENTITAN_SOC_DBG_CTRL_HAS_POLICY_SW_PROGRAMMABLE 1
104#define OPENTITAN_SOC_DBG_CTRL_HAS_POLICY_LC_RMA_OVERRIDE 1
105#define OPENTITAN_SOC_DBG_CTRL_HAS_POLICY_LC_BLANK_OVERRIDE 1
106#define OPENTITAN_SOC_DBG_CTRL_HAS_POLICY_LC_PREPROD_OVERRIDE 1
107#define OPENTITAN_SOC_DBG_CTRL_HAS_POLICY_RELOCK_REUNLOCK 1
108#define OPENTITAN_SOC_DBG_CTRL_HAS_TRACE_CORE_POLICY_READBACK 1
109#define OPENTITAN_SOC_DBG_CTRL_HAS_TRACE_JTAG_POLICY_READBACK 1
110#define OPENTITAN_SOC_DBG_CTRL_HAS_TRACE_JTAG_BOOT_STATUS_GATED_BY_DFT 1
111#define OPENTITAN_SOC_DBG_CTRL_HAS_TRACE_AUTH_PROGRESS_MIRRORING 1
112#define OPENTITAN_SOC_DBG_CTRL_HAS_HALT_FSM 1
113#define OPENTITAN_SOC_DBG_CTRL_HAS_HALT_PRODUCTION_PASSTHROUGH 1
114
115
116
117/**
118 * Get the soc_dbg_ctrl instance from an instance ID
119 *
120 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
121 *
122 * @param inst_id Instance ID.
123 * @return A soc_dbg_ctrl instance.
124 *
125 * **Note:** This function only makes sense if the instance ID has device type soc_dbg_ctrl,
126 * otherwise the returned value is unspecified.
127 */
129
130/**
131 * Get the instance ID of an instance.
132 *
133 * @param dt Instance of soc_dbg_ctrl.
134 * @return The instance ID of that instance.
135 */
137
138/**
139 * Get the register base address of an instance.
140 *
141 * @param dt Instance of soc_dbg_ctrl.
142 * @param reg_block The register block requested.
143 * @return The register base address of the requested block.
144 */
148
149/**
150 * Get the primary register base address of an instance.
151 *
152 * This is just a convenience function, equivalent to
153 * `dt_soc_dbg_ctrl_reg_block(dt, kDtSocDbgCtrlRegBlockCore)`
154 *
155 * @param dt Instance of soc_dbg_ctrl.
156 * @return The register base address of the primary register block.
157 */
158static inline uint32_t dt_soc_dbg_ctrl_primary_reg_block(
160 return dt_soc_dbg_ctrl_reg_block(dt, kDtSocDbgCtrlRegBlockCore);
161}
162
163
164/**
165 * Get the alert ID of a soc_dbg_ctrl alert for a given instance.
166 *
167 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
168 * instances where the instance is not connected, the return value is unspecified.
169 *
170 * @param dt Instance of soc_dbg_ctrl.
171 * @param alert A soc_dbg_ctrl alert.
172 * @return The Alert Handler alert ID of the alert of this instance.
173 */
177
178/**
179 * Convert a global alert ID to a local soc_dbg_ctrl alert type.
180 *
181 * @param dt Instance of soc_dbg_ctrl.
182 * @param alert A global alert ID that belongs to this instance.
183 * @return The soc_dbg_ctrl alert, or `kDtSocDbgCtrlAlertCount`.
184 *
185 * **Note:** This function assumes that the global alert ID belongs to the
186 * instance of soc_dbg_ctrl passed in parameter. In other words, it must be the case
187 * that `dt_soc_dbg_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
188 * this function will return `kDtSocDbgCtrlAlertCount`.
189 */
192 dt_alert_id_t alert);
193
194
195
196/**
197 * Get the clock signal connected to a clock port of an instance.
198 *
199 * @param dt Instance of soc_dbg_ctrl.
200 * @param clk Clock port.
201 * @return Clock signal.
202 */
206
207/**
208 * Get the reset signal connected to a reset port of an instance.
209 *
210 * @param dt Instance of soc_dbg_ctrl.
211 * @param rst Reset port.
212 * @return Reset signal.
213 */
217
218
219
220#ifdef __cplusplus
221} // extern "C"
222#endif // __cplusplus
223
224#endif // OPENTITAN_DT_SOC_DBG_CTRL_H_