Software APIs
ast.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_AST_H_
8#define OPENTITAN_DT_AST_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif // __cplusplus
13
14/**
15 * @file
16 * @brief Device Tables (DT) for IP ast and top earlgrey.
17 *
18 * This file contains the type definitions and global functions of the ast.
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_ast {
30 kDtAstFirst = 0, /**< First instance */
31 kDtAst = 0, /**< ast */
33
34enum {
35 kDtAstCount = 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 */
44typedef enum dt_ast_reg_block {
45 kDtAstRegBlockCore = 0, /**< */
47
48enum {
49 kDtAstRegBlockCount = 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_ast_reg_block_t kDtAstRegBlockPrimary = kDtAstRegBlockCore;
55
56/**
57 * List of clock ports.
58 *
59 * Clock ports are guaranteed to be numbered consecutively from 0.
60 */
61typedef enum dt_ast_clock {
62 kDtAstClockAstTlul = 0, /**< Clock port clk_ast_tlul_i */
63 kDtAstClockAstEs = 1, /**< Clock port clk_ast_es_i */
64 kDtAstClockAstUsb = 2, /**< Clock port clk_ast_usb_i */
65 kDtAstClockAstExt = 3, /**< Clock port clk_ast_ext_i */
66 kDtAstClockAstAdc = 4, /**< Clock port clk_ast_adc_i */
67 kDtAstClockAstAlert = 5, /**< Clock port clk_ast_alert_i */
68 kDtAstClockAstRng = 6, /**< Clock port clk_ast_rng_i */
70
71enum {
72 kDtAstClockCount = 7, /**< Number of clock ports */
73};
74
75
76/**
77 * List of reset ports.
78 *
79 * Reset ports are guaranteed to be numbered consecutively from 0.
80 */
81typedef enum dt_ast_reset {
82 kDtAstResetAstTlul = 0, /**< Reset port rst_ast_tlul_ni */
83 kDtAstResetAstEs = 1, /**< Reset port rst_ast_es_ni */
84 kDtAstResetAstUsb = 2, /**< Reset port rst_ast_usb_ni */
85 kDtAstResetAstAdc = 3, /**< Reset port rst_ast_adc_ni */
86 kDtAstResetAstAlert = 4, /**< Reset port rst_ast_alert_ni */
87 kDtAstResetAstRng = 5, /**< Reset port rst_ast_rng_ni */
89
90enum {
91 kDtAstResetCount = 6, /**< Number of reset ports */
92};
93
94
95
96/**
97 * Get the ast instance from an instance ID
98 *
99 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
100 *
101 * @param inst_id Instance ID.
102 * @return A ast instance.
103 *
104 * **Note:** This function only makes sense if the instance ID has device type ast,
105 * otherwise the returned value is unspecified.
106 */
108
109/**
110 * Get the instance ID of an instance.
111 *
112 * @param dt Instance of ast.
113 * @return The instance ID of that instance.
114 */
116
117/**
118 * Get the register base address of an instance.
119 *
120 * @param dt Instance of ast.
121 * @param reg_block The register block requested.
122 * @return The register base address of the requested block.
123 */
124uint32_t dt_ast_reg_block(
125 dt_ast_t dt,
126 dt_ast_reg_block_t reg_block);
127
128/**
129 * Get the primary register base address of an instance.
130 *
131 * This is just a convenience function, equivalent to
132 * `dt_ast_reg_block(dt, kDtAstRegBlockCore)`
133 *
134 * @param dt Instance of ast.
135 * @return The register base address of the primary register block.
136 */
137static inline uint32_t dt_ast_primary_reg_block(
138 dt_ast_t dt) {
139 return dt_ast_reg_block(dt, kDtAstRegBlockCore);
140}
141
142
143
144
145/**
146 * Get the clock signal connected to a clock port of an instance.
147 *
148 * @param dt Instance of ast.
149 * @param clk Clock port.
150 * @return Clock signal.
151 */
153 dt_ast_t dt,
154 dt_ast_clock_t clk);
155
156/**
157 * Get the reset signal connected to a reset port of an instance.
158 *
159 * @param dt Instance of ast.
160 * @param rst Reset port.
161 * @return Reset signal.
162 */
164 dt_ast_t dt,
165 dt_ast_reset_t rst);
166
167
168
169#ifdef __cplusplus
170} // extern "C"
171#endif // __cplusplus
172
173#endif // OPENTITAN_DT_AST_H_