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
11extern "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 */
29typedef enum dt_rv_plic {
30 kDtRvPlicFirst = 0, /**< First instance */
31 kDtRvPlic = 0, /**< rv_plic */
33
34enum {
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 */
45 kDtRvPlicRegBlockCore = 0, /**< */
47
48enum {
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). */
54static 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 */
61typedef enum dt_rv_plic_clock {
62 kDtRvPlicClockClk = 0, /**< Clock port clk_i */
64
65enum {
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 */
75typedef enum dt_rv_plic_reset {
76 kDtRvPlicResetRst = 0, /**< Reset port rst_ni */
78
79enum {
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 */
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 */
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 */
120uint32_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 */
133static 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 */
149 dt_rv_plic_t dt,
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 */
160 dt_rv_plic_t dt,
162
163
164
165#ifdef __cplusplus
166} // extern "C"
167#endif // __cplusplus
168
169#endif // OPENTITAN_DT_RV_PLIC_H_