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 earlgrey.
17 *
18 * This file contains the type definitions and global functions of the otp_macro.
19 */
20
21#include "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 clock ports.
50 *
51 * Clock ports are guaranteed to be numbered consecutively from 0.
52 */
53typedef enum dt_otp_macro_clock {
54 kDtOtpMacroClockClk = 0, /**< Clock port clk_i */
55 kDtOtpMacroClockCount = 1, /**< \internal Number of clock ports */
57
58/**
59 * List of reset ports.
60 *
61 * Reset ports are guaranteed to be numbered consecutively from 0.
62 */
63typedef enum dt_otp_macro_reset {
64 kDtOtpMacroResetRst = 0, /**< Reset port rst_ni */
65 kDtOtpMacroResetCount = 1, /**< \internal Number of reset ports */
67
68/**
69 * List of peripheral I/O.
70 *
71 * Peripheral I/O are guaranteed to be numbered consecutively from 0.
72 */
74 kDtOtpMacroPeriphIoTest0 = 0, /**< */
75 kDtOtpMacroPeriphIoTest1 = 1, /**< */
76 kDtOtpMacroPeriphIoTest2 = 2, /**< */
77 kDtOtpMacroPeriphIoTest3 = 3, /**< */
78 kDtOtpMacroPeriphIoTest4 = 4, /**< */
79 kDtOtpMacroPeriphIoTest5 = 5, /**< */
80 kDtOtpMacroPeriphIoTest6 = 6, /**< */
81 kDtOtpMacroPeriphIoTest7 = 7, /**< */
82 kDtOtpMacroPeriphIoCount = 8, /**< \internal Number of peripheral I/O */
84
85
86/**
87 * Get the otp_macro instance from an instance ID
88 *
89 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
90 *
91 * @param inst_id Instance ID.
92 * @return A otp_macro instance.
93 *
94 * **Note:** This function only makes sense if the instance ID has device type otp_macro,
95 * otherwise the returned value is unspecified.
96 */
98
99/**
100 * Get the instance ID of an instance.
101 *
102 * @param dt Instance of otp_macro.
103 * @return The instance ID of that instance.
104 */
106
107/**
108 * Get the register base address of an instance.
109 *
110 * @param dt Instance of otp_macro.
111 * @param reg_block The register block requested.
112 * @return The register base address of the requested block.
113 */
116 dt_otp_macro_reg_block_t reg_block);
117
118/**
119 * Get the primary register base address of an instance.
120 *
121 * This is just a convenience function, equivalent to
122 * `dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim)`
123 *
124 * @param dt Instance of otp_macro.
125 * @return The register base address of the primary register block.
126 */
127static inline uint32_t dt_otp_macro_primary_reg_block(
128 dt_otp_macro_t dt) {
129 return dt_otp_macro_reg_block(dt, kDtOtpMacroRegBlockPrim);
130}
131
132
133
134/**
135 * Get the peripheral I/O description of an instance.
136 *
137 * @param dt Instance of otp_macro.
138 * @param sig Requested peripheral I/O.
139 * @return Description of the requested peripheral I/O for this instance.
140 */
144
145/**
146 * Get the clock signal connected to a clock port of an instance.
147 *
148 * @param dt Instance of otp_macro.
149 * @param clk Clock port.
150 * @return Clock signal.
151 */
155
156/**
157 * Get the reset signal connected to a reset port of an instance.
158 *
159 * @param dt Instance of otp_macro.
160 * @param rst Reset port.
161 * @return Reset signal.
162 */
166
167
168
169#ifdef __cplusplus
170} // extern "C"
171#endif // __cplusplus
172
173#endif // OPENTITAN_DT_OTP_MACRO_H_