Software APIs
ac_range_check.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_AC_RANGE_CHECK_H_
8#define OPENTITAN_DT_AC_RANGE_CHECK_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP ac_range_check and top darjeeling.
17 *
18 * This file contains the type definitions and global functions of the ac_range_check.
19 */
20
21#include "hw/top/dt/api.h"
22#include <stdint.h>
23
24
25
26
27
28/**
29 * List of instances.
30 */
31typedef enum dt_ac_range_check {
32 kDtAcRangeCheck = 0, /**< ac_range_check */
33 kDtAcRangeCheckFirst = 0, /**< \internal First instance */
34 kDtAcRangeCheckCount = 1, /**< \internal Number of instances */
36
37/**
38 * List of register blocks.
39 *
40 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
41 */
43 kDtAcRangeCheckRegBlockCore = 0, /**< */
44 kDtAcRangeCheckRegBlockCount = 1, /**< \internal Number of register blocks */
46
47/** Primary register block (associated with the "primary" set of registers that control the IP). */
48static const dt_ac_range_check_reg_block_t kDtAcRangeCheckRegBlockPrimary = kDtAcRangeCheckRegBlockCore;
49
50/**
51 * List of IRQs.
52 *
53 * IRQs are guaranteed to be numbered consecutively from 0.
54 */
56 kDtAcRangeCheckIrqDenyCntReached = 0, /**< Deny counter has exceeded threshold. */
57 kDtAcRangeCheckIrqCount = 1, /**< \internal Number of IRQs */
59
60/**
61 * List of Alerts.
62 *
63 * Alerts are guaranteed to be numbered consecutively from 0.
64 */
66 kDtAcRangeCheckAlertRecovCtrlUpdateErr = 0, /**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
67 kDtAcRangeCheckAlertFatalFault = 1, /**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected or the internal counter has an error. */
68 kDtAcRangeCheckAlertCount = 2, /**< \internal Number of Alerts */
70
71/**
72 * List of clock ports.
73 *
74 * Clock ports are guaranteed to be numbered consecutively from 0.
75 */
77 kDtAcRangeCheckClockClk = 0, /**< Clock port clk_i */
78 kDtAcRangeCheckClockCount = 1, /**< \internal Number of clock ports */
80
81/**
82 * List of reset ports.
83 *
84 * Reset ports are guaranteed to be numbered consecutively from 0.
85 */
87 kDtAcRangeCheckResetRst = 0, /**< Reset port rst_ni */
88 kDtAcRangeCheckResetCount = 1, /**< \internal Number of reset ports */
90
91
92/**
93 * Get the ac_range_check 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 ac_range_check instance.
99 *
100 * **Note:** This function only makes sense if the instance ID has device type ac_range_check,
101 * otherwise the returned value is unspecified.
102 */
104
105/**
106 * Get the instance ID of an instance.
107 *
108 * @param dt Instance of ac_range_check.
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 ac_range_check.
117 * @param reg_block The register block requested.
118 * @return The register base address of the requested block.
119 */
123
124/**
125 * Get the primary register base address of an instance.
126 *
127 * This is just a convenience function, equivalent to
128 * `dt_ac_range_check_reg_block(dt, kDtAcRangeCheckRegBlockCore)`
129 *
130 * @param dt Instance of ac_range_check.
131 * @return The register base address of the primary register block.
132 */
133static inline uint32_t dt_ac_range_check_primary_reg_block(
135 return dt_ac_range_check_reg_block(dt, kDtAcRangeCheckRegBlockCore);
136}
137
138/**
139 * Get the PLIC ID of a ac_range_check IRQ for a given instance.
140 *
141 * If the instance is not connected to the PLIC, this function
142 * will return `kDtPlicIrqIdNone`.
143 *
144 * @param dt Instance of ac_range_check.
145 * @param irq A ac_range_check IRQ.
146 * @return The PLIC ID of the IRQ of this instance.
147 */
151
152/**
153 * Convert a global IRQ ID to a local ac_range_check IRQ type.
154 *
155 * @param dt Instance of ac_range_check.
156 * @param irq A PLIC ID that belongs to this instance.
157 * @return The ac_range_check IRQ, or `kDtAcRangeCheckIrqCount`.
158 *
159 * **Note:** This function assumes that the PLIC ID belongs to the instance
160 * of ac_range_check passed in parameter. In other words, it must be the case that
161 * `dt_ac_range_check_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
162 * will return `kDtAcRangeCheckIrqCount`.
163 */
166 dt_plic_irq_id_t irq);
167
168
169/**
170 * Get the alert ID of a ac_range_check alert for a given instance.
171 *
172 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
173 * instances where the instance is not connected, the return value is unspecified.
174 *
175 * @param dt Instance of ac_range_check.
176 * @param alert A ac_range_check alert.
177 * @return The Alert Handler alert ID of the alert of this instance.
178 */
182
183/**
184 * Convert a global alert ID to a local ac_range_check alert type.
185 *
186 * @param dt Instance of ac_range_check.
187 * @param alert A global alert ID that belongs to this instance.
188 * @return The ac_range_check alert, or `kDtAcRangeCheckAlertCount`.
189 *
190 * **Note:** This function assumes that the global alert ID belongs to the
191 * instance of ac_range_check passed in parameter. In other words, it must be the case
192 * that `dt_ac_range_check_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
193 * this function will return `kDtAcRangeCheckAlertCount`.
194 */
197 dt_alert_id_t alert);
198
199
200
201/**
202 * Get the clock signal connected to a clock port of an instance.
203 *
204 * @param dt Instance of ac_range_check.
205 * @param clk Clock port.
206 * @return Clock signal.
207 */
211
212/**
213 * Get the reset signal connected to a reset port of an instance.
214 *
215 * @param dt Instance of ac_range_check.
216 * @param rst Reset port.
217 * @return Reset signal.
218 */
222
223
224
225/**
226 * Get the Number of range registers.
227 *
228 * @param dt Instance of ac_range_check.
229 * @return Number of range registers.
230 */
232
233
234
235#ifdef __cplusplus
236} // extern "C"
237#endif // __cplusplus
238
239#endif // OPENTITAN_DT_AC_RANGE_CHECK_H_