VSF Documented
device.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18/*============================ INCLUDES ======================================*/
19
20#include "hal/vsf_hal_cfg.h"
21
22/*============================ MACROS ========================================*/
23
24/*\note first define basic info for arch. */
25#if defined(__VSF_HEADER_ONLY_SHOW_ARCH_INFO__)
27#define VSF_ARCH_PRI_NUM 16
28#define VSF_ARCH_PRI_BIT 4
29
30
31// software interrupt provided by a dedicated device
32#define VSF_DEV_SWI_NUM 0
33
34#else
35
36#ifndef __HAL_DEVICE_WCH_CH32F103C8_H__
37#define __HAL_DEVICE_WCH_CH32F103C8_H__
38
39#define VSF_DEV_SWI_LIST
40
41/*============================ INCLUDES ======================================*/
42
43/*\note this is should be the only place where __common.h is included.*/
44#include "../common/vendor/inc/ch32f10x.h"
45#include "../common/__common.h"
46
47/*============================ MACROS ========================================*/
48
49#ifndef CH32F10X_HSE_FREQ_HZ
50# define CH32F10X_HSE_FREQ_HZ (12 * 1000 * 1000)
51#endif
52
53#ifndef CH32F10X_LSE_FREQ_HZ
54# define CH32F10X_LSE_FREQ_HZ (32768)
55#endif
56
57#ifndef CH32F10X_PLL_FREQ_HZ
58# define CH32F10X_PLL_FREQ_HZ (72 * 1000 * 1000)
59#endif
60
61#ifndef CH32F10X_SYS_FREQ_HZ
62# define CH32F10X_SYS_FREQ_HZ (72 * 1000 * 1000)
63#endif
64
65#ifndef CH32F10X_AHB_FREQ_HZ
66# define CH32F10X_AHB_FREQ_HZ (72 * 1000 * 1000)
67#endif
68
69#ifndef CH32F10X_APB1_FREQ_HZ
70# define CH32F10X_APB1_FREQ_HZ (72 * 1000 * 1000)
71#endif
72
73#ifndef CH32F10X_APB2_FREQ_HZ
74# define CH32F10X_APB2_FREQ_HZ (72 * 1000 * 1000)
75#endif
76
77#ifndef CH32F10X_VECTOR_TABLE
78// use default
79#endif
80
81#define USB_HDC_COUNT 1
82#define USB_HDC_REG_BASE 0x40023400
83#define USB_HDC_IRQN USBHD_IRQn
84#define USB_HDC_IRQHandler USBHD_IRQHandler
85
86#define USB_DC_COUNT 1
87#define USB_DC_EP_NUM 8
88#define USB_DC_LP_IRQN USB_LP_CAN1_RX0_IRQn
89#define USB_DC_HP_IRQN USB_HP_CAN1_TX_IRQn
90#define USB_DC_REG_BASE 0x40005C00L
91#define USB_DC_PMA_BASE 0x40006000L
92
93#define USB_DC0_TYPE usbd
94#define USB_DC0_IRQHandler USB_LP_CAN1_RX0_IRQHandler
95
96/*============================ MACROFIED FUNCTIONS ===========================*/
97/*============================ TYPES =========================================*/
98/*============================ GLOBAL VARIABLES ==============================*/
99/*============================ LOCAL VARIABLES ===============================*/
100/*============================ PROTOTYPES ====================================*/
101
102#endif // __HAL_DEVICE_WCH_CH32F103C8_H__
103#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
104/* EOF */