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