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#ifdef __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
25
26/*\note first define basic info for arch. */
27#define VSF_ARCH_PRI_NUM 16
28#define VSF_ARCH_PRI_BIT 4
29
30// software interrupt provided by a dedicated device
31#ifndef VSF_DEV_SWI_NUM
32# define VSF_DEV_SWI_NUM 5
33#endif
34#if VSF_DEV_SWI_NUM > VSF_ARCH_PRI_NUM
35# warning too many VSF_DEV_SWI_NUM, max is VSF_ARCH_PRI_NUM
36# undef VSF_DEV_SWI_NUM
37# define VSF_DEV_SWI_NUM VSF_ARCH_PRI_NUM
38#endif
39
40#elif defined(__VSF_HAL_SHOW_VENDOR_INFO__)
41
42#define __VSF_HEADER_ONLY_SHOW_VENDOR_INFO__
43#include "../common/vendor/Include/gd32h7xx.h"
44
45#else
46
47#ifndef __HAL_DEVICE_GIGADEVICE_GD32H7XX_H__
48#define __HAL_DEVICE_GIGADEVICE_GD32H7XX_H__
49
50// software interrupt provided by a dedicated device
51#define __VSF_DEF_SWI_LIST_DEF(__N, __PARAM) \
52 VSF_MCONNECT(SWI, __N, _IRQn),
53#define VSF_DEV_SWI_LIST VSF_MREPEAT(VSF_DEV_SWI_NUM, __VSF_DEF_SWI_LIST_DEF, NULL)
54
55/*============================ INCLUDES ======================================*/
56
57/*\note this is should be the only place where common.h is included.*/
58#include "../common/common.h"
59
60/*============================ MACROS ========================================*/
61
62#define USB_OTG_COUNT 1
63#define USB_OTG0_IRQHandler USBFS_IRQHandler
64// required by dwcotg, define the max ep number of dwcotg include ep0
65#define USB_DWCOTG_MAX_EP_NUM 4
66
67#define USB_OTG0_CONFIG \
68 .ep_num = 8, \
69 .irq = USBFS_IRQn, \
70 .reg = (void *)USBFS_BASE, \
71 .buffer_word_size = 0x500 >> 2, \
72 .speed = USB_SPEED_FULL, \
73 .dma_en = false, \
74 .ulpi_en = false, \
75 .utmi_en = false, \
76 .vbus_en = false,
77
78#define VSF_HW_GPIO_PORT_COUNT 10
79#define VSF_HW_GPIO_PORT_MASK 0x6FF // no GPIOI
80#define VSF_HW_GPIO_PIN_COUNT 16
81#define VSF_HW_GPIO_FUNCTION_MAX 16
82#define VSF_HW_GPIO_PORT0_REG_BASE GPIOA
83#define VSF_HW_GPIO_PORT0_EN VSF_HW_EN_GPIOA
84#define VSF_HW_GPIO_PORT0_RST VSF_HW_RST_GPIOA
85#define VSF_HW_GPIO_PORT1_REG_BASE GPIOB
86#define VSF_HW_GPIO_PORT1_EN VSF_HW_EN_GPIOB
87#define VSF_HW_GPIO_PORT1_RST VSF_HW_RST_GPIOB
88#define VSF_HW_GPIO_PORT2_REG_BASE GPIOC
89#define VSF_HW_GPIO_PORT2_EN VSF_HW_EN_GPIOC
90#define VSF_HW_GPIO_PORT2_RST VSF_HW_RST_GPIOC
91#define VSF_HW_GPIO_PORT3_REG_BASE GPIOD
92#define VSF_HW_GPIO_PORT3_EN VSF_HW_EN_GPIOD
93#define VSF_HW_GPIO_PORT3_RST VSF_HW_RST_GPIOD
94#define VSF_HW_GPIO_PORT4_REG_BASE GPIOE
95#define VSF_HW_GPIO_PORT4_EN VSF_HW_EN_GPIOE
96#define VSF_HW_GPIO_PORT4_RST VSF_HW_RST_GPIOE
97#define VSF_HW_GPIO_PORT5_REG_BASE GPIOF
98#define VSF_HW_GPIO_PORT5_EN VSF_HW_EN_GPIOF
99#define VSF_HW_GPIO_PORT5_RST VSF_HW_RST_GPIOF
100#define VSF_HW_GPIO_PORT6_REG_BASE GPIOG
101#define VSF_HW_GPIO_PORT6_EN VSF_HW_EN_GPIOG
102#define VSF_HW_GPIO_PORT6_RST VSF_HW_RST_GPIOG
103#define VSF_HW_GPIO_PORT7_REG_BASE GPIOH
104#define VSF_HW_GPIO_PORT7_EN VSF_HW_EN_GPIOH
105#define VSF_HW_GPIO_PORT7_RST VSF_HW_RST_GPIOH
106#define VSF_HW_GPIO_PORT9_REG_BASE GPIOJ
107#define VSF_HW_GPIO_PORT9_EN VSF_HW_EN_GPIOJ
108#define VSF_HW_GPIO_PORT9_RST VSF_HW_RST_GPIOJ
109#define VSF_HW_GPIO_PORT10_REG_BASE GPIOK
110#define VSF_HW_GPIO_PORT10_EN VSF_HW_EN_GPIOK
111#define VSF_HW_GPIO_PORT10_RST VSF_HW_RST_GPIOK
112
113#define VSF_HW_USART_COUNT 8
114#define VSF_HW_USART0_REG_BASE USART0
115#define VSF_HW_USART0_CLK VSF_HW_CLK_USART0
116#define VSF_HW_USART0_EN VSF_HW_EN_USART0
117#define VSF_HW_USART0_RST VSF_HW_RST_USART0
118#define VSF_HW_USART0_SYNC true
119#define VSF_HW_USART0_IRQN USART0_IRQn
120#define VSF_HW_USART0_IRQHandler USART0_IRQHandler
121#define VSF_HW_USART1_REG_BASE USART1
122#define VSF_HW_USART1_CLK VSF_HW_CLK_USART1
123#define VSF_HW_USART1_EN VSF_HW_EN_USART1
124#define VSF_HW_USART1_RST VSF_HW_RST_USART1
125#define VSF_HW_USART1_SYNC true
126#define VSF_HW_USART1_IRQN USART1_IRQn
127#define VSF_HW_USART1_IRQHandler USART1_IRQHandler
128#define VSF_HW_USART2_REG_BASE USART2
129#define VSF_HW_USART2_CLK VSF_HW_CLK_USART2
130#define VSF_HW_USART2_EN VSF_HW_EN_USART2
131#define VSF_HW_USART2_RST VSF_HW_RST_USART2
132#define VSF_HW_USART2_SYNC true
133#define VSF_HW_USART2_IRQN USART2_IRQn
134#define VSF_HW_USART2_IRQHandler USART2_IRQHandler
135#define VSF_HW_USART3_REG_BASE UART3
136#define VSF_HW_USART3_CLK VSF_HW_CLK_UART3
137#define VSF_HW_USART3_EN VSF_HW_EN_UART3
138#define VSF_HW_USART3_RST VSF_HW_RST_UART3
139#define VSF_HW_USART3_SYNC false
140#define VSF_HW_USART3_IRQN UART3_IRQn
141#define VSF_HW_USART3_IRQHandler UART3_IRQHandler
142#define VSF_HW_USART4_REG_BASE UART4
143#define VSF_HW_USART4_CLK VSF_HW_CLK_UART4
144#define VSF_HW_USART4_EN VSF_HW_EN_UART4
145#define VSF_HW_USART4_RST VSF_HW_RST_UART4
146#define VSF_HW_USART4_SYNC false
147#define VSF_HW_USART4_IRQN UART4_IRQn
148#define VSF_HW_USART4_IRQHandler UART4_IRQHandler
149#define VSF_HW_USART5_REG_BASE USART5
150#define VSF_HW_USART5_CLK VSF_HW_CLK_USART5
151#define VSF_HW_USART5_EN VSF_HW_EN_USART5
152#define VSF_HW_USART5_RST VSF_HW_RST_USART5
153#define VSF_HW_USART5_SYNC true
154#define VSF_HW_USART5_IRQN USART5_IRQn
155#define VSF_HW_USART5_IRQHandler USART5_IRQHandler
156#define VSF_HW_USART6_REG_BASE UART6
157#define VSF_HW_USART6_CLK VSF_HW_CLK_UART6
158#define VSF_HW_USART6_EN VSF_HW_EN_UART6
159#define VSF_HW_USART6_RST VSF_HW_RST_UART6
160#define VSF_HW_USART6_SYNC false
161#define VSF_HW_USART6_IRQN UART6_IRQn
162#define VSF_HW_USART6_IRQHandler UART6_IRQHandler
163#define VSF_HW_USART7_REG_BASE UART7
164#define VSF_HW_USART7_CLK VSF_HW_CLK_UART7
165#define VSF_HW_USART7_EN VSF_HW_EN_UART7
166#define VSF_HW_USART7_RST VSF_HW_RST_UART7
167#define VSF_HW_USART7_SYNC false
168#define VSF_HW_USART7_IRQN UART7_IRQn
169#define VSF_HW_USART7_IRQHandler UART7_IRQHandler
170
171#define VSF_HW_FLASH_COUNT 1
172#define VSF_HW_FLASH0_ADDR 0x08000000
173#define VSF_HW_FLASH0_REG_BASE FMC
174#define VSF_HW_FLASH0_IRQN FMC_IRQn
175#define VSF_HW_FLASH0_IRQHandler FMC_IRQHandler
176
177#define VSF_HW_SDIO_COUNT 2
178#define VSF_HW_SDIO0_REG_BASE SDIO0
179#define VSF_HW_SDIO0_CLK VSF_HW_CLK_SDIO0
180#define VSF_HW_SDIO0_EN VSF_HW_EN_SDIO0
181#define VSF_HW_SDIO0_RST VSF_HW_RST_SDIO0
182#define VSF_HW_SDIO0_IRQN SDIO0_IRQn
183#define VSF_HW_SDIO0_IRQHandler SDIO0_IRQHandler
184#define VSF_HW_SDIO1_REG_BASE SDIO1
185#define VSF_HW_SDIO1_CLK VSF_HW_CLK_SDIO1
186#define VSF_HW_SDIO1_EN VSF_HW_EN_SDIO1
187#define VSF_HW_SDIO1_RST VSF_HW_RST_SDIO1
188#define VSF_HW_SDIO1_IRQN SDIO1_IRQn
189#define VSF_HW_SDIO1_IRQHandler SDIO1_IRQHandler
190
191/*============================ MACROFIED FUNCTIONS ===========================*/
192/*============================ TYPES =========================================*/
193/*============================ GLOBAL VARIABLES ==============================*/
194/*============================ LOCAL VARIABLES ===============================*/
195/*============================ PROTOTYPES ====================================*/
196
197#endif // __HAL_DEVICE_GIGADEVICE_GD32H7XX_H__
198#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
199/* EOF */