Software APIs
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 earlgrey.
17 *
18 * This file contains the type definitions and global functions of the otp_macro.
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_otp_macro {
30 kDtOtpMacroFirst = 0, /**< First instance */
31 kDtOtpMacro = 0, /**< otp_macro */
33
34enum {
35 kDtOtpMacroCount = 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 kDtOtpMacroRegBlockPrim = 0, /**< */
47
48enum {
49 kDtOtpMacroRegBlockCount = 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_otp_macro_reg_block_t kDtOtpMacroRegBlockPrimary = kDtOtpMacroRegBlockPrim;
55
56/**
57 * List of clock ports.
58 *
59 * Clock ports are guaranteed to be numbered consecutively from 0.
60 */
61typedef enum dt_otp_macro_clock {
62 kDtOtpMacroClockClk = 0, /**< Clock port clk_i */
64
65enum {
66 kDtOtpMacroClockCount = 1, /**< Number of clock ports */
67};
68
69
70/**
71 * List of reset ports.
72 *
73 * Reset ports are guaranteed to be numbered consecutively from 0.
74 */
75typedef enum dt_otp_macro_reset {
76 kDtOtpMacroResetRst = 0, /**< Reset port rst_ni */
78
79enum {
80 kDtOtpMacroResetCount = 1, /**< Number of reset ports */
81};
82
83
84/**
85 * List of peripheral I/O.
86 *
87 * Peripheral I/O are guaranteed to be numbered consecutively from 0.
88 */
90 kDtOtpMacroPeriphIoTest0 = 0, /**< */
91 kDtOtpMacroPeriphIoTest1 = 1, /**< */
92 kDtOtpMacroPeriphIoTest2 = 2, /**< */
93 kDtOtpMacroPeriphIoTest3 = 3, /**< */
94 kDtOtpMacroPeriphIoTest4 = 4, /**< */
95 kDtOtpMacroPeriphIoTest5 = 5, /**< */
96 kDtOtpMacroPeriphIoTest6 = 6, /**< */
97 kDtOtpMacroPeriphIoTest7 = 7, /**< */
99
100enum {
101 kDtOtpMacroPeriphIoCount = 8, /**< Number of peripheral I/O */
102};
103
104
105
106/**
107 * Get the otp_macro instance from an instance ID
108 *
109 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
110 *
111 * @param inst_id Instance ID.
112 * @return A otp_macro instance.
113 *
114 * **Note:** This function only makes sense if the instance ID has device type otp_macro,
115 * otherwise the returned value is unspecified.
116 */
118
119/**
120 * Get the instance ID of an instance.
121 *
122 * @param dt Instance of otp_macro.
123 * @return The instance ID of that instance.
124 */
126
127/**
128 * Get the register base address of an instance.
129 *
130 * @param dt Instance of otp_macro.
131 * @param reg_block The register block requested.
132 * @return The register base address of the requested block.
133 */
136 dt_otp_macro_reg_block_t reg_block);
137
138/**
139 * Get the primary register base address of an instance.
140 *
141 * This is just a convenience function, equivalent to
142 * `dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim)`
143 *
144 * @param dt Instance of otp_macro.
145 * @return The register base address of the primary register block.
146 */
147static inline uint32_t dt_otp_macro_primary_reg_block(
148 dt_otp_macro_t dt) {
149 return dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim);
150}
151
152
153
154/**
155 * Get the peripheral I/O description of an instance.
156 *
157 * @param dt Instance of otp_macro.
158 * @param sig Requested peripheral I/O.
159 * @return Description of the requested peripheral I/O for this instance.
160 */
164
165/**
166 * Get the clock signal connected to a clock port of an instance.
167 *
168 * @param dt Instance of otp_macro.
169 * @param clk Clock port.
170 * @return Clock signal.
171 */
175
176/**
177 * Get the reset signal connected to a reset port of an instance.
178 *
179 * @param dt Instance of otp_macro.
180 * @param rst Reset port.
181 * @return Reset signal.
182 */
186
187
188
189#ifdef __cplusplus
190} // extern "C"
191#endif // __cplusplus
192
193#endif // OPENTITAN_DT_OTP_MACRO_H_