Software APIs
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#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP racl_ctrl and top darjeeling.
17 *
18 * This file contains the type definitions and global functions of the racl_ctrl.
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_racl_ctrl {
30 kDtRaclCtrlFirst = 0, /**< First instance */
31 kDtRaclCtrl = 0, /**< racl_ctrl */
33
34enum {
35 kDtRaclCtrlCount = 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 kDtRaclCtrlRegBlockCore = 0, /**< */
47
48enum {
49 kDtRaclCtrlRegBlockCount = 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_racl_ctrl_reg_block_t kDtRaclCtrlRegBlockPrimary = kDtRaclCtrlRegBlockCore;
55
56/**
57 * List of IRQs.
58 *
59 * IRQs are guaranteed to be numbered consecutively from 0.
60 */
61typedef enum dt_racl_ctrl_irq {
62 kDtRaclCtrlIrqRaclError = 0, /**< RACL error has occurred. */
64
65enum {
66 kDtRaclCtrlIrqCount = 1, /**< Number of IRQs */
67};
68
69
70/**
71 * List of Alerts.
72 *
73 * Alerts are guaranteed to be numbered consecutively from 0.
74 */
75typedef enum dt_racl_ctrl_alert {
76 kDtRaclCtrlAlertFatalFault = 0, /**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected. */
77 kDtRaclCtrlAlertRecovCtrlUpdateErr = 1, /**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
79
80enum {
81 kDtRaclCtrlAlertCount = 2, /**< Number of Alerts */
82};
83
84
85/**
86 * List of clock ports.
87 *
88 * Clock ports are guaranteed to be numbered consecutively from 0.
89 */
90typedef enum dt_racl_ctrl_clock {
91 kDtRaclCtrlClockClk = 0, /**< Clock port clk_i */
93
94enum {
95 kDtRaclCtrlClockCount = 1, /**< Number of clock ports */
96};
97
98
99/**
100 * List of reset ports.
101 *
102 * Reset ports are guaranteed to be numbered consecutively from 0.
103 */
104typedef enum dt_racl_ctrl_reset {
105 kDtRaclCtrlResetRst = 0, /**< Reset port rst_ni */
107
108enum {
109 kDtRaclCtrlResetCount = 1, /**< Number of reset ports */
110};
111
112
113
114/**
115 * Get the racl_ctrl instance from an instance ID
116 *
117 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
118 *
119 * @param inst_id Instance ID.
120 * @return A racl_ctrl instance.
121 *
122 * **Note:** This function only makes sense if the instance ID has device type racl_ctrl,
123 * otherwise the returned value is unspecified.
124 */
126
127/**
128 * Get the instance ID of an instance.
129 *
130 * @param dt Instance of racl_ctrl.
131 * @return The instance ID of that instance.
132 */
134
135/**
136 * Get the register base address of an instance.
137 *
138 * @param dt Instance of racl_ctrl.
139 * @param reg_block The register block requested.
140 * @return The register base address of the requested block.
141 */
144 dt_racl_ctrl_reg_block_t reg_block);
145
146/**
147 * Get the primary register base address of an instance.
148 *
149 * This is just a convenience function, equivalent to
150 * `dt_racl_ctrl_reg_block(dt, kDtRaclCtrlRegBlockCore)`
151 *
152 * @param dt Instance of racl_ctrl.
153 * @return The register base address of the primary register block.
154 */
155static inline uint32_t dt_racl_ctrl_primary_reg_block(
156 dt_racl_ctrl_t dt) {
157 return dt_racl_ctrl_reg_block(dt, kDtRaclCtrlRegBlockCore);
158}
159
160/**
161 * Get the PLIC ID of a racl_ctrl IRQ for a given instance.
162 *
163 * If the instance is not connected to the PLIC, this function
164 * will return `kDtPlicIrqIdNone`.
165 *
166 * @param dt Instance of racl_ctrl.
167 * @param irq A racl_ctrl IRQ.
168 * @return The PLIC ID of the IRQ of this instance.
169 */
173
174/**
175 * Convert a global IRQ ID to a local racl_ctrl IRQ type.
176 *
177 * @param dt Instance of racl_ctrl.
178 * @param irq A PLIC ID that belongs to this instance.
179 * @return The racl_ctrl IRQ, or `kDtRaclCtrlIrqCount`.
180 *
181 * **Note:** This function assumes that the PLIC ID belongs to the instance
182 * of racl_ctrl passed in parameter. In other words, it must be the case that
183 * `dt_racl_ctrl_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
184 * will return `kDtRaclCtrlIrqCount`.
185 */
188 dt_plic_irq_id_t irq);
189
190
191/**
192 * Get the alert ID of a racl_ctrl alert for a given instance.
193 *
194 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
195 * instances where the instance is not connected, the return value is unspecified.
196 *
197 * @param dt Instance of racl_ctrl.
198 * @param alert A racl_ctrl alert.
199 * @return The Alert Handler alert ID of the alert of this instance.
200 */
204
205/**
206 * Convert a global alert ID to a local racl_ctrl alert type.
207 *
208 * @param dt Instance of racl_ctrl.
209 * @param alert A global alert ID that belongs to this instance.
210 * @return The racl_ctrl alert, or `kDtRaclCtrlAlertCount`.
211 *
212 * **Note:** This function assumes that the global alert ID belongs to the
213 * instance of racl_ctrl passed in parameter. In other words, it must be the case
214 * that `dt_racl_ctrl_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
215 * this function will return `kDtRaclCtrlAlertCount`.
216 */
219 dt_alert_id_t alert);
220
221
222
223/**
224 * Get the clock signal connected to a clock port of an instance.
225 *
226 * @param dt Instance of racl_ctrl.
227 * @param clk Clock port.
228 * @return Clock signal.
229 */
233
234/**
235 * Get the reset signal connected to a reset port of an instance.
236 *
237 * @param dt Instance of racl_ctrl.
238 * @param rst Reset port.
239 * @return Reset signal.
240 */
244
245
246
247#ifdef __cplusplus
248} // extern "C"
249#endif // __cplusplus
250
251#endif // OPENTITAN_DT_RACL_CTRL_H_