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/**
11 * @file
12 * @brief Device Tables (DT) for IP ast and top darjeeling.
13 *
14 * This file contains the type definitions and global functions of the ast.
15 */
16
17#include "dt_api.h"
18#include <stdint.h>
19
20/**
21 * List of instances.
22 */
23typedef enum dt_ast {
24 kDtAst = 0, /**< ast */
25 kDtAstFirst = 0, /**< \internal First instance */
26 kDtAstCount = 1, /**< \internal Number of instances */
28
29/**
30 * List of register blocks.
31 *
32 * Register blocks are guaranteed to start at 0 and to be consecutively numbered.
33 */
34typedef enum dt_ast_reg_block {
35 kDtAstRegBlockCore = 0, /**< */
36 kDtAstRegBlockCount = 1, /**< \internal Number of register blocks */
38
39/** Primary register block (associated with the "primary" set of registers that control the IP). */
40static const dt_ast_reg_block_t kDtAstRegBlockPrimary = kDtAstRegBlockCore;
41
42/**
43 * List of clock ports.
44 *
45 * Clock ports are guaranteed to be numbered consecutively from 0.
46 */
47typedef enum dt_ast_clock {
48 kDtAstClockAstTlul = 0, /**< Clock port clk_ast_tlul_i */
49 kDtAstClockAstAdc = 1, /**< Clock port clk_ast_adc_i */
50 kDtAstClockAstAlert = 2, /**< Clock port clk_ast_alert_i */
51 kDtAstClockAstEs = 3, /**< Clock port clk_ast_es_i */
52 kDtAstClockAstRng = 4, /**< Clock port clk_ast_rng_i */
53 kDtAstClockCount = 5, /**< \internal Number of clock ports */
55
56/**
57 * List of reset ports.
58 *
59 * Reset ports are guaranteed to be numbered consecutively from 0.
60 */
61typedef enum dt_ast_reset {
62 kDtAstResetAstTlul = 0, /**< Reset port rst_ast_tlul_ni */
63 kDtAstResetAstAdc = 1, /**< Reset port rst_ast_adc_ni */
64 kDtAstResetAstAlert = 2, /**< Reset port rst_ast_alert_ni */
65 kDtAstResetAstEs = 3, /**< Reset port rst_ast_es_ni */
66 kDtAstResetAstRng = 4, /**< Reset port rst_ast_rng_ni */
67 kDtAstResetCount = 5, /**< \internal Number of reset ports */
69
70
71/**
72 * Get the ast instance from an instance ID
73 *
74 * For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
75 *
76 * @param inst_id Instance ID.
77 * @return A ast instance.
78 *
79 * **Note:** This function only makes sense if the instance ID has device type ast,
80 * otherwise the returned value is unspecified.
81 */
83
84/**
85 * Get the instance ID of an instance.
86 *
87 * @param dt Instance of ast.
88 * @return The instance ID of that instance.
89 */
91
92/**
93 * Get the register base address of an instance.
94 *
95 * @param dt Instance of ast.
96 * @param reg_block The register block requested.
97 * @return The register base address of the requested block.
98 */
99uint32_t dt_ast_reg_block(
100 dt_ast_t dt,
101 dt_ast_reg_block_t reg_block);
102
103/**
104 * Get the primary register base address of an instance.
105 *
106 * This is just a convenience function, equivalent to
107 * `dt_ast_reg_block(dt, kDtAstRegBlockCore)`
108 *
109 * @param dt Instance of ast.
110 * @return The register base address of the primary register block.
111 */
112static inline uint32_t dt_ast_primary_reg_block(
113 dt_ast_t dt) {
114 return dt_ast_reg_block(dt, kDtAstRegBlockCore);
115}
116
117
118
119
120/**
121 * Get the clock signal connected to a clock port of an instance.
122 *
123 * @param dt Instance of ast.
124 * @param clk Clock port.
125 * @return Clock signal.
126 */
128 dt_ast_t dt,
129 dt_ast_clock_t clk);
130
131/**
132 * Get the reset signal connected to a reset port of an instance.
133 *
134 * @param dt Instance of ast.
135 * @param rst Reset port.
136 * @return Reset signal.
137 */
139 dt_ast_t dt,
140 dt_ast_reset_t rst);
141
142
143
144#endif // OPENTITAN_DT_AST_H_