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