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