Pavona Software APIs
rstmgr.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_RSTMGR_H_
8
#define OPENTITAN_DT_RSTMGR_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP rstmgr and top scafi_deprecated.
17
*
18
* This file contains the type definitions and global functions of the rstmgr.
19
*/
20
21
#include "hw/top/dt/api.h"
22
#include <stdint.h>
23
24
25
26
27
28
/**
29
* List of instances.
30
*/
31
typedef
enum
dt_rstmgr
{
32
kDtRstmgrFirst
= 0,
/**< First instance */
33
kDtRstmgrAon
= 0,
/**< rstmgr_aon */
34
}
dt_rstmgr_t
;
35
36
enum
{
37
kDtRstmgrCount
= 1,
/**< Number of instances */
38
};
39
40
41
/**
42
* List of register blocks.
43
*
44
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
45
*/
46
typedef
enum
dt_rstmgr_reg_block
{
47
kDtRstmgrRegBlockCore = 0,
/**< */
48
}
dt_rstmgr_reg_block_t
;
49
50
enum
{
51
kDtRstmgrRegBlockCount
= 1,
/**< 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_rstmgr_reg_block_t
kDtRstmgrRegBlockPrimary = kDtRstmgrRegBlockCore;
57
58
/**
59
* List of clock ports.
60
*
61
* Clock ports are guaranteed to be numbered consecutively from 0.
62
*/
63
typedef
enum
dt_rstmgr_clock
{
64
kDtRstmgrClockClk
= 0,
/**< Clock port clk_i */
65
kDtRstmgrClockAon
= 1,
/**< Clock port clk_aon_i */
66
kDtRstmgrClockIoDiv4
= 2,
/**< Clock port clk_io_div4_i */
67
kDtRstmgrClockMain
= 3,
/**< Clock port clk_main_i */
68
kDtRstmgrClockIo
= 4,
/**< Clock port clk_io_i */
69
kDtRstmgrClockIoDiv2
= 5,
/**< Clock port clk_io_div2_i */
70
kDtRstmgrClockUsb
= 6,
/**< Clock port clk_usb_i */
71
kDtRstmgrClockPor
= 7,
/**< Clock port clk_por_i */
72
}
dt_rstmgr_clock_t
;
73
74
enum
{
75
kDtRstmgrClockCount
= 8,
/**< Number of clock ports */
76
};
77
78
79
/**
80
* List of reset ports.
81
*
82
* Reset ports are guaranteed to be numbered consecutively from 0.
83
*/
84
typedef
enum
dt_rstmgr_reset
{
85
kDtRstmgrResetRst
= 0,
/**< Reset port rst_ni */
86
kDtRstmgrResetPor
= 1,
/**< Reset port rst_por_ni */
87
}
dt_rstmgr_reset_t
;
88
89
enum
{
90
kDtRstmgrResetCount
= 2,
/**< Number of reset ports */
91
};
92
93
94
/**
95
* List of supported hardware features.
96
*/
97
#define OPENTITAN_RSTMGR_HAS_SW_RST_CHIP_RESET 1
98
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_REQUEST 1
99
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_ENABLE 1
100
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_REQUEST 1
101
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_ENABLE 1
102
#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_REQUEST 1
103
#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_ENABLE 1
104
#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CAPTURE 1
105
#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CLEAR 1
106
#define OPENTITAN_RSTMGR_HAS_CPU_INFO_CAPTURE 1
107
#define OPENTITAN_RSTMGR_HAS_CPU_INFO_ENABLE 1
108
#define OPENTITAN_RSTMGR_HAS_ALERT_HANDLER_RESET_STATUS 1
109
110
111
112
/**
113
* Get the rstmgr instance from an instance ID
114
*
115
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
116
*
117
* @param inst_id Instance ID.
118
* @return A rstmgr instance.
119
*
120
* **Note:** This function only makes sense if the instance ID has device type rstmgr,
121
* otherwise the returned value is unspecified.
122
*/
123
dt_rstmgr_t
dt_rstmgr_from_instance_id
(
dt_instance_id_t
inst_id);
124
125
/**
126
* Get the instance ID of an instance.
127
*
128
* @param dt Instance of rstmgr.
129
* @return The instance ID of that instance.
130
*/
131
dt_instance_id_t
dt_rstmgr_instance_id
(
dt_rstmgr_t
dt);
132
133
/**
134
* Get the register base address of an instance.
135
*
136
* @param dt Instance of rstmgr.
137
* @param reg_block The register block requested.
138
* @return The register base address of the requested block.
139
*/
140
uint32_t
dt_rstmgr_reg_block
(
141
dt_rstmgr_t
dt,
142
dt_rstmgr_reg_block_t
reg_block);
143
144
/**
145
* Get the primary register base address of an instance.
146
*
147
* This is just a convenience function, equivalent to
148
* `dt_rstmgr_reg_block(dt, kDtRstmgrRegBlockCore)`
149
*
150
* @param dt Instance of rstmgr.
151
* @return The register base address of the primary register block.
152
*/
153
static
inline
uint32_t dt_rstmgr_primary_reg_block(
154
dt_rstmgr_t
dt) {
155
return
dt_rstmgr_reg_block
(dt, kDtRstmgrRegBlockCore);
156
}
157
158
159
160
161
/**
162
* Get the clock signal connected to a clock port of an instance.
163
*
164
* @param dt Instance of rstmgr.
165
* @param clk Clock port.
166
* @return Clock signal.
167
*/
168
dt_clock_t
dt_rstmgr_clock
(
169
dt_rstmgr_t
dt,
170
dt_rstmgr_clock_t
clk);
171
172
/**
173
* Get the reset signal connected to a reset port of an instance.
174
*
175
* @param dt Instance of rstmgr.
176
* @param rst Reset port.
177
* @return Reset signal.
178
*/
179
dt_reset_t
dt_rstmgr_reset
(
180
dt_rstmgr_t
dt,
181
dt_rstmgr_reset_t
rst);
182
183
184
185
/**
186
* Get the number of software resets.
187
*
188
* @param dt Instance of rstmgr.
189
* @return Number of software resets.
190
*/
191
size_t
dt_rstmgr_sw_reset_count
(
dt_rstmgr_t
dt);
192
193
/**
194
* Get the reset ID of a software reset.
195
*
196
* The resets are ordered in the same way as they appear in the registers.
197
*
198
* @param dt Instance of rstmgr.
199
* @param idx Index of the software reset, between 0 and `dt_rstmgr_sw_reset_count(dt)-1`.
200
* @return Reset ID, or `kDtResetUnknown` for invalid parameters.
201
*/
202
dt_reset_t
dt_rstmgr_sw_reset
(
dt_rstmgr_t
dt,
size_t
idx);
203
204
/**
205
* Description of a reset request source.
206
*
207
* A reset request source is always identified by the instance ID of the module where it comes
208
* from. In principle, some instances could have several reset requests. If this is the case,
209
* the `rst_req` can be used to distinguish between those. It should be cast to the
210
* `dt_<ip>_reset_req_t` type of the corresponding IP.
211
*
212
* WARNING At the moment, three hardcoded reset requests are treated specially and have their
213
* `reset_req` field set to `0` because there is no corresponding reset request declared by those
214
* IPs:
215
* - the main power glitch reset request, coming from the `pwrmgr`,
216
* - the escalation reset request, coming from the `alert_handler`,
217
* - the non-debug-module reset request, coming from the `rv_dm`.
218
*/
219
typedef
struct
dt_rstmgr_reset_req_src
{
220
dt_instance_id_t
inst_id
;
/**< Instance ID of the source of this reset request. */
221
size_t
reset_req
;
/**< Index of the reset request signal for that instance. */
222
}
dt_rstmgr_reset_req_src_t
;
223
224
225
/**
226
* Get the number of hardware reset requests.
227
*
228
* @param dt Instance of rstmgr.
229
* @return Number of reset requests.
230
*/
231
size_t
dt_rstmgr_hw_reset_req_src_count
(
dt_rstmgr_t
dt);
232
233
/**
234
* Get the description of a reset request.
235
*
236
* The reset requests are ordered as they appear in the registers.
237
*
238
* @param dt Instance of rstmgr.
239
* @param idx Index of the reset request source, between 0 and
240
* `dt_pwrmgr_hw_reset_req_src_count(dt)-1`.
241
* @return Description of the reset.
242
*/
243
dt_rstmgr_reset_req_src_t
dt_rstmgr_hw_reset_req_src
(
dt_rstmgr_t
dt,
size_t
idx);
244
245
246
247
#ifdef __cplusplus
248
}
// extern "C"
249
#endif
// __cplusplus
250
251
#endif
// OPENTITAN_DT_RSTMGR_H_
(scafi_deprecated)
hw
top
dt
rstmgr.h
Generated by
1.13.2