|
7 | 7 | #ifndef __CH32V00X_CLOCKS_H__
|
8 | 8 | #define __CH32V00X_CLOCKS_H__
|
9 | 9 |
|
10 |
| -#define CH32V00X_AHB_PCENR_OFFSET 0 |
11 |
| -#define CH32V00X_APB2_PCENR_OFFSET 1 |
12 |
| -#define CH32V00X_APB1_PCENR_OFFSET 2 |
| 10 | +#define CH32V00X_HB_PCENR_OFFSET 0 |
| 11 | +#define CH32V00X_PB2_PCENR_OFFSET 1 |
| 12 | +#define CH32V00X_PB1_PCENR_OFFSET 2 |
13 | 13 |
|
14 | 14 | #define CH32V00X_CLOCK_CONFIG(bus, bit) (((CH32V00X_##bus##_PCENR_OFFSET) << 5) | (bit))
|
15 | 15 |
|
16 |
| -#define CH32V00X_CLOCK_DMA1 CH32V00X_CLOCK_CONFIG(AHB, 0) |
17 |
| -#define CH32V00X_CLOCK_SRAM CH32V00X_CLOCK_CONFIG(AHB, 2) |
18 |
| -#define CH32V00X_CLOCK_FLITF CH32V00X_CLOCK_CONFIG(AHB, 4) |
19 |
| -#define CH32V00X_CLOCK_CRC CH32V00X_CLOCK_CONFIG(AHB, 6) |
20 |
| -#define CH32V00X_CLOCK_USB CH32V00X_CLOCK_CONFIG(AHB, 12) |
| 16 | +#define CH32V00X_CLOCK_DMA1 CH32V00X_CLOCK_CONFIG(HB, 0) |
| 17 | +#define CH32V00X_CLOCK_SRAM CH32V00X_CLOCK_CONFIG(HB, 2) |
21 | 18 |
|
22 |
| -#define CH32V00X_CLOCK_AFIO CH32V00X_CLOCK_CONFIG(APB2, 0) |
23 |
| -#define CH32V00X_CLOCK_IOPA CH32V00X_CLOCK_CONFIG(APB2, 2) |
24 |
| -#define CH32V00X_CLOCK_IOPB CH32V00X_CLOCK_CONFIG(APB2, 3) |
25 |
| -#define CH32V00X_CLOCK_IOPC CH32V00X_CLOCK_CONFIG(APB2, 4) |
26 |
| -#define CH32V00X_CLOCK_IOPD CH32V00X_CLOCK_CONFIG(APB2, 5) |
27 |
| -#define CH32V00X_CLOCK_ADC1 CH32V00X_CLOCK_CONFIG(APB2, 9) |
28 |
| -#define CH32V00X_CLOCK_ADC2 CH32V00X_CLOCK_CONFIG(APB2, 10) |
29 |
| -#define CH32V00X_CLOCK_TIM1 CH32V00X_CLOCK_CONFIG(APB2, 11) |
30 |
| -#define CH32V00X_CLOCK_SPI1 CH32V00X_CLOCK_CONFIG(APB2, 12) |
31 |
| -#define CH32V00X_CLOCK_USART1 CH32V00X_CLOCK_CONFIG(APB2, 14) |
| 19 | +#define CH32V00X_CLOCK_AFIO CH32V00X_CLOCK_CONFIG(PB2, 0) |
| 20 | +#define CH32V00X_CLOCK_IOPA CH32V00X_CLOCK_CONFIG(PB2, 2) |
| 21 | +#define CH32V00X_CLOCK_IOPB CH32V00X_CLOCK_CONFIG(PB2, 3) |
| 22 | +#define CH32V00X_CLOCK_IOPC CH32V00X_CLOCK_CONFIG(PB2, 4) |
| 23 | +#define CH32V00X_CLOCK_IOPD CH32V00X_CLOCK_CONFIG(PB2, 5) |
| 24 | +#define CH32V00X_CLOCK_ADC1 CH32V00X_CLOCK_CONFIG(PB2, 9) |
| 25 | +#define CH32V00X_CLOCK_TIM1 CH32V00X_CLOCK_CONFIG(PB2, 11) |
| 26 | +#define CH32V00X_CLOCK_SPI1 CH32V00X_CLOCK_CONFIG(PB2, 12) |
| 27 | +#define CH32V00X_CLOCK_USART2 CH32V00X_CLOCK_CONFIG(PB2, 13) |
| 28 | +#define CH32V00X_CLOCK_USART1 CH32V00X_CLOCK_CONFIG(PB2, 14) |
32 | 29 |
|
33 |
| -#define CH32V00X_CLOCK_TIM2 CH32V00X_CLOCK_CONFIG(APB1, 0) |
34 |
| -#define CH32V00X_CLOCK_TIM3 CH32V00X_CLOCK_CONFIG(APB1, 1) |
35 |
| -#define CH32V00X_CLOCK_WWDG CH32V00X_CLOCK_CONFIG(APB1, 11) |
36 |
| -#define CH32V00X_CLOCK_USART2 CH32V00X_CLOCK_CONFIG(APB1, 17) |
37 |
| -#define CH32V00X_CLOCK_I2C1 CH32V00X_CLOCK_CONFIG(APB1, 21) |
38 |
| -#define CH32V00X_CLOCK_BKP CH32V00X_CLOCK_CONFIG(APB1, 27) |
39 |
| -#define CH32V00X_CLOCK_PWR CH32V00X_CLOCK_CONFIG(APB1, 28) |
40 |
| -#define CH32V00X_CLOCK_USB CH32V00X_CLOCK_CONFIG(APB1, 23) |
| 30 | +#define CH32V00X_CLOCK_TIM2 CH32V00X_CLOCK_CONFIG(PB1, 0) |
| 31 | +#define CH32V00X_CLOCK_TIM3 CH32V00X_CLOCK_CONFIG(PB1, 2) |
| 32 | +#define CH32V00X_CLOCK_WWDG CH32V00X_CLOCK_CONFIG(PB1, 11) |
| 33 | +#define CH32V00X_CLOCK_I2C1 CH32V00X_CLOCK_CONFIG(PB1, 21) |
| 34 | +#define CH32V00X_CLOCK_PWR CH32V00X_CLOCK_CONFIG(PB1, 28) |
41 | 35 |
|
42 | 36 | #endif
|
0 commit comments