Software APIs
dt_racl_ctrl.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_RACL_CTRL_H_
8#define OPENTITAN_DT_RACL_CTRL_H_
9
10/**
11 * @file
12 * @brief Device Tables (DT) for IP racl_ctrl and top darjeeling.
13 *
14 * This file contains the type definitions and global functions of the racl_ctrl.
15 */
16
17#include "dt_api.h"
18#include <stdint.h>
19
20/**
21 * List of instances.
22 */
23typedef enum dt_racl_ctrl {
24 kDtRaclCtrl = 0, /**< racl_ctrl */
25 kDtRaclCtrlFirst = 0, /**< \internal First instance */
26 kDtRaclCtrlCount = 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 kDtRaclCtrlRegBlockCore = 0, /**< */
36 kDtRaclCtrlRegBlockCount = 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_racl_ctrl_reg_block_t kDtRaclCtrlRegBlockPrimary = kDtRaclCtrlRegBlockCore;
41
42/**
43 * List of IRQs.
44 *
45 * IRQs are guaranteed to be numbered consecutively from 0.
46 */
47typedef enum dt_racl_ctrl_irq {
48 kDtRaclCtrlIrqRaclError = 0, /**< RACL error has occurred. */
49 kDtRaclCtrlIrqCount = 1, /**< \internal Number of IRQs */
51
52/**
53 * List of Alerts.
54 *
55 * Alerts are guaranteed to be numbered consecutively from 0.
56 */
57typedef enum dt_racl_ctrl_alert {
58 kDtRaclCtrlAlertFatalFault = 0, /**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
59 kDtRaclCtrlAlertRecovCtrlUpdateErr = 1, /**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
60 kDtRaclCtrlAlertCount = 2, /**< \internal Number of Alerts */
62
63/**
64 * List of clock ports.
65 *
66 * Clock ports are guaranteed to be numbered consecutively from 0.
67 */
68typedef enum dt_racl_ctrl_clock {
69 kDtRaclCtrlClockClk = 0, /**< Clock port clk_i */
70 kDtRaclCtrlClockCount = 1, /**< \internal Number of clock ports */
72
73/**
74 * List of reset ports.
75 *
76 * Reset ports are guaranteed to be numbered consecutively from 0.
77 */
78typedef enum dt_racl_ctrl_reset {
79 kDtRaclCtrlResetRst = 0, /**< Reset port rst_ni */
80 kDtRaclCtrlResetCount = 1, /**< \internal Number of reset ports */
82
83
84/**
85 * Get the racl_ctrl instance from an instance ID
86 *
87 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
88 *
89 * @param inst_id Instance ID.
90 * @return A racl_ctrl instance.
91 *
92 * **Note:** This function only makes sense if the instance ID has device type racl_ctrl,
93 * otherwise the returned value is unspecified.
94 */
96
97/**
98 * Get the instance ID of an instance.
99 *
100 * @param dt Instance of racl_ctrl.
101 * @return The instance ID of that instance.
102 */
104
105/**
106 * Get the register base address of an instance.
107 *
108 * @param dt Instance of racl_ctrl.
109 * @param reg_block The register block requested.
110 * @return The register base address of the requested block.
111 */
114 dt_racl_ctrl_reg_block_t reg_block);
115
116/**
117 * Get the primary register base address of an instance.
118 *
119 * This is just a convenience function, equivalent to
120 * `dt_racl_ctrl_reg_block(dt, kDtRaclCtrlRegBlockCore)`
121 *
122 * @param dt Instance of racl_ctrl.
123 * @return The register base address of the primary register block.
124 */
125static inline uint32_t dt_racl_ctrl_primary_reg_block(
126 dt_racl_ctrl_t dt) {
127 return dt_racl_ctrl_reg_block(dt, kDtRaclCtrlRegBlockCore);
128}
129
130/**
131 * Get the PLIC ID of a racl_ctrl IRQ for a given instance.
132 *
133 * If the instance is not connected to the PLIC, this function
134 * will return `kDtPlicIrqIdNone`.
135 *
136 * @param dt Instance of racl_ctrl.
137 * @param irq A racl_ctrl IRQ.
138 * @return The PLIC ID of the IRQ of this instance.
139 */
143
144/**
145 * Convert a global IRQ ID to a local racl_ctrl IRQ type.
146 *
147 * @param dt Instance of racl_ctrl.
148 * @param irq A PLIC ID that belongs to this instance.
149 * @return The racl_ctrl IRQ, or `kDtRaclCtrlIrqCount`.
150 *
151 * **Note:** This function assumes that the PLIC ID belongs to the instance
152 * of racl_ctrl passed in parameter. In other words, it must be the case that
153 * `dt_racl_ctrl_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
154 * will return `kDtRaclCtrlIrqCount`.
155 */
158 dt_plic_irq_id_t irq);
159
160
161/**
162 * Get the alert ID of a racl_ctrl alert for a given instance.
163 *
164 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
165 * instances where the instance is not connected, the return value is unspecified.
166 *
167 * @param dt Instance of racl_ctrl.
168 * @param alert A racl_ctrl alert.
169 * @return The Alert Handler alert ID of the alert of this instance.
170 */
174
175/**
176 * Convert a global alert ID to a local racl_ctrl alert type.
177 *
178 * @param dt Instance of racl_ctrl.
179 * @param alert A global alert ID that belongs to this instance.
180 * @return The racl_ctrl alert, or `kDtRaclCtrlAlertCount`.
181 *
182 * **Note:** This function assumes that the global alert ID belongs to the
183 * instance of racl_ctrl passed in parameter. In other words, it must be the case
184 * that `dt_racl_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
185 * this function will return `kDtRaclCtrlAlertCount`.
186 */
189 dt_alert_id_t alert);
190
191
192
193/**
194 * Get the clock signal connected to a clock port of an instance.
195 *
196 * @param dt Instance of racl_ctrl.
197 * @param clk Clock port.
198 * @return Clock signal.
199 */
203
204/**
205 * Get the reset signal connected to a reset port of an instance.
206 *
207 * @param dt Instance of racl_ctrl.
208 * @param rst Reset port.
209 * @return Reset signal.
210 */
214
215
216
217#endif // OPENTITAN_DT_RACL_CTRL_H_