Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ch32v10x-clocks.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Lucy Wong
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef __CH32V10X_CLOCKS_H__
8#define __CH32V10X_CLOCKS_H__
9
14
16#define CH32V10X_AHB_PCENR_OFFSET 0
18#define CH32V10X_APB2_PCENR_OFFSET 1
20#define CH32V10X_APB1_PCENR_OFFSET 2
21
25#define CH32V10X_CLOCK_CONFIG(bus, bit) (((CH32V10X_##bus##_PCENR_OFFSET) << 5) | (bit))
26
28#define CH32V10X_CLOCK_DMA1 CH32V10X_CLOCK_CONFIG(AHB, 0)
30#define CH32V10X_CLOCK_SRAM CH32V10X_CLOCK_CONFIG(AHB, 2)
32#define CH32V10X_CLOCK_FLITF CH32V10X_CLOCK_CONFIG(AHB, 4)
34#define CH32V10X_CLOCK_CRC CH32V10X_CLOCK_CONFIG(AHB, 6)
36#define CH32V10X_CLOCK_FSMC CH32V10X_CLOCK_CONFIG(AHB, 8)
38#define CH32V10X_CLOCK_USBHD CH32V10X_CLOCK_CONFIG(AHB, 12)
39
41#define CH32V10X_CLOCK_AFIO CH32V10X_CLOCK_CONFIG(APB2, 0)
43#define CH32V10X_CLOCK_IOPA CH32V10X_CLOCK_CONFIG(APB2, 2)
45#define CH32V10X_CLOCK_IOPB CH32V10X_CLOCK_CONFIG(APB2, 3)
47#define CH32V10X_CLOCK_IOPC CH32V10X_CLOCK_CONFIG(APB2, 4)
49#define CH32V10X_CLOCK_IOPD CH32V10X_CLOCK_CONFIG(APB2, 5)
51#define CH32V10X_CLOCK_ADC1 CH32V10X_CLOCK_CONFIG(APB2, 9)
53#define CH32V10X_CLOCK_TIM1 CH32V10X_CLOCK_CONFIG(APB2, 11)
55#define CH32V10X_CLOCK_SPI1 CH32V10X_CLOCK_CONFIG(APB2, 12)
57#define CH32V10X_CLOCK_USART1 CH32V10X_CLOCK_CONFIG(APB2, 14)
58
60#define CH32V10X_CLOCK_TIM2 CH32V10X_CLOCK_CONFIG(APB1, 0)
62#define CH32V10X_CLOCK_TIM3 CH32V10X_CLOCK_CONFIG(APB1, 1)
64#define CH32V10X_CLOCK_TIM4 CH32V10X_CLOCK_CONFIG(APB1, 2)
66#define CH32V10X_CLOCK_WWDG CH32V10X_CLOCK_CONFIG(APB1, 11)
68#define CH32V10X_CLOCK_SPI2 CH32V10X_CLOCK_CONFIG(APB1, 14)
70#define CH32V10X_CLOCK_USART2 CH32V10X_CLOCK_CONFIG(APB1, 17)
72#define CH32V10X_CLOCK_USART3 CH32V10X_CLOCK_CONFIG(APB1, 18)
74#define CH32V10X_CLOCK_I2C1 CH32V10X_CLOCK_CONFIG(APB1, 21)
76#define CH32V10X_CLOCK_I2C2 CH32V10X_CLOCK_CONFIG(APB1, 22)
78#define CH32V10X_CLOCK_USBD CH32V10X_CLOCK_CONFIG(APB1, 23)
80#define CH32V10X_CLOCK_CAN1 CH32V10X_CLOCK_CONFIG(APB1, 25)
82#define CH32V10X_CLOCK_BKP CH32V10X_CLOCK_CONFIG(APB1, 27)
84#define CH32V10X_CLOCK_PWR CH32V10X_CLOCK_CONFIG(APB1, 28)
85
86#endif