Zephyr API Documentation
3.6.0
A Scalable Open Source RTOS
3.6.0
Toggle main menu visibility
Main Page
Related Pages
Modules
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
pinctrl_soc_gd32_common.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Teslabs Engineering S.L.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
12
#ifndef ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_SOC_GD32_COMMON_H_
13
#define ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_SOC_GD32_COMMON_H_
14
15
#include <
zephyr/devicetree.h
>
16
#include <
zephyr/types.h
>
17
18
#ifdef CONFIG_PINCTRL_GD32_AF
19
#include <dt-bindings/pinctrl/gd32-af.h>
20
#else
21
#include <dt-bindings/pinctrl/gd32-afio.h>
22
#endif
/* CONFIG_PINCTRL_GD32_AF */
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
27
42
typedef
uint32_t
pinctrl_soc_pin_t;
43
51
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
52
(DT_PROP_BY_IDX(node_id, prop, idx) | \
53
((GD32_PUPD_PULLUP * DT_PROP(node_id, bias_pull_up)) \
54
<< GD32_PUPD_POS) | \
55
((GD32_PUPD_PULLDOWN * DT_PROP(node_id, bias_pull_down)) \
56
<< GD32_PUPD_POS) | \
57
((GD32_OTYPE_OD * DT_PROP(node_id, drive_open_drain)) \
58
<< GD32_OTYPE_POS) | \
59
(DT_ENUM_IDX(node_id, slew_rate) << GD32_OSPEED_POS)),
60
67
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \
68
{DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \
69
DT_FOREACH_PROP_ELEM, pinmux, \
70
Z_PINCTRL_STATE_PIN_INIT)}
71
80
#define GD32_PUPD_NONE 0U
82
#define GD32_PUPD_PULLUP 1U
84
#define GD32_PUPD_PULLDOWN 2U
85
94
#define GD32_OTYPE_PP 0U
96
#define GD32_OTYPE_OD 1U
97
106
#ifdef CONFIG_PINCTRL_GD32_AF
108
#define GD32_OSPEED_2MHZ 0U
109
#if defined(CONFIG_SOC_SERIES_GD32F3X0) || \
110
defined(CONFIG_SOC_SERIES_GD32A50X) || \
111
defined(CONFIG_SOC_SERIES_GD32L23X)
113
#define GD32_OSPEED_10MHZ 1U
115
#define GD32_OSPEED_50MHZ 3U
116
#else
118
#define GD32_OSPEED_25MHZ 1U
120
#define GD32_OSPEED_50MHZ 2U
122
#define GD32_OSPEED_MAX 3U
123
#endif
124
125
#else
/* CONFIG_PINCTRL_GD32_AF */
127
#define GD32_OSPEED_10MHZ 0U
129
#define GD32_OSPEED_2MHZ 1U
131
#define GD32_OSPEED_50MHZ 2U
133
#define GD32_OSPEED_MAX 3U
134
#endif
/* CONFIG_PINCTRL_GD32_AF */
135
152
#define GD32_PUPD_MSK 0x3U
154
#define GD32_PUPD_POS 29U
156
#define GD32_OTYPE_MSK 0x1U
158
#define GD32_OTYPE_POS 28U
160
#define GD32_OSPEED_MSK 0x3U
162
#define GD32_OSPEED_POS 26U
163
171
#define GD32_PUPD_GET(pincfg) \
172
(((pincfg) >> GD32_PUPD_POS) & GD32_PUPD_MSK)
173
179
#define GD32_OTYPE_GET(pincfg) \
180
(((pincfg) >> GD32_OTYPE_POS) & GD32_OTYPE_MSK)
181
187
#define GD32_OSPEED_GET(pincfg) \
188
(((pincfg) >> GD32_OSPEED_POS) & GD32_OSPEED_MSK)
189
190
#ifdef __cplusplus
191
}
192
#endif
193
194
#endif
/* ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_SOC_GD32_COMMON_H_ */
devicetree.h
Devicetree main header.
types.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition:
stdint.h:90
zephyr
drivers
pinctrl
pinctrl_soc_gd32_common.h
Generated on Sat Feb 24 2024 03:45:05 for Zephyr API Documentation by
1.9.6