Zephyr API Documentation
4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gd32f527-clocks.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2026 GigaDevice Semiconductor Inc.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
11
12
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_GD32F527_CLOCKS_H_
13
#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_GD32F527_CLOCKS_H_
14
15
#include "
gd32-clocks-common.h
"
16
21
22
#define GD32_AHB1EN_OFFSET 0x30U
23
#define GD32_AHB2EN_OFFSET 0x34U
24
#define GD32_APB1EN_OFFSET 0x40U
25
#define GD32_APB2EN_OFFSET 0x44U
26
28
33
34
/* AHB1 peripherals */
35
#define GD32_CLOCK_GPIOA GD32_CLOCK_CONFIG(AHB1EN, 0U)
36
#define GD32_CLOCK_GPIOB GD32_CLOCK_CONFIG(AHB1EN, 1U)
37
#define GD32_CLOCK_GPIOC GD32_CLOCK_CONFIG(AHB1EN, 2U)
38
#define GD32_CLOCK_GPIOD GD32_CLOCK_CONFIG(AHB1EN, 3U)
39
#define GD32_CLOCK_GPIOE GD32_CLOCK_CONFIG(AHB1EN, 4U)
40
#define GD32_CLOCK_GPIOF GD32_CLOCK_CONFIG(AHB1EN, 5U)
41
#define GD32_CLOCK_GPIOG GD32_CLOCK_CONFIG(AHB1EN, 6U)
42
#define GD32_CLOCK_GPIOH GD32_CLOCK_CONFIG(AHB1EN, 7U)
43
#define GD32_CLOCK_GPIOI GD32_CLOCK_CONFIG(AHB1EN, 8U)
44
#define GD32_CLOCK_CRC GD32_CLOCK_CONFIG(AHB1EN, 12U)
45
#define GD32_CLOCK_BKPSRAM GD32_CLOCK_CONFIG(AHB1EN, 18U)
46
#define GD32_CLOCK_DMA0 GD32_CLOCK_CONFIG(AHB1EN, 21U)
47
#define GD32_CLOCK_DMA1 GD32_CLOCK_CONFIG(AHB1EN, 22U)
48
#define GD32_CLOCK_IPA GD32_CLOCK_CONFIG(AHB1EN, 23U)
49
#define GD32_CLOCK_ENET GD32_CLOCK_CONFIG(AHB1EN, 25U)
50
#define GD32_CLOCK_ENETTX GD32_CLOCK_CONFIG(AHB1EN, 26U)
51
#define GD32_CLOCK_ENETRX GD32_CLOCK_CONFIG(AHB1EN, 27U)
52
#define GD32_CLOCK_ENETPTP GD32_CLOCK_CONFIG(AHB1EN, 28U)
53
#define GD32_CLOCK_USBHS GD32_CLOCK_CONFIG(AHB1EN, 29U)
54
#define GD32_CLOCK_USBHSULPI GD32_CLOCK_CONFIG(AHB1EN, 30U)
55
56
/* AHB2 peripherals */
57
#define GD32_CLOCK_DCI GD32_CLOCK_CONFIG(AHB2EN, 0U)
58
#define GD32_CLOCK_PKCAU GD32_CLOCK_CONFIG(AHB2EN, 3U)
59
#define GD32_CLOCK_CAU GD32_CLOCK_CONFIG(AHB2EN, 4U)
60
#define GD32_CLOCK_HAU GD32_CLOCK_CONFIG(AHB2EN, 5U)
61
#define GD32_CLOCK_TRNG GD32_CLOCK_CONFIG(AHB2EN, 6U)
62
#define GD32_CLOCK_USBFS GD32_CLOCK_CONFIG(AHB2EN, 7U)
63
64
/* APB1 peripherals */
65
#define GD32_CLOCK_TIMER1 GD32_CLOCK_CONFIG(APB1EN, 0U)
66
#define GD32_CLOCK_TIMER2 GD32_CLOCK_CONFIG(APB1EN, 1U)
67
#define GD32_CLOCK_TIMER3 GD32_CLOCK_CONFIG(APB1EN, 2U)
68
#define GD32_CLOCK_TIMER4 GD32_CLOCK_CONFIG(APB1EN, 3U)
69
#define GD32_CLOCK_TIMER5 GD32_CLOCK_CONFIG(APB1EN, 4U)
70
#define GD32_CLOCK_TIMER6 GD32_CLOCK_CONFIG(APB1EN, 5U)
71
#define GD32_CLOCK_TIMER11 GD32_CLOCK_CONFIG(APB1EN, 6U)
72
#define GD32_CLOCK_TIMER12 GD32_CLOCK_CONFIG(APB1EN, 7U)
73
#define GD32_CLOCK_TIMER13 GD32_CLOCK_CONFIG(APB1EN, 8U)
74
#define GD32_CLOCK_I2C3 GD32_CLOCK_CONFIG(APB1EN, 10U)
75
#define GD32_CLOCK_WWDGT GD32_CLOCK_CONFIG(APB1EN, 11U)
76
#define GD32_CLOCK_I2C4 GD32_CLOCK_CONFIG(APB1EN, 12U)
77
#define GD32_CLOCK_I2C5 GD32_CLOCK_CONFIG(APB1EN, 13U)
78
#define GD32_CLOCK_SPI1 GD32_CLOCK_CONFIG(APB1EN, 14U)
79
#define GD32_CLOCK_SPI2 GD32_CLOCK_CONFIG(APB1EN, 15U)
80
#define GD32_CLOCK_USART1 GD32_CLOCK_CONFIG(APB1EN, 17U)
81
#define GD32_CLOCK_USART2 GD32_CLOCK_CONFIG(APB1EN, 18U)
82
#define GD32_CLOCK_UART3 GD32_CLOCK_CONFIG(APB1EN, 19U)
83
#define GD32_CLOCK_UART4 GD32_CLOCK_CONFIG(APB1EN, 20U)
84
#define GD32_CLOCK_I2C0 GD32_CLOCK_CONFIG(APB1EN, 21U)
85
#define GD32_CLOCK_I2C1 GD32_CLOCK_CONFIG(APB1EN, 22U)
86
#define GD32_CLOCK_I2C2 GD32_CLOCK_CONFIG(APB1EN, 23U)
87
#define GD32_CLOCK_CAN0 GD32_CLOCK_CONFIG(APB1EN, 25U)
88
#define GD32_CLOCK_CAN1 GD32_CLOCK_CONFIG(APB1EN, 26U)
89
#define GD32_CLOCK_PMU GD32_CLOCK_CONFIG(APB1EN, 28U)
90
#define GD32_CLOCK_DAC GD32_CLOCK_CONFIG(APB1EN, 29U)
91
#define GD32_CLOCK_UART6 GD32_CLOCK_CONFIG(APB1EN, 30U)
92
#define GD32_CLOCK_UART7 GD32_CLOCK_CONFIG(APB1EN, 31U)
93
94
/* APB2 peripherals */
95
#define GD32_CLOCK_TIMER0 GD32_CLOCK_CONFIG(APB2EN, 0U)
96
#define GD32_CLOCK_TIMER7 GD32_CLOCK_CONFIG(APB2EN, 1U)
97
#define GD32_CLOCK_USART0 GD32_CLOCK_CONFIG(APB2EN, 4U)
98
#define GD32_CLOCK_USART5 GD32_CLOCK_CONFIG(APB2EN, 5U)
99
#define GD32_CLOCK_ADC0 GD32_CLOCK_CONFIG(APB2EN, 8U)
100
#define GD32_CLOCK_ADC1 GD32_CLOCK_CONFIG(APB2EN, 9U)
101
#define GD32_CLOCK_ADC2 GD32_CLOCK_CONFIG(APB2EN, 10U)
102
#define GD32_CLOCK_SDIO GD32_CLOCK_CONFIG(APB2EN, 11U)
103
#define GD32_CLOCK_SPI0 GD32_CLOCK_CONFIG(APB2EN, 12U)
104
#define GD32_CLOCK_SPI3 GD32_CLOCK_CONFIG(APB2EN, 13U)
105
#define GD32_CLOCK_SYSCFG GD32_CLOCK_CONFIG(APB2EN, 14U)
106
#define GD32_CLOCK_TIMER8 GD32_CLOCK_CONFIG(APB2EN, 16U)
107
#define GD32_CLOCK_TIMER9 GD32_CLOCK_CONFIG(APB2EN, 17U)
108
#define GD32_CLOCK_TIMER10 GD32_CLOCK_CONFIG(APB2EN, 18U)
109
#define GD32_CLOCK_SPI4 GD32_CLOCK_CONFIG(APB2EN, 20U)
110
#define GD32_CLOCK_SPI5 GD32_CLOCK_CONFIG(APB2EN, 21U)
111
#define GD32_CLOCK_SAI0 GD32_CLOCK_CONFIG(APB2EN, 22U)
112
#define GD32_CLOCK_TLI GD32_CLOCK_CONFIG(APB2EN, 26U)
113
115
120
122
#define GD32_CKOUT0_SEL(val) (((val) & 0x3U) << 21U)
123
125
#define GD32_CKOUT0SRC_IRC16M GD32_CKOUT0_SEL(0U)
127
#define GD32_CKOUT0SRC_LXTAL GD32_CKOUT0_SEL(1U)
129
#define GD32_CKOUT0SRC_HXTAL GD32_CKOUT0_SEL(2U)
131
#define GD32_CKOUT0SRC_PLLP GD32_CKOUT0_SEL(3U)
132
134
#define GD32_CKOUT0_DIVCFG(val) (((val) & 0x7U) << 24U)
135
137
#define GD32_CKOUT0_DIV1 GD32_CKOUT0_DIVCFG(0U)
139
#define GD32_CKOUT0_DIV2 GD32_CKOUT0_DIVCFG(4U)
141
#define GD32_CKOUT0_DIV3 GD32_CKOUT0_DIVCFG(5U)
143
#define GD32_CKOUT0_DIV4 GD32_CKOUT0_DIVCFG(6U)
145
#define GD32_CKOUT0_DIV5 GD32_CKOUT0_DIVCFG(7U)
146
148
#define GD32_RCU_PLLSAIR_DIV2 0x00000000
150
#define GD32_RCU_PLLSAIR_DIV4 0x00010000
152
#define GD32_RCU_PLLSAIR_DIV8 0x00020000
154
#define GD32_RCU_PLLSAIR_DIV16 0x00030000
156
161
163
#define GD32_PLL_PSC(val) (((val) & 0x3FU) << 0U)
164
166
#define GD32_PLL_N(val) (((val) & 0x1FFU) << 6U)
167
169
#define GD32_PLL_P(val) (((((val) >> 1U) - 1U) & 0x3U) << 16U)
170
172
#define GD32_PLL_SRC(val) (((val) & 0x1U) << 22U)
173
175
#define GD32_PLL_Q(val) (((val) & 0xFU) << 24U)
176
178
#define GD32_PLLSRC_IRC16M GD32_PLL_SRC(0U)
180
#define GD32_PLLSRC_HXTAL GD32_PLL_SRC(1U)
181
183
188
190
#define GD32_CKSYSSRC(val) (((val) & 0x3U) << 0U)
191
193
#define GD32_CKSYSSRC_IRC16M GD32_CKSYSSRC(0U)
195
#define GD32_CKSYSSRC_HXTAL GD32_CKSYSSRC(1U)
197
#define GD32_CKSYSSRC_PLLP GD32_CKSYSSRC(2U)
198
200
#define GD32_AHB_PSC(val) (((val) & 0xFU) << 4U)
201
203
#define GD32_AHB_PSC_DIV1 GD32_AHB_PSC(0U)
205
#define GD32_AHB_PSC_DIV2 GD32_AHB_PSC(8U)
207
#define GD32_AHB_PSC_DIV4 GD32_AHB_PSC(9U)
209
#define GD32_AHB_PSC_DIV8 GD32_AHB_PSC(10U)
211
#define GD32_AHB_PSC_DIV16 GD32_AHB_PSC(11U)
213
#define GD32_AHB_PSC_DIV64 GD32_AHB_PSC(12U)
215
#define GD32_AHB_PSC_DIV128 GD32_AHB_PSC(13U)
217
#define GD32_AHB_PSC_DIV256 GD32_AHB_PSC(14U)
219
#define GD32_AHB_PSC_DIV512 GD32_AHB_PSC(15U)
220
222
#define GD32_APB1_PSC(val) (((val) & 0x7U) << 10U)
223
225
#define GD32_APB1_PSC_DIV1 GD32_APB1_PSC(0U)
227
#define GD32_APB1_PSC_DIV2 GD32_APB1_PSC(4U)
229
#define GD32_APB1_PSC_DIV4 GD32_APB1_PSC(5U)
231
#define GD32_APB1_PSC_DIV8 GD32_APB1_PSC(6U)
233
#define GD32_APB1_PSC_DIV16 GD32_APB1_PSC(7U)
234
236
#define GD32_APB2_PSC(val) (((val) & 0x7U) << 13U)
237
239
#define GD32_APB2_PSC_DIV1 GD32_APB2_PSC(0U)
241
#define GD32_APB2_PSC_DIV2 GD32_APB2_PSC(4U)
243
#define GD32_APB2_PSC_DIV4 GD32_APB2_PSC(5U)
245
#define GD32_APB2_PSC_DIV8 GD32_APB2_PSC(6U)
247
#define GD32_APB2_PSC_DIV16 GD32_APB2_PSC(7U)
248
250
251
#endif
/* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_GD32F527_CLOCKS_H_ */
gd32-clocks-common.h
zephyr
dt-bindings
clock
gd32f527-clocks.h
Generated on
for Zephyr API Documentation by
1.16.1