Software APIs
dt_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/**
11 * @file
12 * @brief Device Tables (DT) for IP ac_range_check and top darjeeling.
13 *
14 * This file contains the type definitions and global functions of the ac_range_check.
15 */
16
17#include "dt_api.h"
18#include <stdint.h>
19
20
21
22/**
23 * List of instances.
24 */
25typedef enum dt_ac_range_check {
26 kDtAcRangeCheck = 0, /**< ac_range_check */
27 kDtAcRangeCheckFirst = 0, /**< \internal First instance */
28 kDtAcRangeCheckCount = 1, /**< \internal Number of instances */
30
31/**
32 * List of register blocks.
33 *
34 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
35 */
37 kDtAcRangeCheckRegBlockCore = 0, /**< */
38 kDtAcRangeCheckRegBlockCount = 1, /**< \internal Number of register blocks */
40
41/** Primary register block (associated with the "primary" set of registers that control the IP). */
42static const dt_ac_range_check_reg_block_t kDtAcRangeCheckRegBlockPrimary = kDtAcRangeCheckRegBlockCore;
43
44/**
45 * List of IRQs.
46 *
47 * IRQs are guaranteed to be numbered consecutively from 0.
48 */
50 kDtAcRangeCheckIrqDenyCntReached = 0, /**< Deny counter has exceeded threshold. */
51 kDtAcRangeCheckIrqCount = 1, /**< \internal Number of IRQs */
53
54/**
55 * List of Alerts.
56 *
57 * Alerts are guaranteed to be numbered consecutively from 0.
58 */
60 kDtAcRangeCheckAlertRecovCtrlUpdateErr = 0, /**< This recoverable alert is triggered upon detecting an update error in the shadowed Control Register. */
61 kDtAcRangeCheckAlertFatalFault = 1, /**< This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected or the internal counter has an error. */
62 kDtAcRangeCheckAlertCount = 2, /**< \internal Number of Alerts */
64
65/**
66 * List of clock ports.
67 *
68 * Clock ports are guaranteed to be numbered consecutively from 0.
69 */
71 kDtAcRangeCheckClockClk = 0, /**< Clock port clk_i */
72 kDtAcRangeCheckClockCount = 1, /**< \internal Number of clock ports */
74
75/**
76 * List of reset ports.
77 *
78 * Reset ports are guaranteed to be numbered consecutively from 0.
79 */
81 kDtAcRangeCheckResetRst = 0, /**< Reset port rst_ni */
82 kDtAcRangeCheckResetCount = 1, /**< \internal Number of reset ports */
84
85
86/**
87 * Get the ac_range_check instance from an instance ID
88 *
89 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
90 *
91 * @param inst_id Instance ID.
92 * @return A ac_range_check instance.
93 *
94 * **Note:** This function only makes sense if the instance ID has device type ac_range_check,
95 * otherwise the returned value is unspecified.
96 */
98
99/**
100 * Get the instance ID of an instance.
101 *
102 * @param dt Instance of ac_range_check.
103 * @return The instance ID of that instance.
104 */
106
107/**
108 * Get the register base address of an instance.
109 *
110 * @param dt Instance of ac_range_check.
111 * @param reg_block The register block requested.
112 * @return The register base address of the requested block.
113 */
117
118/**
119 * Get the primary register base address of an instance.
120 *
121 * This is just a convenience function, equivalent to
122 * `dt_ac_range_check_reg_block(dt, kDtAcRangeCheckRegBlockCore)`
123 *
124 * @param dt Instance of ac_range_check.
125 * @return The register base address of the primary register block.
126 */
127static inline uint32_t dt_ac_range_check_primary_reg_block(
129 return dt_ac_range_check_reg_block(dt, kDtAcRangeCheckRegBlockCore);
130}
131
132/**
133 * Get the PLIC ID of a ac_range_check IRQ for a given instance.
134 *
135 * If the instance is not connected to the PLIC, this function
136 * will return `kDtPlicIrqIdNone`.
137 *
138 * @param dt Instance of ac_range_check.
139 * @param irq A ac_range_check IRQ.
140 * @return The PLIC ID of the IRQ of this instance.
141 */
145
146/**
147 * Convert a global IRQ ID to a local ac_range_check IRQ type.
148 *
149 * @param dt Instance of ac_range_check.
150 * @param irq A PLIC ID that belongs to this instance.
151 * @return The ac_range_check IRQ, or `kDtAcRangeCheckIrqCount`.
152 *
153 * **Note:** This function assumes that the PLIC ID belongs to the instance
154 * of ac_range_check passed in parameter. In other words, it must be the case that
155 * `dt_ac_range_check_instance_id(dt) == dt_plic_id_to_instance_id(irq)`. Otherwise, this function
156 * will return `kDtAcRangeCheckIrqCount`.
157 */
160 dt_plic_irq_id_t irq);
161
162
163/**
164 * Get the alert ID of a ac_range_check alert for a given instance.
165 *
166 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
167 * instances where the instance is not connected, the return value is unspecified.
168 *
169 * @param dt Instance of ac_range_check.
170 * @param alert A ac_range_check alert.
171 * @return The Alert Handler alert ID of the alert of this instance.
172 */
176
177/**
178 * Convert a global alert ID to a local ac_range_check alert type.
179 *
180 * @param dt Instance of ac_range_check.
181 * @param alert A global alert ID that belongs to this instance.
182 * @return The ac_range_check alert, or `kDtAcRangeCheckAlertCount`.
183 *
184 * **Note:** This function assumes that the global alert ID belongs to the
185 * instance of ac_range_check passed in parameter. In other words, it must be the case
186 * that `dt_ac_range_check_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
187 * this function will return `kDtAcRangeCheckAlertCount`.
188 */
191 dt_alert_id_t alert);
192
193
194
195/**
196 * Get the clock signal connected to a clock port of an instance.
197 *
198 * @param dt Instance of ac_range_check.
199 * @param clk Clock port.
200 * @return Clock signal.
201 */
205
206/**
207 * Get the reset signal connected to a reset port of an instance.
208 *
209 * @param dt Instance of ac_range_check.
210 * @param rst Reset port.
211 * @return Reset signal.
212 */
216
217
218
219#endif // OPENTITAN_DT_AC_RANGE_CHECK_H_