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