Software APIs
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/api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_rv_plic
{
30
kDtRvPlicFirst
= 0,
/**< First instance */
31
kDtRvPlic
= 0,
/**< rv_plic */
32
}
dt_rv_plic_t
;
33
34
enum
{
35
kDtRvPlicCount
= 1,
/**< Number of instances */
36
};
37
38
39
/**
40
* List of register blocks.
41
*
42
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
43
*/
44
typedef
enum
dt_rv_plic_reg_block
{
45
kDtRvPlicRegBlockCore = 0,
/**< */
46
}
dt_rv_plic_reg_block_t
;
47
48
enum
{
49
kDtRvPlicRegBlockCount
= 1,
/**< Number of register blocks */
50
};
51
52
53
/** Primary register block (associated with the "primary" set of registers that control the IP). */
54
static
const
dt_rv_plic_reg_block_t
kDtRvPlicRegBlockPrimary = kDtRvPlicRegBlockCore;
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_plic_clock
{
62
kDtRvPlicClockClk
= 0,
/**< Clock port clk_i */
63
}
dt_rv_plic_clock_t
;
64
65
enum
{
66
kDtRvPlicClockCount
= 1,
/**< Number of clock ports */
67
};
68
69
70
/**
71
* List of reset ports.
72
*
73
* Reset ports are guaranteed to be numbered consecutively from 0.
74
*/
75
typedef
enum
dt_rv_plic_reset
{
76
kDtRvPlicResetRst
= 0,
/**< Reset port rst_ni */
77
}
dt_rv_plic_reset_t
;
78
79
enum
{
80
kDtRvPlicResetCount
= 1,
/**< Number of reset ports */
81
};
82
83
84
/**
85
* List of supported hardware features.
86
*/
87
#define OPENTITAN_RV_PLIC_HAS_PRIORITY 1
88
#define OPENTITAN_RV_PLIC_HAS_ENABLE 1
89
90
91
92
/**
93
* Get the rv_plic instance from an instance ID
94
*
95
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
96
*
97
* @param inst_id Instance ID.
98
* @return A rv_plic instance.
99
*
100
* **Note:** This function only makes sense if the instance ID has device type rv_plic,
101
* otherwise the returned value is unspecified.
102
*/
103
dt_rv_plic_t
dt_rv_plic_from_instance_id
(
dt_instance_id_t
inst_id);
104
105
/**
106
* Get the instance ID of an instance.
107
*
108
* @param dt Instance of rv_plic.
109
* @return The instance ID of that instance.
110
*/
111
dt_instance_id_t
dt_rv_plic_instance_id
(
dt_rv_plic_t
dt);
112
113
/**
114
* Get the register base address of an instance.
115
*
116
* @param dt Instance of rv_plic.
117
* @param reg_block The register block requested.
118
* @return The register base address of the requested block.
119
*/
120
uint32_t
dt_rv_plic_reg_block
(
121
dt_rv_plic_t
dt,
122
dt_rv_plic_reg_block_t
reg_block);
123
124
/**
125
* Get the primary register base address of an instance.
126
*
127
* This is just a convenience function, equivalent to
128
* `dt_rv_plic_reg_block(dt, kDtRvPlicRegBlockCore)`
129
*
130
* @param dt Instance of rv_plic.
131
* @return The register base address of the primary register block.
132
*/
133
static
inline
uint32_t dt_rv_plic_primary_reg_block(
134
dt_rv_plic_t
dt) {
135
return
dt_rv_plic_reg_block
(dt, kDtRvPlicRegBlockCore);
136
}
137
138
139
140
141
/**
142
* Get the clock signal connected to a clock port of an instance.
143
*
144
* @param dt Instance of rv_plic.
145
* @param clk Clock port.
146
* @return Clock signal.
147
*/
148
dt_clock_t
dt_rv_plic_clock
(
149
dt_rv_plic_t
dt,
150
dt_rv_plic_clock_t
clk);
151
152
/**
153
* Get the reset signal connected to a reset port of an instance.
154
*
155
* @param dt Instance of rv_plic.
156
* @param rst Reset port.
157
* @return Reset signal.
158
*/
159
dt_reset_t
dt_rv_plic_reset
(
160
dt_rv_plic_t
dt,
161
dt_rv_plic_reset_t
rst);
162
163
164
165
#ifdef __cplusplus
166
}
// extern "C"
167
#endif
// __cplusplus
168
169
#endif
// OPENTITAN_DT_RV_PLIC_H_
(englishbreakfast)
hw
top
dt
rv_plic.h
Return to
OpenTitan Documentation