Software APIs
dt_otp_macro.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_OTP_MACRO_H_
8#define OPENTITAN_DT_OTP_MACRO_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP otp_macro and top darjeeling.
17 *
18 * This file contains the type definitions and global functions of the otp_macro.
19 */
20
21#include "hw/top/dt/dt_api.h"
22#include <stdint.h>
23
24
25
26/**
27 * List of instances.
28 */
29typedef enum dt_otp_macro {
30 kDtOtpMacro = 0, /**< otp_macro */
31 kDtOtpMacroFirst = 0, /**< \internal First instance */
32 kDtOtpMacroCount = 1, /**< \internal Number of instances */
34
35/**
36 * List of register blocks.
37 *
38 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
39 */
41 kDtOtpMacroRegBlockPrim = 0, /**< */
42 kDtOtpMacroRegBlockCount = 1, /**< \internal Number of register blocks */
44
45/** Primary register block (associated with the "primary" set of registers that control the IP). */
46static const dt_otp_macro_reg_block_t kDtOtpMacroRegBlockPrimary = kDtOtpMacroRegBlockPrim;
47
48/**
49 * List of memories.
50 *
51 * Memories are guaranteed to start at 0 and to be consecutively numbered.
52 */
53typedef enum dt_otp_macro_memory {
54 kDtOtpMacroMemoryCount = 0, /**< \internal Number of memories */
56
57/**
58 * List of clock ports.
59 *
60 * Clock ports are guaranteed to be numbered consecutively from 0.
61 */
62typedef enum dt_otp_macro_clock {
63 kDtOtpMacroClockClk = 0, /**< Clock port clk_i */
64 kDtOtpMacroClockCount = 1, /**< \internal Number of clock ports */
66
67/**
68 * List of reset ports.
69 *
70 * Reset ports are guaranteed to be numbered consecutively from 0.
71 */
72typedef enum dt_otp_macro_reset {
73 kDtOtpMacroResetRst = 0, /**< Reset port rst_ni */
74 kDtOtpMacroResetCount = 1, /**< \internal Number of reset ports */
76
77/**
78 * List of peripheral I/O.
79 *
80 * Peripheral I/O are guaranteed to be numbered consecutively from 0.
81 */
83 kDtOtpMacroPeriphIoTest0 = 0, /**< */
84 kDtOtpMacroPeriphIoTest1 = 1, /**< */
85 kDtOtpMacroPeriphIoTest2 = 2, /**< */
86 kDtOtpMacroPeriphIoTest3 = 3, /**< */
87 kDtOtpMacroPeriphIoTest4 = 4, /**< */
88 kDtOtpMacroPeriphIoTest5 = 5, /**< */
89 kDtOtpMacroPeriphIoTest6 = 6, /**< */
90 kDtOtpMacroPeriphIoTest7 = 7, /**< */
91 kDtOtpMacroPeriphIoCount = 8, /**< \internal Number of peripheral I/O */
93
94
95/**
96 * Get the otp_macro instance from an instance ID
97 *
98 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
99 *
100 * @param inst_id Instance ID.
101 * @return A otp_macro instance.
102 *
103 * **Note:** This function only makes sense if the instance ID has device type otp_macro,
104 * otherwise the returned value is unspecified.
105 */
107
108/**
109 * Get the instance ID of an instance.
110 *
111 * @param dt Instance of otp_macro.
112 * @return The instance ID of that instance.
113 */
115
116/**
117 * Get the register base address of an instance.
118 *
119 * @param dt Instance of otp_macro.
120 * @param reg_block The register block requested.
121 * @return The register base address of the requested block.
122 */
125 dt_otp_macro_reg_block_t reg_block);
126
127/**
128 * Get the primary register base address of an instance.
129 *
130 * This is just a convenience function, equivalent to
131 * `dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim)`
132 *
133 * @param dt Instance of otp_macro.
134 * @return The register base address of the primary register block.
135 */
136static inline uint32_t dt_otp_macro_primary_reg_block(
137 dt_otp_macro_t dt) {
138 return dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim);
139}
140
141/**
142 * Get the base address of a memory.
143 *
144 * @param dt Instance of otp_macro.
145 * @param mem The memory requested.
146 * @return The base address of the requested memory.
147 */
151
152/**
153 * Get the size of a memory.
154 *
155 * @param dt Instance of otp_macro.
156 * @param mem The memory requested.
157 * @return The size of the requested memory.
158 */
162
163
164
165/**
166 * Get the peripheral I/O description of an instance.
167 *
168 * @param dt Instance of otp_macro.
169 * @param sig Requested peripheral I/O.
170 * @return Description of the requested peripheral I/O for this instance.
171 */
175
176/**
177 * Get the clock signal connected to a clock port of an instance.
178 *
179 * @param dt Instance of otp_macro.
180 * @param clk Clock port.
181 * @return Clock signal.
182 */
186
187/**
188 * Get the reset signal connected to a reset port of an instance.
189 *
190 * @param dt Instance of otp_macro.
191 * @param rst Reset port.
192 * @return Reset signal.
193 */
197
198
199
200#ifdef __cplusplus
201} // extern "C"
202#endif // __cplusplus
203
204#endif // OPENTITAN_DT_OTP_MACRO_H_