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