Software APIs
pinmux.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_PINMUX_H_
8
#define OPENTITAN_DT_PINMUX_H_
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
// __cplusplus
13
14
/**
15
* @file
16
* @brief Device Tables (DT) for IP pinmux and top englishbreakfast.
17
*
18
* This file contains the type definitions and global functions of the pinmux.
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_pinmux
{
30
kDtPinmuxFirst
= 0,
/**< First instance */
31
kDtPinmuxAon
= 0,
/**< pinmux_aon */
32
}
dt_pinmux_t
;
33
34
enum
{
35
kDtPinmuxCount
= 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_pinmux_reg_block
{
45
kDtPinmuxRegBlockCore = 0,
/**< */
46
}
dt_pinmux_reg_block_t
;
47
48
enum
{
49
kDtPinmuxRegBlockCount
= 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_pinmux_reg_block_t
kDtPinmuxRegBlockPrimary = kDtPinmuxRegBlockCore;
55
56
/**
57
* List of clock ports.
58
*
59
* Clock ports are guaranteed to be numbered consecutively from 0.
60
*/
61
typedef
enum
dt_pinmux_clock
{
62
kDtPinmuxClockClk
= 0,
/**< Clock port clk_i */
63
kDtPinmuxClockAon
= 1,
/**< Clock port clk_aon_i */
64
}
dt_pinmux_clock_t
;
65
66
enum
{
67
kDtPinmuxClockCount
= 2,
/**< Number of clock ports */
68
};
69
70
71
/**
72
* List of reset ports.
73
*
74
* Reset ports are guaranteed to be numbered consecutively from 0.
75
*/
76
typedef
enum
dt_pinmux_reset
{
77
kDtPinmuxResetRst
= 0,
/**< Reset port rst_ni */
78
kDtPinmuxResetAon
= 1,
/**< Reset port rst_aon_ni */
79
kDtPinmuxResetSys
= 2,
/**< Reset port rst_sys_ni */
80
}
dt_pinmux_reset_t
;
81
82
enum
{
83
kDtPinmuxResetCount
= 3,
/**< Number of reset ports */
84
};
85
86
87
/**
88
* List of wakeups.
89
*
90
* Wakeups are guaranteed to be numbered consecutively from 0.
91
*/
92
typedef
enum
dt_pinmux_wakeup
{
93
kDtPinmuxWakeupPinWkupReq
= 0,
/**< pin wake request */
94
kDtPinmuxWakeupUsbWkupReq
= 1,
/**< usb wake request */
95
}
dt_pinmux_wakeup_t
;
96
97
enum
{
98
kDtPinmuxWakeupCount
= 2,
/**< Number of wakeups */
99
};
100
101
102
103
/**
104
* Get the pinmux instance from an instance ID
105
*
106
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
107
*
108
* @param inst_id Instance ID.
109
* @return A pinmux instance.
110
*
111
* **Note:** This function only makes sense if the instance ID has device type pinmux,
112
* otherwise the returned value is unspecified.
113
*/
114
dt_pinmux_t
dt_pinmux_from_instance_id
(
dt_instance_id_t
inst_id);
115
116
/**
117
* Get the instance ID of an instance.
118
*
119
* @param dt Instance of pinmux.
120
* @return The instance ID of that instance.
121
*/
122
dt_instance_id_t
dt_pinmux_instance_id
(
dt_pinmux_t
dt);
123
124
/**
125
* Get the register base address of an instance.
126
*
127
* @param dt Instance of pinmux.
128
* @param reg_block The register block requested.
129
* @return The register base address of the requested block.
130
*/
131
uint32_t
dt_pinmux_reg_block
(
132
dt_pinmux_t
dt,
133
dt_pinmux_reg_block_t
reg_block);
134
135
/**
136
* Get the primary register base address of an instance.
137
*
138
* This is just a convenience function, equivalent to
139
* `dt_pinmux_reg_block(dt, kDtPinmuxRegBlockCore)`
140
*
141
* @param dt Instance of pinmux.
142
* @return The register base address of the primary register block.
143
*/
144
static
inline
uint32_t dt_pinmux_primary_reg_block(
145
dt_pinmux_t
dt) {
146
return
dt_pinmux_reg_block
(dt, kDtPinmuxRegBlockCore);
147
}
148
149
150
151
152
/**
153
* Get the clock signal connected to a clock port of an instance.
154
*
155
* @param dt Instance of pinmux.
156
* @param clk Clock port.
157
* @return Clock signal.
158
*/
159
dt_clock_t
dt_pinmux_clock
(
160
dt_pinmux_t
dt,
161
dt_pinmux_clock_t
clk);
162
163
/**
164
* Get the reset signal connected to a reset port of an instance.
165
*
166
* @param dt Instance of pinmux.
167
* @param rst Reset port.
168
* @return Reset signal.
169
*/
170
dt_reset_t
dt_pinmux_reset
(
171
dt_pinmux_t
dt,
172
dt_pinmux_reset_t
rst);
173
174
175
176
#ifdef __cplusplus
177
}
// extern "C"
178
#endif
// __cplusplus
179
180
#endif
// OPENTITAN_DT_PINMUX_H_
(englishbreakfast)
hw
top
dt
pinmux.h
Return to
OpenTitan Documentation