Software APIs
rv_dm.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_RV_DM_H_
8
#define OPENTITAN_DT_RV_DM_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP rv_dm and top earlgrey.
17
*
18
* This file contains the type definitions and global functions of the rv_dm.
19
*/
20
21
#include "hw/top/dt/api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_rv_dm
{
30
kDtRvDmFirst
= 0,
/**< First instance */
31
kDtRvDm
= 0,
/**< rv_dm */
32
}
dt_rv_dm_t
;
33
34
enum
{
35
kDtRvDmCount
= 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
*/
44
typedef
enum
dt_rv_dm_reg_block
{
45
kDtRvDmRegBlockRegs = 0,
/**< */
46
kDtRvDmRegBlockMem = 1,
/**< */
47
kDtRvDmRegBlockDbg = 2,
/**< */
48
}
dt_rv_dm_reg_block_t
;
49
50
enum
{
51
kDtRvDmRegBlockCount
= 3,
/**< Number of register blocks */
52
};
53
54
55
/** Primary register block (associated with the "primary" set of registers that control the IP). */
56
static
const
dt_rv_dm_reg_block_t
kDtRvDmRegBlockPrimary = kDtRvDmRegBlockRegs;
57
58
/**
59
* List of Alerts.
60
*
61
* Alerts are guaranteed to be numbered consecutively from 0.
62
*/
63
typedef
enum
dt_rv_dm_alert
{
64
kDtRvDmAlertFatalFault
= 0,
/**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
65
}
dt_rv_dm_alert_t
;
66
67
enum
{
68
kDtRvDmAlertCount
= 1,
/**< 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
*/
77
typedef
enum
dt_rv_dm_clock
{
78
kDtRvDmClockClk
= 0,
/**< Clock port clk_i */
79
kDtRvDmClockLc
= 1,
/**< Clock port clk_lc_i */
80
}
dt_rv_dm_clock_t
;
81
82
enum
{
83
kDtRvDmClockCount
= 2,
/**< Number of clock ports */
84
};
85
86
87
/**
88
* List of reset ports.
89
*
90
* Reset ports are guaranteed to be numbered consecutively from 0.
91
*/
92
typedef
enum
dt_rv_dm_reset
{
93
kDtRvDmResetRst
= 0,
/**< Reset port rst_ni */
94
kDtRvDmResetLc
= 1,
/**< Reset port rst_lc_ni */
95
}
dt_rv_dm_reset_t
;
96
97
enum
{
98
kDtRvDmResetCount
= 2,
/**< Number of reset ports */
99
};
100
101
102
/**
103
* List of supported hardware features.
104
*/
105
#define OPENTITAN_RV_DM_HAS_JTAG_FSM 1
106
#define OPENTITAN_RV_DM_HAS_JTAG_DTM 1
107
#define OPENTITAN_RV_DM_HAS_DBG_DATA_REGS 1
108
#define OPENTITAN_RV_DM_HAS_DBG_DMCONTROL_REG 1
109
#define OPENTITAN_RV_DM_HAS_DBG_DMSTATUS_REG 1
110
#define OPENTITAN_RV_DM_HAS_DBG_HARTINFO_REG 1
111
#define OPENTITAN_RV_DM_HAS_DBG_HALTSUM0_REG 1
112
#define OPENTITAN_RV_DM_HAS_DBG_ABSTRACT_COMMAND 1
113
#define OPENTITAN_RV_DM_HAS_DBG_PROGBUF 1
114
#define OPENTITAN_RV_DM_HAS_DBG_SBA 1
115
#define OPENTITAN_RV_DM_HAS_DBG_NDM_RESET 1
116
#define OPENTITAN_RV_DM_HAS_DBG_GDB 1
117
118
119
120
/**
121
* Get the rv_dm instance from an instance ID
122
*
123
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
124
*
125
* @param inst_id Instance ID.
126
* @return A rv_dm instance.
127
*
128
* **Note:** This function only makes sense if the instance ID has device type rv_dm,
129
* otherwise the returned value is unspecified.
130
*/
131
dt_rv_dm_t
dt_rv_dm_from_instance_id
(
dt_instance_id_t
inst_id);
132
133
/**
134
* Get the instance ID of an instance.
135
*
136
* @param dt Instance of rv_dm.
137
* @return The instance ID of that instance.
138
*/
139
dt_instance_id_t
dt_rv_dm_instance_id
(
dt_rv_dm_t
dt);
140
141
/**
142
* Get the register base address of an instance.
143
*
144
* @param dt Instance of rv_dm.
145
* @param reg_block The register block requested.
146
* @return The register base address of the requested block.
147
*/
148
uint32_t
dt_rv_dm_reg_block
(
149
dt_rv_dm_t
dt,
150
dt_rv_dm_reg_block_t
reg_block);
151
152
/**
153
* Get the primary register base address of an instance.
154
*
155
* This is just a convenience function, equivalent to
156
* `dt_rv_dm_reg_block(dt, kDtRvDmRegBlockRegs)`
157
*
158
* @param dt Instance of rv_dm.
159
* @return The register base address of the primary register block.
160
*/
161
static
inline
uint32_t dt_rv_dm_primary_reg_block(
162
dt_rv_dm_t
dt) {
163
return
dt_rv_dm_reg_block
(dt, kDtRvDmRegBlockRegs);
164
}
165
166
167
/**
168
* Get the alert ID of a rv_dm alert for a given instance.
169
*
170
* **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
171
* instances where the instance is not connected, the return value is unspecified.
172
*
173
* @param dt Instance of rv_dm.
174
* @param alert A rv_dm alert.
175
* @return The Alert Handler alert ID of the alert of this instance.
176
*/
177
dt_alert_id_t
dt_rv_dm_alert_to_alert_id
(
178
dt_rv_dm_t
dt,
179
dt_rv_dm_alert_t
alert);
180
181
/**
182
* Convert a global alert ID to a local rv_dm alert type.
183
*
184
* @param dt Instance of rv_dm.
185
* @param alert A global alert ID that belongs to this instance.
186
* @return The rv_dm alert, or `kDtRvDmAlertCount`.
187
*
188
* **Note:** This function assumes that the global alert ID belongs to the
189
* instance of rv_dm passed in parameter. In other words, it must be the case
190
* that `dt_rv_dm_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
191
* this function will return `kDtRvDmAlertCount`.
192
*/
193
dt_rv_dm_alert_t
dt_rv_dm_alert_from_alert_id
(
194
dt_rv_dm_t
dt,
195
dt_alert_id_t
alert);
196
197
198
199
/**
200
* Get the clock signal connected to a clock port of an instance.
201
*
202
* @param dt Instance of rv_dm.
203
* @param clk Clock port.
204
* @return Clock signal.
205
*/
206
dt_clock_t
dt_rv_dm_clock
(
207
dt_rv_dm_t
dt,
208
dt_rv_dm_clock_t
clk);
209
210
/**
211
* Get the reset signal connected to a reset port of an instance.
212
*
213
* @param dt Instance of rv_dm.
214
* @param rst Reset port.
215
* @return Reset signal.
216
*/
217
dt_reset_t
dt_rv_dm_reset
(
218
dt_rv_dm_t
dt,
219
dt_rv_dm_reset_t
rst);
220
221
222
223
#ifdef __cplusplus
224
}
// extern "C"
225
#endif
// __cplusplus
226
227
#endif
// OPENTITAN_DT_RV_DM_H_
(earlgrey)
hw
top
dt
rv_dm.h
Return to
OpenTitan Documentation