Go to the documentation of this file.
21#ifdef __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
25# define VSF_ARCH_PRI_NUM 8
26# define VSF_ARCH_PRI_BIT 3
28# define VSF_DEV_COMMON_SWI_NUM 32
30#elif defined(__VSF_HAL_SHOW_VENDOR_INFO__)
37# define __VSF_HEADER_ONLY_SHOW_VENDOR_INFO__
38# include "./vendor/libraries/cmsis/cm4/device_support/at32f402_405.h"
42#ifndef __HAL_DEVICE_COMMON_ATTERY_AT32F402_405_H__
43#define __HAL_DEVICE_COMMON_ATTERY_AT32F402_405_H__
53#define VSF_DEV_COMMON_SWI_LIST \
54 43, 46, 47, 48, 49, 50, 61, 62, \
55 63, 64, 65, 66, 70, 78, 79, 80, \
56 84, 86, 87, 88, 89, 90, 91, 93, \
57 95, 96, 97, 98, 99, 100, 101, 102
61#ifndef VSF_HW_RAM_COUNT
62# define VSF_HW_RAM_COUNT 1
64#if VSF_HW_RAM_COUNT >= 1 && !defined(VSF_HW_RAM0_ADDR)
65# define VSF_HW_RAM0_ADDR 0x20000000
70#ifndef VSF_HW_FLASH_COUNT
71# define VSF_HW_FLASH_COUNT 1
73#if VSF_HW_FLASH_COUNT >= 1 && !defined(VSF_HW_FLASH0_ADDR)
74# define VSF_HW_FLASH0_ADDR 0x08000000
79#ifndef VSF_HW_GPIO_PORT_MASK
80# ifdef VSF_HW_GPIO_PORT_COUNT
81# define VSF_HW_GPIO_PORT_MASK ((1 << VSF_HW_GPIO_PORT_COUNT) - 1)
83# define VSF_HW_GPIO_PORT_MASK 0x2F
86#if VSF_HW_GPIO_PORT_MASK & ~0x2F
87# error invalid VSF_HW_GPIO_PORT_MASK
90#ifndef VSF_HW_GPIO_PIN_COUNT
91# define VSF_HW_GPIO_PIN_COUNT 16
93#ifndef VSF_HW_GPIO_FUNCTION_MAX
94# define VSF_HW_GPIO_FUNCTION_MAX 16
97#if VSF_HW_GPIO_PORT_MASK & (1 << 0)
98# define VSF_HW_GPIO_PORT0_REG GPIOA
99# ifndef VSF_HW_GPIO_PORT0_MASK
100# define VSF_HW_GPIO_PORT0_MASK 0xFFFF
101# elif VSF_HW_GPIO_PORT0_MASK & ~0xFFFF
102# error invalid VSF_HW_GPIO_PORT0_MASK
105#if VSF_HW_GPIO_PORT_MASK & (1 << 1)
106# define VSF_HW_GPIO_PORT1_REG GPIOB
107# ifndef VSF_HW_GPIO_PORT1_MASK
108# define VSF_HW_GPIO_PORT1_MASK 0xFFFF
109# elif VSF_HW_GPIO_PORT1_MASK & ~0xFFFF
110# error invalid VSF_HW_GPIO_PORT1_MASK
113#if VSF_HW_GPIO_PORT_MASK & (1 << 2)
114# define VSF_HW_GPIO_PORT2_REG GPIOC
115# ifndef VSF_HW_GPIO_PORT2_MASK
116# define VSF_HW_GPIO_PORT2_MASK 0xFFFF
117# elif VSF_HW_GPIO_PORT2_MASK & ~0xFFFF
118# error invalid VSF_HW_GPIO_PORT2_MASK
121#if VSF_HW_GPIO_PORT_MASK & (1 << 3)
122# define VSF_HW_GPIO_PORT3_REG GPIOD
123# ifndef VSF_HW_GPIO_PORT3_MASK
124# define VSF_HW_GPIO_PORT3_MASK 0x0004
125# elif VSF_HW_GPIO_PORT3_MASK & ~0xFFFF
126# error invalid VSF_HW_GPIO_PORT3_MASK
129#if VSF_HW_GPIO_PORT_MASK & (1 << 5)
130# define VSF_HW_GPIO_PORT5_REG GPIOF
131# ifndef VSF_HW_GPIO_PORT5_MASK
132# define VSF_HW_GPIO_PORT5_MASK 0x08F3
133# elif VSF_HW_GPIO_PORT5_MASK & ~0x08F3
134# error invalid VSF_HW_GPIO_PORT5_MASK
140#ifndef VSF_HW_USART_MASK
141# ifdef VSF_HW_USART_COUNT
142# define VSF_HW_USART_MASK ((1 << VSF_HW_USART_COUNT) - 1)
144# define VSF_HW_USART_MASK 0x01FE
147#if VSF_HW_USART_MASK & ~0x01FE
148# error invalid VSF_HW_USART_MASK
151#if VSF_HW_USART_MASK & (1 << 1)
152# define VSF_HW_USART1_REG USART1
153# define VSF_HW_USART1_CLK VSF_HW_CLK_USART1
154# define VSF_HW_USART1_EN VSF_HW_EN_USART1
155# define VSF_HW_USART1_RST VSF_HW_RST_USART1
156# define VSF_HW_USART1_SYNC true
157# define VSF_HW_USART1_IRQN USART1_IRQn
158# define VSF_HW_USART1_IRQHandler USART1_IRQHandler
160#if VSF_HW_USART_MASK & (1 << 2)
161# define VSF_HW_USART2_REG USART2
162# define VSF_HW_USART2_CLK VSF_HW_CLK_USART2
163# define VSF_HW_USART2_EN VSF_HW_EN_USART2
164# define VSF_HW_USART2_RST VSF_HW_RST_USART2
165# define VSF_HW_USART2_SYNC true
166# define VSF_HW_USART2_IRQN USART2_IRQn
167# define VSF_HW_USART2_IRQHandler USART2_IRQHandler
169#if VSF_HW_USART_MASK & (1 << 3)
170# define VSF_HW_USART3_REG USART3
171# define VSF_HW_USART3_CLK VSF_HW_CLK_USART3
172# define VSF_HW_USART3_EN VSF_HW_EN_USART3
173# define VSF_HW_USART3_RST VSF_HW_RST_USART3
174# define VSF_HW_USART3_SYNC true
175# define VSF_HW_USART3_IRQN USART3_IRQn
176# define VSF_HW_USART3_IRQHandler USART3_IRQHandler
178#if VSF_HW_USART_MASK & (1 << 4)
179# define VSF_HW_USART4_REG USART4
180# define VSF_HW_USART4_CLK VSF_HW_CLK_USART4
181# define VSF_HW_USART4_EN VSF_HW_EN_USART4
182# define VSF_HW_USART4_RST VSF_HW_RST_USART4
183# define VSF_HW_USART4_SYNC true
184# define VSF_HW_USART4_IRQN USART4_IRQn
185# define VSF_HW_USART4_IRQHandler USART4_IRQHandler
187#if VSF_HW_USART_MASK & (1 << 5)
188# define VSF_HW_USART5_REG USART5
189# define VSF_HW_USART5_CLK VSF_HW_CLK_USART5
190# define VSF_HW_USART5_EN VSF_HW_EN_USART5
191# define VSF_HW_USART5_RST VSF_HW_RST_USART5
192# define VSF_HW_USART5_SYNC true
193# define VSF_HW_USART5_IRQN USART5_IRQn
194# define VSF_HW_USART5_IRQHandler USART5_IRQHandler
196#if VSF_HW_USART_MASK & (1 << 6)
197# define VSF_HW_USART6_REG USART6
198# define VSF_HW_USART6_CLK VSF_HW_CLK_USART6
199# define VSF_HW_USART6_EN VSF_HW_EN_USART6
200# define VSF_HW_USART6_RST VSF_HW_RST_USART6
201# define VSF_HW_USART6_SYNC true
202# define VSF_HW_USART6_IRQN USART6_IRQn
203# define VSF_HW_USART6_IRQHandler USART6_IRQHandler
205#if VSF_HW_USART_MASK & (1 << 7)
206# define VSF_HW_USART7_REG UART7
207# define VSF_HW_USART7_CLK VSF_HW_CLK_UART7
208# define VSF_HW_USART7_EN VSF_HW_EN_UART7
209# define VSF_HW_USART7_RST VSF_HW_RST_UART7
210# define VSF_HW_USART7_SYNC false
211# define VSF_HW_USART7_IRQN UART7_IRQn
212# define VSF_HW_USART7_IRQHandler UART7_IRQHandler
214#if VSF_HW_USART_MASK & (1 << 8)
215# define VSF_HW_USART8_REG UART8
216# define VSF_HW_USART8_CLK VSF_HW_CLK_UART8
217# define VSF_HW_USART8_EN VSF_HW_EN_UART8
218# define VSF_HW_USART8_RST VSF_HW_RST_UART8
219# define VSF_HW_USART8_SYNC false
220# define VSF_HW_USART8_IRQN UART8_IRQn
221# define VSF_HW_USART8_IRQHandler UART8_IRQHandler
226#ifndef VSF_HW_SPI_MASK
227# ifdef VSF_HW_SPI_COUNT
228# define VSF_HW_SPI_MASK ((1 << VSF_HW_SPI_COUNT) - 1)
230# define VSF_HW_SPI_MASK 0x0E
233#if VSF_HW_SPI_MASK & ~0x0E
234# error invalid VSF_HW_SPI_MASK
237#if VSF_HW_SPI_MASK & (1 << 1)
238# define VSF_HW_SPI1_REG SPI1
239# define VSF_HW_SPI1_CLK VSF_HW_CLK_SPI1
240# define VSF_HW_SPI1_EN VSF_HW_EN_SPI1
241# define VSF_HW_SPI1_RST VSF_HW_RST_SPI1
242# define VSF_HW_SPI1_IRQN SPI1_IRQn
243# define VSF_HW_SPI1_IRQ SPI1_IRQHandler
245#if VSF_HW_SPI_MASK & (1 << 2)
246# define VSF_HW_SPI2_REG SPI2
247# define VSF_HW_SPI2_CLK VSF_HW_CLK_SPI2
248# define VSF_HW_SPI2_EN VSF_HW_EN_SPI2
249# define VSF_HW_SPI2_RST VSF_HW_RST_SPI2
250# define VSF_HW_SPI2_IRQN SPI2_IRQn
251# define VSF_HW_SPI2_IRQ SPI2_IRQHandler
253#if VSF_HW_SPI_MASK & (1 << 3)
254# define VSF_HW_SPI3_REG SPI3
255# define VSF_HW_SPI3_CLK VSF_HW_CLK_SPI3
256# define VSF_HW_SPI3_EN VSF_HW_EN_SPI3
257# define VSF_HW_SPI3_RST VSF_HW_RST_SPI3
258# define VSF_HW_SPI3_IRQN SPI3_IRQn
259# define VSF_HW_SPI3_IRQ SPI3_IRQHandler
264#ifndef VSF_HW_I2C_MASK
265# ifdef VSF_HW_I2C_COUNT
266# define VSF_HW_I2C_MASK ((1 << VSF_HW_I2C_COUNT) - 1)
268# define VSF_HW_I2C_MASK 0x0E
271#if VSF_HW_I2C_MASK & ~0x0E
272# error invalid VSF_HW_I2C_MASK
275#if VSF_HW_I2C_MASK & (1 << 1)
276# define VSF_HW_I2C1_REG I2C1
277# define VSF_HW_I2C1_CLK VSF_HW_CLK_I2C1
278# define VSF_HW_I2C1_EN VSF_HW_EN_I2C1
279# define VSF_HW_I2C1_RST VSF_HW_RST_I2C1
280# define VSF_HW_I2C1_EVENT_IRQN I2C1_EVT_IRQn
281# define VSF_HW_I2C1_EVENT_IRQHandler I2C1_EVT_IRQHandler
282# define VSF_HW_I2C1_ERROR_IRQN I2C1_ERR_IRQn
283# define VSF_HW_I2C1_ERROR_IRQHandler I2C1_ERR_IRQHandler
285#if VSF_HW_I2C_MASK & (1 << 2)
286# define VSF_HW_I2C2_REG I2C2
287# define VSF_HW_I2C2_CLK VSF_HW_CLK_I2C2
288# define VSF_HW_I2C2_EN VSF_HW_EN_I2C2
289# define VSF_HW_I2C2_RST VSF_HW_RST_I2C2
290# define VSF_HW_I2C2_EVENT_IRQN I2C2_EVT_IRQn
291# define VSF_HW_I2C2_EVENT_IRQHandler I2C2_EVT_IRQHandler
292# define VSF_HW_I2C2_ERROR_IRQN I2C2_ERR_IRQn
293# define VSF_HW_I2C2_ERROR_IRQHandler I2C2_ERR_IRQHandler
295#if VSF_HW_I2C_MASK & (1 << 3)
296# define VSF_HW_I2C3_REG I2C3
297# define VSF_HW_I2C3_CLK VSF_HW_CLK_I2C3
298# define VSF_HW_I2C3_EN VSF_HW_EN_I2C3
299# define VSF_HW_I2C3_RST VSF_HW_RST_I2C3
300# define VSF_HW_I2C3_EVENT_IRQN I2C3_EVT_IRQn
301# define VSF_HW_I2C3_EVENT_IRQHandler I2C3_EVT_IRQHandler
302# define VSF_HW_I2C3_ERROR_IRQN I2C3_ERR_IRQn
303# define VSF_HW_I2C3_ERROR_IRQHandler I2C3_ERR_IRQHandler
308#ifndef VSF_HW_USB_OTG_MASK
309# ifdef VSF_HW_USB_OTG_COUNT
310# define VSF_HW_USB_OTG_MASK ((1 << VSF_HW_USB_OTG_COUNT) - 1)
312# define VSF_HW_USB_OTG_MASK 0x03
317#ifndef USB_DWCOTG_MAX_EP_NUM
318# define USB_DWCOTG_MAX_EP_NUM 16
321#if VSF_HW_USB_OTG_MASK & (1 << 0)
322# define VSF_HW_USB_OTG0_IRQHandler OTGFS1_IRQHandler
323# define VSF_HW_USB_OTG0_CONFIG \
324 .dc_ep_num = 8 << 1, \
326 .reg = (void *)OTGFS1_BASE, \
327 .irq = OTGFS1_IRQn, \
328 .en = VSF_HW_EN_OTGFS1, \
329 .phyclk = &VSF_HW_CLK_HICK, \
330 .phyclk_freq_required = 48 * 1000 * 1000, \
332 .buffer_word_size = 320, \
333 .speed = USB_SPEED_FULL, \
340#if VSF_HW_USB_OTG_MASK & (1 << 1)
342# define VSF_HW_USB_OTG1_IRQHandler OTGHS_IRQHandler
343# define VSF_HW_USB_OTG1_CONFIG \
344 .dc_ep_num = 8 << 1, \
346 .reg = (void *)OTGHS_BASE, \
348 .en = VSF_HW_EN_OTGHS, \
349 .phyclk = &VSF_HW_CLK_HEXT, \
350 .phyclk_freq_required = 12 * 1000 * 1000, \
352 .buffer_word_size = 1024, \
353 .speed = USB_SPEED_HIGH, \