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
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/dt_api.h"
22#include <stdint.h>
23
24
25
26/**
27 * List of instances.
28 */
29typedef enum dt_rv_plic {
30 kDtRvPlic = 0, /**< rv_plic */
31 kDtRvPlicFirst = 0, /**< \internal First instance */
32 kDtRvPlicCount = 1, /**< \internal Number of instances */
34
35/**
36 * List of register blocks.
37 *
38 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
39 */
41 kDtRvPlicRegBlockCore = 0, /**< */
42 kDtRvPlicRegBlockCount = 1, /**< \internal Number of register blocks */
44
45/**
46 * List of memories.
47 *
48 * Memories are guaranteed to start at 0 and to be consecutively numbered.
49 */
50typedef enum dt_rv_plic_memory {
51 kDtRvPlicMemoryCount = 0, /**< \internal Number of memories */
53
54/** Primary register block (associated with the "primary" set of registers that control the IP). */
55static 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 */
62typedef enum dt_rv_plic_clock {
63 kDtRvPlicClockClk = 0, /**< Clock port clk_i */
64 kDtRvPlicClockCount = 1, /**< \internal Number of clock ports */
66
67/**
68 * List of reset ports.
69 *
70 * Reset ports are guaranteed to be numbered consecutively from 0.
71 */
72typedef enum dt_rv_plic_reset {
73 kDtRvPlicResetRst = 0, /**< Reset port rst_ni */
74 kDtRvPlicResetCount = 1, /**< \internal Number of reset ports */
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 */
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 */
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 */
113uint32_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 */
126static 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 */
139 dt_rv_plic_t dt,
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 */
150 dt_rv_plic_t dt,
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 */
164 dt_rv_plic_t dt,
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 */
175 dt_rv_plic_t dt,
177
178
179
180#ifdef __cplusplus
181} // extern "C"
182#endif // __cplusplus
183
184#endif // OPENTITAN_DT_RV_PLIC_H_