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
11
extern
"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
*/
29
typedef
enum
dt_ast
{
30
kDtAstFirst
= 0,
/**< First instance */
31
kDtAst
= 0,
/**< ast */
32
}
dt_ast_t
;
33
34
enum
{
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
*/
44
typedef
enum
dt_ast_reg_block
{
45
kDtAstRegBlockCore = 0,
/**< */
46
}
dt_ast_reg_block_t
;
47
48
enum
{
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). */
54
static
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
*/
61
typedef
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
}
dt_ast_clock_t
;
67
68
enum
{
69
kDtAstClockCount
= 4,
/**< Number of clock ports */
70
};
71
72
73
/**
74
* List of reset ports.
75
*
76
* Reset ports are guaranteed to be numbered consecutively from 0.
77
*/
78
typedef
enum
dt_ast_reset
{
79
kDtAstResetAstTlul
= 0,
/**< Reset port rst_ast_tlul_ni */
80
kDtAstResetAstEs
= 1,
/**< Reset port rst_ast_es_ni */
81
kDtAstResetAstUsb
= 2,
/**< Reset port rst_ast_usb_ni */
82
}
dt_ast_reset_t
;
83
84
enum
{
85
kDtAstResetCount
= 3,
/**< Number of reset ports */
86
};
87
88
89
90
/**
91
* Get the ast instance from an instance ID
92
*
93
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
94
*
95
* @param inst_id Instance ID.
96
* @return A ast instance.
97
*
98
* **Note:** This function only makes sense if the instance ID has device type ast,
99
* otherwise the returned value is unspecified.
100
*/
101
dt_ast_t
dt_ast_from_instance_id
(
dt_instance_id_t
inst_id);
102
103
/**
104
* Get the instance ID of an instance.
105
*
106
* @param dt Instance of ast.
107
* @return The instance ID of that instance.
108
*/
109
dt_instance_id_t
dt_ast_instance_id
(
dt_ast_t
dt);
110
111
/**
112
* Get the register base address of an instance.
113
*
114
* @param dt Instance of ast.
115
* @param reg_block The register block requested.
116
* @return The register base address of the requested block.
117
*/
118
uint32_t
dt_ast_reg_block
(
119
dt_ast_t
dt,
120
dt_ast_reg_block_t
reg_block);
121
122
/**
123
* Get the primary register base address of an instance.
124
*
125
* This is just a convenience function, equivalent to
126
* `dt_ast_reg_block(dt, kDtAstRegBlockCore)`
127
*
128
* @param dt Instance of ast.
129
* @return The register base address of the primary register block.
130
*/
131
static
inline
uint32_t dt_ast_primary_reg_block(
132
dt_ast_t
dt) {
133
return
dt_ast_reg_block
(dt, kDtAstRegBlockCore);
134
}
135
136
137
138
139
/**
140
* Get the clock signal connected to a clock port of an instance.
141
*
142
* @param dt Instance of ast.
143
* @param clk Clock port.
144
* @return Clock signal.
145
*/
146
dt_clock_t
dt_ast_clock
(
147
dt_ast_t
dt,
148
dt_ast_clock_t
clk);
149
150
/**
151
* Get the reset signal connected to a reset port of an instance.
152
*
153
* @param dt Instance of ast.
154
* @param rst Reset port.
155
* @return Reset signal.
156
*/
157
dt_reset_t
dt_ast_reset
(
158
dt_ast_t
dt,
159
dt_ast_reset_t
rst);
160
161
162
163
#ifdef __cplusplus
164
}
// extern "C"
165
#endif
// __cplusplus
166
167
#endif
// OPENTITAN_DT_AST_H_
(earlgrey)
hw
top
dt
ast.h
Return to
OpenTitan Documentation