Software APIs
dt_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/dt_api.h"
22#include <stdint.h>
23
24
25
26/**
27 * List of instances.
28 */
29typedef enum dt_soc_dbg_ctrl {
30 kDtSocDbgCtrl = 0, /**< soc_dbg_ctrl */
31 kDtSocDbgCtrlFirst = 0, /**< \internal First instance */
32 kDtSocDbgCtrlCount = 1, /**< \internal Number of instances */
34
35/**
36 * List of register blocks.
37 *
38 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
39 */
41 kDtSocDbgCtrlRegBlockCore = 0, /**< */
42 kDtSocDbgCtrlRegBlockJtag = 1, /**< */
43 kDtSocDbgCtrlRegBlockCount = 2, /**< \internal Number of register blocks */
45
46/**
47 * List of memories.
48 *
49 * Memories are guaranteed to start at 0 and to be consecutively numbered.
50 */
52 kDtSocDbgCtrlMemoryCount = 0, /**< \internal Number of memories */
54
55/** Primary register block (associated with the "primary" set of registers that control the IP). */
56static const dt_soc_dbg_ctrl_reg_block_t kDtSocDbgCtrlRegBlockPrimary = kDtSocDbgCtrlRegBlockCore;
57
58/**
59 * List of Alerts.
60 *
61 * Alerts are guaranteed to be numbered consecutively from 0.
62 */
64 kDtSocDbgCtrlAlertFatalFault = 0, /**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
65 kDtSocDbgCtrlAlertRecovCtrlUpdateErr = 1, /**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
66 kDtSocDbgCtrlAlertCount = 2, /**< \internal Number of Alerts */
68
69/**
70 * List of clock ports.
71 *
72 * Clock ports are guaranteed to be numbered consecutively from 0.
73 */
75 kDtSocDbgCtrlClockClk = 0, /**< Clock port clk_i */
76 kDtSocDbgCtrlClockCount = 1, /**< \internal Number of clock ports */
78
79/**
80 * List of reset ports.
81 *
82 * Reset ports are guaranteed to be numbered consecutively from 0.
83 */
85 kDtSocDbgCtrlResetRst = 0, /**< Reset port rst_ni */
86 kDtSocDbgCtrlResetCount = 1, /**< \internal Number of reset ports */
88
89
90/**
91 * Get the soc_dbg_ctrl instance from an instance ID
92 *
93 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
94 *
95 * @param inst_id Instance ID.
96 * @return A soc_dbg_ctrl instance.
97 *
98 * **Note:** This function only makes sense if the instance ID has device type soc_dbg_ctrl,
99 * otherwise the returned value is unspecified.
100 */
102
103/**
104 * Get the instance ID of an instance.
105 *
106 * @param dt Instance of soc_dbg_ctrl.
107 * @return The instance ID of that instance.
108 */
110
111/**
112 * Get the register base address of an instance.
113 *
114 * @param dt Instance of soc_dbg_ctrl.
115 * @param reg_block The register block requested.
116 * @return The register base address of the requested block.
117 */
121
122/**
123 * Get the primary register base address of an instance.
124 *
125 * This is just a convenience function, equivalent to
126 * `dt_soc_dbg_ctrl_reg_block(dt, kDtSocDbgCtrlRegBlockCore)`
127 *
128 * @param dt Instance of soc_dbg_ctrl.
129 * @return The register base address of the primary register block.
130 */
131static inline uint32_t dt_soc_dbg_ctrl_primary_reg_block(
133 return dt_soc_dbg_ctrl_reg_block(dt, kDtSocDbgCtrlRegBlockCore);
134}
135
136/**
137 * Get the base address of a memory.
138 *
139 * @param dt Instance of soc_dbg_ctrl.
140 * @param mem The memory requested.
141 * @return The base address of the requested memory.
142 */
146
147/**
148 * Get the size of a memory.
149 *
150 * @param dt Instance of soc_dbg_ctrl.
151 * @param mem The memory requested.
152 * @return The size of the requested memory.
153 */
157
158
159/**
160 * Get the alert ID of a soc_dbg_ctrl alert for a given instance.
161 *
162 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
163 * instances where the instance is not connected, the return value is unspecified.
164 *
165 * @param dt Instance of soc_dbg_ctrl.
166 * @param alert A soc_dbg_ctrl alert.
167 * @return The Alert Handler alert ID of the alert of this instance.
168 */
172
173/**
174 * Convert a global alert ID to a local soc_dbg_ctrl alert type.
175 *
176 * @param dt Instance of soc_dbg_ctrl.
177 * @param alert A global alert ID that belongs to this instance.
178 * @return The soc_dbg_ctrl alert, or `kDtSocDbgCtrlAlertCount`.
179 *
180 * **Note:** This function assumes that the global alert ID belongs to the
181 * instance of soc_dbg_ctrl passed in parameter. In other words, it must be the case
182 * that `dt_soc_dbg_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
183 * this function will return `kDtSocDbgCtrlAlertCount`.
184 */
187 dt_alert_id_t alert);
188
189
190
191/**
192 * Get the clock signal connected to a clock port of an instance.
193 *
194 * @param dt Instance of soc_dbg_ctrl.
195 * @param clk Clock port.
196 * @return Clock signal.
197 */
201
202/**
203 * Get the reset signal connected to a reset port of an instance.
204 *
205 * @param dt Instance of soc_dbg_ctrl.
206 * @param rst Reset port.
207 * @return Reset signal.
208 */
212
213
214
215#ifdef __cplusplus
216} // extern "C"
217#endif // __cplusplus
218
219#endif // OPENTITAN_DT_SOC_DBG_CTRL_H_