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 * List of instances.
22 */
23typedef enum dt_otp_macro {
24 kDtOtpMacro = 0, /**< otp_macro */
25 kDtOtpMacroFirst = 0, /**< \internal First instance */
26 kDtOtpMacroCount = 1, /**< \internal Number of instances */
28
29/**
30 * List of register blocks.
31 *
32 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
33 */
35 kDtOtpMacroRegBlockCore = 0, /**< */
36 kDtOtpMacroRegBlockCount = 1, /**< \internal Number of register blocks */
38
39/** Primary register block (associated with the "primary" set of registers that control the IP). */
40static const dt_otp_macro_reg_block_t kDtOtpMacroRegBlockPrimary = kDtOtpMacroRegBlockCore;
41
42/**
43 * List of clock ports.
44 *
45 * Clock ports are guaranteed to be numbered consecutively from 0.
46 */
47typedef enum dt_otp_macro_clock {
48 kDtOtpMacroClockClk = 0, /**< Clock port clk_i */
49 kDtOtpMacroClockCount = 1, /**< \internal Number of clock ports */
51
52/**
53 * List of reset ports.
54 *
55 * Reset ports are guaranteed to be numbered consecutively from 0.
56 */
57typedef enum dt_otp_macro_reset {
58 kDtOtpMacroResetRst = 0, /**< Reset port rst_ni */
59 kDtOtpMacroResetCount = 1, /**< \internal Number of reset ports */
61
62/**
63 * List of peripheral I/O.
64 *
65 * Peripheral I/O are guaranteed to be numbered consecutively from 0.
66 */
68 kDtOtpMacroPeriphIoTest0 = 0, /**< */
69 kDtOtpMacroPeriphIoTest1 = 1, /**< */
70 kDtOtpMacroPeriphIoTest2 = 2, /**< */
71 kDtOtpMacroPeriphIoTest3 = 3, /**< */
72 kDtOtpMacroPeriphIoTest4 = 4, /**< */
73 kDtOtpMacroPeriphIoTest5 = 5, /**< */
74 kDtOtpMacroPeriphIoTest6 = 6, /**< */
75 kDtOtpMacroPeriphIoTest7 = 7, /**< */
76 kDtOtpMacroPeriphIoCount = 8, /**< \internal Number of peripheral I/O */
78
79
80/**
81 * Get the otp_macro instance from an instance ID
82 *
83 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
84 *
85 * @param inst_id Instance ID.
86 * @return A otp_macro instance.
87 *
88 * **Note:** This function only makes sense if the instance ID has device type otp_macro,
89 * otherwise the returned value is unspecified.
90 */
92
93/**
94 * Get the instance ID of an instance.
95 *
96 * @param dt Instance of otp_macro.
97 * @return The instance ID of that instance.
98 */
100
101/**
102 * Get the register base address of an instance.
103 *
104 * @param dt Instance of otp_macro.
105 * @param reg_block The register block requested.
106 * @return The register base address of the requested block.
107 */
110 dt_otp_macro_reg_block_t reg_block);
111
112/**
113 * Get the primary register base address of an instance.
114 *
115 * This is just a convenience function, equivalent to
116 * `dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockCore)`
117 *
118 * @param dt Instance of otp_macro.
119 * @return The register base address of the primary register block.
120 */
121static inline uint32_t dt_otp_macro_primary_reg_block(
122 dt_otp_macro_t dt) {
123 return dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockCore);
124}
125
126
127
128/**
129 * Get the peripheral I/O description of an instance.
130 *
131 * @param dt Instance of otp_macro.
132 * @param sig Requested peripheral I/O.
133 * @return Description of the requested peripheral I/O for this instance.
134 */
138
139/**
140 * Get the clock signal connected to a clock port of an instance.
141 *
142 * @param dt Instance of otp_macro.
143 * @param clk Clock port.
144 * @return Clock signal.
145 */
149
150/**
151 * Get the reset signal connected to a reset port of an instance.
152 *
153 * @param dt Instance of otp_macro.
154 * @param rst Reset port.
155 * @return Reset signal.
156 */
160
161
162
163#endif // OPENTITAN_DT_OTP_MACRO_H_