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 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
*/
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
kDtAstClockAstAlert
= 1,
/**< Clock port clk_ast_alert_i */
64
kDtAstClockAstRng
= 2,
/**< Clock port clk_ast_rng_i */
65
}
dt_ast_clock_t
;
66
67
enum
{
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
*/
77
typedef
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 */
81
}
dt_ast_reset_t
;
82
83
enum
{
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
*/
100
dt_ast_t
dt_ast_from_instance_id
(
dt_instance_id_t
inst_id);
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
*/
108
dt_instance_id_t
dt_ast_instance_id
(
dt_ast_t
dt);
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
*/
117
uint32_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
*/
130
static
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
*/
145
dt_clock_t
dt_ast_clock
(
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
*/
156
dt_reset_t
dt_ast_reset
(
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_
(darjeeling)
hw
top
dt
ast.h
Return to
OpenTitan Documentation