Software APIs
dt_rv_plic.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_PLIC_H_
8
#define OPENTITAN_DT_RV_PLIC_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP rv_plic and top englishbreakfast.
17
*
18
* This file contains the type definitions and global functions of the rv_plic.
19
*/
20
21
#include "hw/top/dt/dt_api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_rv_plic
{
30
kDtRvPlic
= 0,
/**< rv_plic */
31
kDtRvPlicFirst = 0,
/**< \internal First instance */
32
kDtRvPlicCount = 1,
/**< \internal Number of instances */
33
}
dt_rv_plic_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_plic_reg_block
{
41
kDtRvPlicRegBlockCore = 0,
/**< */
42
kDtRvPlicRegBlockCount = 1,
/**< \internal Number of register blocks */
43
}
dt_rv_plic_reg_block_t
;
44
45
/**
46
* List of memories.
47
*
48
* Memories are guaranteed to start at 0 and to be consecutively numbered.
49
*/
50
typedef
enum
dt_rv_plic_memory
{
51
kDtRvPlicMemoryCount = 0,
/**< \internal Number of memories */
52
}
dt_rv_plic_memory_t
;
53
54
/** Primary register block (associated with the "primary" set of registers that control the IP). */
55
static
const
dt_rv_plic_reg_block_t
kDtRvPlicRegBlockPrimary = kDtRvPlicRegBlockCore;
56
57
/**
58
* List of clock ports.
59
*
60
* Clock ports are guaranteed to be numbered consecutively from 0.
61
*/
62
typedef
enum
dt_rv_plic_clock
{
63
kDtRvPlicClockClk
= 0,
/**< Clock port clk_i */
64
kDtRvPlicClockCount = 1,
/**< \internal Number of clock ports */
65
}
dt_rv_plic_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_plic_reset
{
73
kDtRvPlicResetRst
= 0,
/**< Reset port rst_ni */
74
kDtRvPlicResetCount = 1,
/**< \internal Number of reset ports */
75
}
dt_rv_plic_reset_t
;
76
77
/**
78
* List of supported hardware features.
79
*/
80
#define OPENTITAN_RV_PLIC_HAS_PRIORITY 1
81
#define OPENTITAN_RV_PLIC_HAS_ENABLE 1
82
83
84
85
/**
86
* Get the rv_plic instance from an instance ID
87
*
88
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
89
*
90
* @param inst_id Instance ID.
91
* @return A rv_plic instance.
92
*
93
* **Note:** This function only makes sense if the instance ID has device type rv_plic,
94
* otherwise the returned value is unspecified.
95
*/
96
dt_rv_plic_t
dt_rv_plic_from_instance_id
(
dt_instance_id_t
inst_id);
97
98
/**
99
* Get the instance ID of an instance.
100
*
101
* @param dt Instance of rv_plic.
102
* @return The instance ID of that instance.
103
*/
104
dt_instance_id_t
dt_rv_plic_instance_id
(
dt_rv_plic_t
dt);
105
106
/**
107
* Get the register base address of an instance.
108
*
109
* @param dt Instance of rv_plic.
110
* @param reg_block The register block requested.
111
* @return The register base address of the requested block.
112
*/
113
uint32_t
dt_rv_plic_reg_block
(
114
dt_rv_plic_t
dt,
115
dt_rv_plic_reg_block_t
reg_block);
116
117
/**
118
* Get the primary register base address of an instance.
119
*
120
* This is just a convenience function, equivalent to
121
* `dt_rv_plic_reg_block(dt, kDtRvPlicRegBlockCore)`
122
*
123
* @param dt Instance of rv_plic.
124
* @return The register base address of the primary register block.
125
*/
126
static
inline
uint32_t dt_rv_plic_primary_reg_block(
127
dt_rv_plic_t
dt) {
128
return
dt_rv_plic_reg_block
(dt, kDtRvPlicRegBlockCore);
129
}
130
131
/**
132
* Get the base address of a memory.
133
*
134
* @param dt Instance of rv_plic.
135
* @param mem The memory requested.
136
* @return The base address of the requested memory.
137
*/
138
uint32_t
dt_rv_plic_memory_base
(
139
dt_rv_plic_t
dt,
140
dt_rv_plic_memory_t
mem);
141
142
/**
143
* Get the size of a memory.
144
*
145
* @param dt Instance of rv_plic.
146
* @param mem The memory requested.
147
* @return The size of the requested memory.
148
*/
149
uint32_t
dt_rv_plic_memory_size
(
150
dt_rv_plic_t
dt,
151
dt_rv_plic_memory_t
mem);
152
153
154
155
156
/**
157
* Get the clock signal connected to a clock port of an instance.
158
*
159
* @param dt Instance of rv_plic.
160
* @param clk Clock port.
161
* @return Clock signal.
162
*/
163
dt_clock_t
dt_rv_plic_clock
(
164
dt_rv_plic_t
dt,
165
dt_rv_plic_clock_t
clk);
166
167
/**
168
* Get the reset signal connected to a reset port of an instance.
169
*
170
* @param dt Instance of rv_plic.
171
* @param rst Reset port.
172
* @return Reset signal.
173
*/
174
dt_reset_t
dt_rv_plic_reset
(
175
dt_rv_plic_t
dt,
176
dt_rv_plic_reset_t
rst);
177
178
179
180
#ifdef __cplusplus
181
}
// extern "C"
182
#endif
// __cplusplus
183
184
#endif
// OPENTITAN_DT_RV_PLIC_H_
(englishbreakfast)
hw
top
dt
dt_rv_plic.h
Return to
OpenTitan Documentation