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 kDtAstClockAstAdc = 1, /**< Clock port clk_ast_adc_i */
64 kDtAstClockAstAlert = 2, /**< Clock port clk_ast_alert_i */
65 kDtAstClockAstEs = 3, /**< Clock port clk_ast_es_i */
66 kDtAstClockAstRng = 4, /**< Clock port clk_ast_rng_i */
67 kDtAstClockAstUsb = 5, /**< Clock port clk_ast_usb_i */
69
70enum {
71 kDtAstClockCount = 6, /**< Number of clock ports */
72};
73
74
75/**
76 * List of reset ports.
77 *
78 * Reset ports are guaranteed to be numbered consecutively from 0.
79 */
80typedef enum dt_ast_reset {
81 kDtAstResetAstTlul = 0, /**< Reset port rst_ast_tlul_ni */
82 kDtAstResetAstAdc = 1, /**< Reset port rst_ast_adc_ni */
83 kDtAstResetAstAlert = 2, /**< Reset port rst_ast_alert_ni */
84 kDtAstResetAstEs = 3, /**< Reset port rst_ast_es_ni */
85 kDtAstResetAstRng = 4, /**< Reset port rst_ast_rng_ni */
86 kDtAstResetAstUsb = 5, /**< Reset port rst_ast_usb_ni */
88
89enum {
90 kDtAstResetCount = 6, /**< Number of reset ports */
91};
92
93
94
95/**
96 * Get the ast instance from an instance ID
97 *
98 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
99 *
100 * @param inst_id Instance ID.
101 * @return A ast instance.
102 *
103 * **Note:** This function only makes sense if the instance ID has device type ast,
104 * otherwise the returned value is unspecified.
105 */
107
108/**
109 * Get the instance ID of an instance.
110 *
111 * @param dt Instance of ast.
112 * @return The instance ID of that instance.
113 */
115
116/**
117 * Get the register base address of an instance.
118 *
119 * @param dt Instance of ast.
120 * @param reg_block The register block requested.
121 * @return The register base address of the requested block.
122 */
123uint32_t dt_ast_reg_block(
124 dt_ast_t dt,
125 dt_ast_reg_block_t reg_block);
126
127/**
128 * Get the primary register base address of an instance.
129 *
130 * This is just a convenience function, equivalent to
131 * `dt_ast_reg_block(dt, kDtAstRegBlockCore)`
132 *
133 * @param dt Instance of ast.
134 * @return The register base address of the primary register block.
135 */
136static inline uint32_t dt_ast_primary_reg_block(
137 dt_ast_t dt) {
138 return dt_ast_reg_block(dt, kDtAstRegBlockCore);
139}
140
141
142
143
144/**
145 * Get the clock signal connected to a clock port of an instance.
146 *
147 * @param dt Instance of ast.
148 * @param clk Clock port.
149 * @return Clock signal.
150 */
152 dt_ast_t dt,
153 dt_ast_clock_t clk);
154
155/**
156 * Get the reset signal connected to a reset port of an instance.
157 *
158 * @param dt Instance of ast.
159 * @param rst Reset port.
160 * @return Reset signal.
161 */
163 dt_ast_t dt,
164 dt_ast_reset_t rst);
165
166
167
168#ifdef __cplusplus
169} // extern "C"
170#endif // __cplusplus
171
172#endif // OPENTITAN_DT_AST_H_