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/**
11 * @file
12 * @brief Device Tables (DT) for IP otp_macro and top earlgrey.
13 *
14 * This file contains the type definitions and global functions of the otp_macro.
15 */
16
17#include "dt_api.h"
18#include <stdint.h>
19
20
21
22/**
23 * List of instances.
24 */
25typedef enum dt_otp_macro {
26 kDtOtpMacro = 0, /**< otp_macro */
27 kDtOtpMacroFirst = 0, /**< \internal First instance */
28 kDtOtpMacroCount = 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 kDtOtpMacroRegBlockPrim = 0, /**< */
38 kDtOtpMacroRegBlockCount = 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_otp_macro_reg_block_t kDtOtpMacroRegBlockPrimary = kDtOtpMacroRegBlockPrim;
43
44/**
45 * List of clock ports.
46 *
47 * Clock ports are guaranteed to be numbered consecutively from 0.
48 */
49typedef enum dt_otp_macro_clock {
50 kDtOtpMacroClockClk = 0, /**< Clock port clk_i */
51 kDtOtpMacroClockCount = 1, /**< \internal Number of clock ports */
53
54/**
55 * List of reset ports.
56 *
57 * Reset ports are guaranteed to be numbered consecutively from 0.
58 */
59typedef enum dt_otp_macro_reset {
60 kDtOtpMacroResetRst = 0, /**< Reset port rst_ni */
61 kDtOtpMacroResetCount = 1, /**< \internal Number of reset ports */
63
64/**
65 * List of peripheral I/O.
66 *
67 * Peripheral I/O are guaranteed to be numbered consecutively from 0.
68 */
70 kDtOtpMacroPeriphIoTest0 = 0, /**< */
71 kDtOtpMacroPeriphIoTest1 = 1, /**< */
72 kDtOtpMacroPeriphIoTest2 = 2, /**< */
73 kDtOtpMacroPeriphIoTest3 = 3, /**< */
74 kDtOtpMacroPeriphIoTest4 = 4, /**< */
75 kDtOtpMacroPeriphIoTest5 = 5, /**< */
76 kDtOtpMacroPeriphIoTest6 = 6, /**< */
77 kDtOtpMacroPeriphIoTest7 = 7, /**< */
78 kDtOtpMacroPeriphIoCount = 8, /**< \internal Number of peripheral I/O */
80
81
82/**
83 * Get the otp_macro instance from an instance ID
84 *
85 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
86 *
87 * @param inst_id Instance ID.
88 * @return A otp_macro instance.
89 *
90 * **Note:** This function only makes sense if the instance ID has device type otp_macro,
91 * otherwise the returned value is unspecified.
92 */
94
95/**
96 * Get the instance ID of an instance.
97 *
98 * @param dt Instance of otp_macro.
99 * @return The instance ID of that instance.
100 */
102
103/**
104 * Get the register base address of an instance.
105 *
106 * @param dt Instance of otp_macro.
107 * @param reg_block The register block requested.
108 * @return The register base address of the requested block.
109 */
112 dt_otp_macro_reg_block_t reg_block);
113
114/**
115 * Get the primary register base address of an instance.
116 *
117 * This is just a convenience function, equivalent to
118 * `dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim)`
119 *
120 * @param dt Instance of otp_macro.
121 * @return The register base address of the primary register block.
122 */
123static inline uint32_t dt_otp_macro_primary_reg_block(
124 dt_otp_macro_t dt) {
125 return dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim);
126}
127
128
129
130/**
131 * Get the peripheral I/O description of an instance.
132 *
133 * @param dt Instance of otp_macro.
134 * @param sig Requested peripheral I/O.
135 * @return Description of the requested peripheral I/O for this instance.
136 */
140
141/**
142 * Get the clock signal connected to a clock port of an instance.
143 *
144 * @param dt Instance of otp_macro.
145 * @param clk Clock port.
146 * @return Clock signal.
147 */
151
152/**
153 * Get the reset signal connected to a reset port of an instance.
154 *
155 * @param dt Instance of otp_macro.
156 * @param rst Reset port.
157 * @return Reset signal.
158 */
162
163
164
165#endif // OPENTITAN_DT_OTP_MACRO_H_