Software APIs
cheriot.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_CHERIOT_H_
8#define OPENTITAN_DT_CHERIOT_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP cheriot and top earlgrey.
17 *
18 * This file contains the type definitions and global functions of the cheriot.
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_cheriot {
30 kDtCheriotFirst = 0, /**< First instance */
31 kDtCheriot = 0, /**< cheriot */
33
34enum {
35 kDtCheriotCount = 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 kDtCheriotRegBlockRegs = 0, /**< */
47
48enum {
49 kDtCheriotRegBlockCount = 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_cheriot_reg_block_t kDtCheriotRegBlockPrimary = kDtCheriotRegBlockRegs;
55
56/**
57 * List of memories.
58 *
59 * Memories are guaranteed to start at 0 and to be consecutively numbered.
60 */
61typedef enum dt_cheriot_memory {
62 kDtCheriotMemoryRevbm = 0, /**< */
64
65enum {
66 kDtCheriotMemoryCount = 1, /**< Number of memories */
67};
68
69
70/**
71 * List of Alerts.
72 *
73 * Alerts are guaranteed to be numbered consecutively from 0.
74 */
75typedef enum dt_cheriot_alert {
76 kDtCheriotAlertFatalFault = 0, /**< This fatal alert is triggered when an integrity fault is detected, when the meta
77 SRAM path returns a device error, or when the tag filter's transaction FIFO reports
78 a pointer error. */
80
81enum {
82 kDtCheriotAlertCount = 1, /**< Number of Alerts */
83};
84
85
86/**
87 * List of clock ports.
88 *
89 * Clock ports are guaranteed to be numbered consecutively from 0.
90 */
91typedef enum dt_cheriot_clock {
92 kDtCheriotClockClk = 0, /**< Clock port clk_i */
94
95enum {
96 kDtCheriotClockCount = 1, /**< Number of clock ports */
97};
98
99
100/**
101 * List of reset ports.
102 *
103 * Reset ports are guaranteed to be numbered consecutively from 0.
104 */
105typedef enum dt_cheriot_reset {
106 kDtCheriotResetRst = 0, /**< Reset port rst_ni */
108
109enum {
110 kDtCheriotResetCount = 1, /**< Number of reset ports */
111};
112
113
114/**
115 * List of supported hardware features.
116 */
117#define OPENTITAN_CHERIOT_HAS_TAG_SPLIT 1
118#define OPENTITAN_CHERIOT_HAS_TAG_READ 1
119#define OPENTITAN_CHERIOT_HAS_TAG_WRITE_RMW 1
120#define OPENTITAN_CHERIOT_HAS_TAG_CLEAR_ON_DATA_WRITE 1
121#define OPENTITAN_CHERIOT_HAS_REVOCATION_BITMAP 1
122#define OPENTITAN_CHERIOT_HAS_ACCESS_CHECK 1
123#define OPENTITAN_CHERIOT_HAS_MODE_GATING 1
124
125
126
127/**
128 * Get the cheriot instance from an instance ID
129 *
130 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
131 *
132 * @param inst_id Instance ID.
133 * @return A cheriot instance.
134 *
135 * **Note:** This function only makes sense if the instance ID has device type cheriot,
136 * otherwise the returned value is unspecified.
137 */
139
140/**
141 * Get the instance ID of an instance.
142 *
143 * @param dt Instance of cheriot.
144 * @return The instance ID of that instance.
145 */
147
148/**
149 * Get the register base address of an instance.
150 *
151 * @param dt Instance of cheriot.
152 * @param reg_block The register block requested.
153 * @return The register base address of the requested block.
154 */
155uint32_t dt_cheriot_reg_block(
156 dt_cheriot_t dt,
157 dt_cheriot_reg_block_t reg_block);
158
159/**
160 * Get the primary register base address of an instance.
161 *
162 * This is just a convenience function, equivalent to
163 * `dt_cheriot_reg_block(dt, kDtCheriotRegBlockRegs)`
164 *
165 * @param dt Instance of cheriot.
166 * @return The register base address of the primary register block.
167 */
168static inline uint32_t dt_cheriot_primary_reg_block(
169 dt_cheriot_t dt) {
170 return dt_cheriot_reg_block(dt, kDtCheriotRegBlockRegs);
171}
172
173/**
174 * Get the base address of a memory.
175 *
176 * @param dt Instance of cheriot.
177 * @param mem The memory requested.
178 * @return The base address of the requested memory.
179 */
181 dt_cheriot_t dt,
183
184/**
185 * Get the size of a memory.
186 *
187 * @param dt Instance of cheriot.
188 * @param mem The memory requested.
189 * @return The size of the requested memory.
190 */
192 dt_cheriot_t dt,
194
195
196/**
197 * Get the alert ID of a cheriot alert for a given instance.
198 *
199 * **Note:** This function only makes sense if the instance is connected to the Alert Handler. For any
200 * instances where the instance is not connected, the return value is unspecified.
201 *
202 * @param dt Instance of cheriot.
203 * @param alert A cheriot alert.
204 * @return The Alert Handler alert ID of the alert of this instance.
205 */
207 dt_cheriot_t dt,
208 dt_cheriot_alert_t alert);
209
210/**
211 * Convert a global alert ID to a local cheriot alert type.
212 *
213 * @param dt Instance of cheriot.
214 * @param alert A global alert ID that belongs to this instance.
215 * @return The cheriot alert, or `kDtCheriotAlertCount`.
216 *
217 * **Note:** This function assumes that the global alert ID belongs to the
218 * instance of cheriot passed in parameter. In other words, it must be the case
219 * that `dt_cheriot_instance_id(dt) == dt_alert_id_to_instance_id(alert)`. Otherwise,
220 * this function will return `kDtCheriotAlertCount`.
221 */
223 dt_cheriot_t dt,
224 dt_alert_id_t alert);
225
226
227
228/**
229 * Get the clock signal connected to a clock port of an instance.
230 *
231 * @param dt Instance of cheriot.
232 * @param clk Clock port.
233 * @return Clock signal.
234 */
236 dt_cheriot_t dt,
238
239/**
240 * Get the reset signal connected to a reset port of an instance.
241 *
242 * @param dt Instance of cheriot.
243 * @param rst Reset port.
244 * @return Reset signal.
245 */
247 dt_cheriot_t dt,
249
250
251
252#ifdef __cplusplus
253} // extern "C"
254#endif // __cplusplus
255
256#endif // OPENTITAN_DT_CHERIOT_H_