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/**
11 * @file
12 * @brief Device Tables (DT) for IP rv_plic and top englishbreakfast.
13 *
14 * This file contains the type definitions and global functions of the rv_plic.
15 */
16
17#include "dt_api.h"
18#include <stdint.h>
19
20/**
21 * List of instances.
22 */
23typedef enum dt_rv_plic {
24 kDtRvPlic = 0, /**< rv_plic */
25 kDtRvPlicFirst = 0, /**< \internal First instance */
26 kDtRvPlicCount = 1, /**< \internal Number of instances */
28
29/**
30 * List of register blocks.
31 *
32 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
33 */
35 kDtRvPlicRegBlockCore = 0, /**< */
36 kDtRvPlicRegBlockCount = 1, /**< \internal Number of register blocks */
38
39/** Primary register block (associated with the "primary" set of registers that control the IP). */
40static const dt_rv_plic_reg_block_t kDtRvPlicRegBlockPrimary = kDtRvPlicRegBlockCore;
41
42/**
43 * List of clock ports.
44 *
45 * Clock ports are guaranteed to be numbered consecutively from 0.
46 */
47typedef enum dt_rv_plic_clock {
48 kDtRvPlicClockClk = 0, /**< Clock port clk_i */
49 kDtRvPlicClockCount = 1, /**< \internal Number of clock ports */
51
52/**
53 * List of reset ports.
54 *
55 * Reset ports are guaranteed to be numbered consecutively from 0.
56 */
57typedef enum dt_rv_plic_reset {
58 kDtRvPlicResetRst = 0, /**< Reset port rst_ni */
59 kDtRvPlicResetCount = 1, /**< \internal Number of reset ports */
61
62/**
63 * List of supported hardware features.
64 */
65#define OPENTITAN_RV_PLIC_HAS_PRIORITY 1
66#define OPENTITAN_RV_PLIC_HAS_ENABLE 1
67
68
69
70/**
71 * Get the rv_plic instance from an instance ID
72 *
73 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
74 *
75 * @param inst_id Instance ID.
76 * @return A rv_plic instance.
77 *
78 * **Note:** This function only makes sense if the instance ID has device type rv_plic,
79 * otherwise the returned value is unspecified.
80 */
82
83/**
84 * Get the instance ID of an instance.
85 *
86 * @param dt Instance of rv_plic.
87 * @return The instance ID of that instance.
88 */
90
91/**
92 * Get the register base address of an instance.
93 *
94 * @param dt Instance of rv_plic.
95 * @param reg_block The register block requested.
96 * @return The register base address of the requested block.
97 */
99 dt_rv_plic_t dt,
100 dt_rv_plic_reg_block_t reg_block);
101
102/**
103 * Get the primary register base address of an instance.
104 *
105 * This is just a convenience function, equivalent to
106 * `dt_rv_plic_reg_block(dt, kDtRvPlicRegBlockCore)`
107 *
108 * @param dt Instance of rv_plic.
109 * @return The register base address of the primary register block.
110 */
111static inline uint32_t dt_rv_plic_primary_reg_block(
112 dt_rv_plic_t dt) {
113 return dt_rv_plic_reg_block(dt, kDtRvPlicRegBlockCore);
114}
115
116
117
118
119/**
120 * Get the clock signal connected to a clock port of an instance.
121 *
122 * @param dt Instance of rv_plic.
123 * @param clk Clock port.
124 * @return Clock signal.
125 */
127 dt_rv_plic_t dt,
129
130/**
131 * Get the reset signal connected to a reset port of an instance.
132 *
133 * @param dt Instance of rv_plic.
134 * @param rst Reset port.
135 * @return Reset signal.
136 */
138 dt_rv_plic_t dt,
140
141
142
143#endif // OPENTITAN_DT_RV_PLIC_H_