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