Software APIs
dt_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 "
dt_api.h
"
22
#include <stdint.h>
23
24
25
26
/**
27
* List of instances.
28
*/
29
typedef
enum
dt_pinmux
{
30
kDtPinmuxAon
= 0,
/**< pinmux_aon */
31
kDtPinmuxFirst = 0,
/**< \internal First instance */
32
kDtPinmuxCount = 1,
/**< \internal Number of instances */
33
}
dt_pinmux_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_pinmux_reg_block
{
41
kDtPinmuxRegBlockCore = 0,
/**< */
42
kDtPinmuxRegBlockCount = 1,
/**< \internal Number of register blocks */
43
}
dt_pinmux_reg_block_t
;
44
45
/** Primary register block (associated with the "primary" set of registers that control the IP). */
46
static
const
dt_pinmux_reg_block_t
kDtPinmuxRegBlockPrimary = kDtPinmuxRegBlockCore;
47
48
/**
49
* List of clock ports.
50
*
51
* Clock ports are guaranteed to be numbered consecutively from 0.
52
*/
53
typedef
enum
dt_pinmux_clock
{
54
kDtPinmuxClockClk
= 0,
/**< Clock port clk_i */
55
kDtPinmuxClockAon
= 1,
/**< Clock port clk_aon_i */
56
kDtPinmuxClockCount = 2,
/**< \internal Number of clock ports */
57
}
dt_pinmux_clock_t
;
58
59
/**
60
* List of reset ports.
61
*
62
* Reset ports are guaranteed to be numbered consecutively from 0.
63
*/
64
typedef
enum
dt_pinmux_reset
{
65
kDtPinmuxResetRst
= 0,
/**< Reset port rst_ni */
66
kDtPinmuxResetAon
= 1,
/**< Reset port rst_aon_ni */
67
kDtPinmuxResetSys
= 2,
/**< Reset port rst_sys_ni */
68
kDtPinmuxResetCount = 3,
/**< \internal Number of reset ports */
69
}
dt_pinmux_reset_t
;
70
71
/**
72
* List of wakeups.
73
*
74
* Wakeups are guaranteed to be numbered consecutively from 0.
75
*/
76
typedef
enum
dt_pinmux_wakeup
{
77
kDtPinmuxWakeupPinWkupReq
= 0,
/**< pin wake request */
78
kDtPinmuxWakeupUsbWkupReq
= 1,
/**< usb wake request */
79
kDtPinmuxWakeupCount = 2,
/**< \internal Number of wakeups */
80
}
dt_pinmux_wakeup_t
;
81
82
83
/**
84
* Get the pinmux instance from an instance ID
85
*
86
* For example, `dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3`.
87
*
88
* @param inst_id Instance ID.
89
* @return A pinmux instance.
90
*
91
* **Note:** This function only makes sense if the instance ID has device type pinmux,
92
* otherwise the returned value is unspecified.
93
*/
94
dt_pinmux_t
dt_pinmux_from_instance_id
(
dt_instance_id_t
inst_id);
95
96
/**
97
* Get the instance ID of an instance.
98
*
99
* @param dt Instance of pinmux.
100
* @return The instance ID of that instance.
101
*/
102
dt_instance_id_t
dt_pinmux_instance_id
(
dt_pinmux_t
dt);
103
104
/**
105
* Get the register base address of an instance.
106
*
107
* @param dt Instance of pinmux.
108
* @param reg_block The register block requested.
109
* @return The register base address of the requested block.
110
*/
111
uint32_t
dt_pinmux_reg_block
(
112
dt_pinmux_t
dt,
113
dt_pinmux_reg_block_t
reg_block);
114
115
/**
116
* Get the primary register base address of an instance.
117
*
118
* This is just a convenience function, equivalent to
119
* `dt_pinmux_reg_block(dt, kDtPinmuxRegBlockCore)`
120
*
121
* @param dt Instance of pinmux.
122
* @return The register base address of the primary register block.
123
*/
124
static
inline
uint32_t dt_pinmux_primary_reg_block(
125
dt_pinmux_t
dt) {
126
return
dt_pinmux_reg_block
(dt, kDtPinmuxRegBlockCore);
127
}
128
129
130
131
132
/**
133
* Get the clock signal connected to a clock port of an instance.
134
*
135
* @param dt Instance of pinmux.
136
* @param clk Clock port.
137
* @return Clock signal.
138
*/
139
dt_clock_t
dt_pinmux_clock
(
140
dt_pinmux_t
dt,
141
dt_pinmux_clock_t
clk);
142
143
/**
144
* Get the reset signal connected to a reset port of an instance.
145
*
146
* @param dt Instance of pinmux.
147
* @param rst Reset port.
148
* @return Reset signal.
149
*/
150
dt_reset_t
dt_pinmux_reset
(
151
dt_pinmux_t
dt,
152
dt_pinmux_reset_t
rst);
153
154
155
156
#ifdef __cplusplus
157
}
// extern "C"
158
#endif
// __cplusplus
159
160
#endif
// OPENTITAN_DT_PINMUX_H_
(englishbreakfast)
hw
top
dt
dt_pinmux.h
Return to
OpenTitan Documentation