Software APIs
dt_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/dt_api.h"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_ast
{
30
kDtAst
= 0,
/**< ast */
31
kDtAstFirst = 0,
/**< \internal First instance */
32
kDtAstCount = 1,
/**< \internal Number of instances */
33
}
dt_ast_t
;
34
35
/**
36
* List of register blocks.
37
*
38
* Register blocks are guaranteed to start at 0 and to be consecutively numbered.
39
*/
40
typedef
enum
dt_ast_reg_block
{
41
kDtAstRegBlockCore = 0,
/**< */
42
kDtAstRegBlockCount = 1,
/**< \internal Number of register blocks */
43
}
dt_ast_reg_block_t
;
44
45
/** Primary register block (associated with the "primary" set of registers that control the IP). */
46
static
const
dt_ast_reg_block_t
kDtAstRegBlockPrimary = kDtAstRegBlockCore;
47
48
/**
49
* List of memories.
50
*
51
* Memories are guaranteed to start at 0 and to be consecutively numbered.
52
*/
53
typedef
enum
dt_ast_memory
{
54
kDtAstMemoryCount = 0,
/**< \internal Number of memories */
55
}
dt_ast_memory_t
;
56
57
/**
58
* List of clock ports.
59
*
60
* Clock ports are guaranteed to be numbered consecutively from 0.
61
*/
62
typedef
enum
dt_ast_clock
{
63
kDtAstClockAstTlul
= 0,
/**< Clock port clk_ast_tlul_i */
64
kDtAstClockAstAlert
= 1,
/**< Clock port clk_ast_alert_i */
65
kDtAstClockAstRng
= 2,
/**< Clock port clk_ast_rng_i */
66
kDtAstClockCount = 3,
/**< \internal Number of clock ports */
67
}
dt_ast_clock_t
;
68
69
/**
70
* List of reset ports.
71
*
72
* Reset ports are guaranteed to be numbered consecutively from 0.
73
*/
74
typedef
enum
dt_ast_reset
{
75
kDtAstResetAstTlul
= 0,
/**< Reset port rst_ast_tlul_ni */
76
kDtAstResetAstAlert
= 1,
/**< Reset port rst_ast_alert_ni */
77
kDtAstResetAstRng
= 2,
/**< Reset port rst_ast_rng_ni */
78
kDtAstResetCount = 3,
/**< \internal Number of reset ports */
79
}
dt_ast_reset_t
;
80
81
82
/**
83
* Get the ast instance from an instance ID
84
*
85
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
86
*
87
* @param inst_id Instance ID.
88
* @return A ast instance.
89
*
90
* **Note:** This function only makes sense if the instance ID has device type ast,
91
* otherwise the returned value is unspecified.
92
*/
93
dt_ast_t
dt_ast_from_instance_id
(
dt_instance_id_t
inst_id);
94
95
/**
96
* Get the instance ID of an instance.
97
*
98
* @param dt Instance of ast.
99
* @return The instance ID of that instance.
100
*/
101
dt_instance_id_t
dt_ast_instance_id
(
dt_ast_t
dt);
102
103
/**
104
* Get the register base address of an instance.
105
*
106
* @param dt Instance of ast.
107
* @param reg_block The register block requested.
108
* @return The register base address of the requested block.
109
*/
110
uint32_t
dt_ast_reg_block
(
111
dt_ast_t
dt,
112
dt_ast_reg_block_t
reg_block);
113
114
/**
115
* Get the primary register base address of an instance.
116
*
117
* This is just a convenience function, equivalent to
118
* `dt_ast_reg_block(dt, kDtAstRegBlockCore)`
119
*
120
* @param dt Instance of ast.
121
* @return The register base address of the primary register block.
122
*/
123
static
inline
uint32_t dt_ast_primary_reg_block(
124
dt_ast_t
dt) {
125
return
dt_ast_reg_block
(dt, kDtAstRegBlockCore);
126
}
127
128
/**
129
* Get the base address of a memory.
130
*
131
* @param dt Instance of ast.
132
* @param mem The memory requested.
133
* @return The base address of the requested memory.
134
*/
135
uint32_t
dt_ast_memory_base
(
136
dt_ast_t
dt,
137
dt_ast_memory_t
mem);
138
139
/**
140
* Get the size of a memory.
141
*
142
* @param dt Instance of ast.
143
* @param mem The memory requested.
144
* @return The size of the requested memory.
145
*/
146
uint32_t
dt_ast_memory_size
(
147
dt_ast_t
dt,
148
dt_ast_memory_t
mem);
149
150
151
152
153
/**
154
* Get the clock signal connected to a clock port of an instance.
155
*
156
* @param dt Instance of ast.
157
* @param clk Clock port.
158
* @return Clock signal.
159
*/
160
dt_clock_t
dt_ast_clock
(
161
dt_ast_t
dt,
162
dt_ast_clock_t
clk);
163
164
/**
165
* Get the reset signal connected to a reset port of an instance.
166
*
167
* @param dt Instance of ast.
168
* @param rst Reset port.
169
* @return Reset signal.
170
*/
171
dt_reset_t
dt_ast_reset
(
172
dt_ast_t
dt,
173
dt_ast_reset_t
rst);
174
175
176
177
#ifdef __cplusplus
178
}
// extern "C"
179
#endif
// __cplusplus
180
181
#endif
// OPENTITAN_DT_AST_H_
(darjeeling)
hw
top
dt
dt_ast.h
Return to
OpenTitan Documentation