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. */
28# define VSF_ARCH_PRI_NUM 8
29# define VSF_ARCH_PRI_BIT 3
30
31// software interrupt provided by a dedicated device
32#define VSF_DEV_SWI_NUM 1
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37extern unsigned int SystemCoreClock;
38#ifdef __cplusplus
39}
40#endif
41#define VSF_ARCH_SYSTIMER_FREQ SystemCoreClock
42
43#else
44
45#ifndef __HAL_DEVICE_GEEHY_APM32F407_H__
46#define __HAL_DEVICE_GEEHY_APM32F407_H__
47
48// software interrupt provided by a dedicated device
49#define VSF_DEV_SWI_LIST 79
50#define SWI0_IRQHandler CRYPT_IRQHandler
51
52#define RNG_IRQHandler HASH_RNG_IRQHandler
53
54/*============================ INCLUDES ======================================*/
55
56/*\note this is should be the only place where __common.h is included.*/
57#include "../common/__common.h"
58
59/*============================ MACROS ========================================*/
60
61// user configurations with default value
62
63#ifndef VSF_HW_USB_OTG1_USB_CFG_SPEED
64// TODO: USB_SPEED_HIGH is not tested OK
65# define VSF_HW_USB_OTG1_USB_CFG_SPEED USB_SPEED_FULL
66#endif
67
68// HW definition
69
70#define VSF_HW_USB_OTG_COUNT 2
71// required by dwcotg, define the max ep number of dwcotg include ep0
72#define USB_DWCOTG_MAX_EP_NUM 6
73
74#define USB_OTG_FS_BASE ((uint32_t)0x50000000)
75#define USB_OTG_HS_BASE ((uint32_t)0x40040000)
76
77#define VSF_HW_USB_OTG0_IRQHandler OTG_FS_IRQHandler
78#define VSF_HW_USB_OTG0_CONFIG \
79 .dc_ep_num = 4 << 1, \
80 .hc_ep_num = USB_DWCOTG_MAX_EP_NUM, \
81 .reg = (void *)USB_OTG_FS_BASE, \
82 .irq = OTG_FS_IRQn, \
83 /* vk_dwcotg_hw_info_t */ \
84 .buffer_word_size = 320, \
85 .speed = USB_SPEED_FULL, \
86 .dma_en = false, \
87 .ulpi_en = false, \
88 .utmi_en = false, \
89 .vbus_en = false,
90
91#define VSF_HW_USB_OTG1_IRQHandler OTG_HS1_IRQHandler
92#define VSF_HW_USB_OTG1_CONFIG \
93 .dc_ep_num = (USB_DWCOTG_MAX_EP_NUM - 1) << 1, \
94 .hc_ep_num = USB_DWCOTG_MAX_EP_NUM, \
95 .reg = (void *)USB_OTG_HS_BASE, \
96 .phy_reg = (void *)(USB_OTG_HS_BASE + 0x200), \
97 .irq = OTG_HS1_IRQn, \
98 /* vk_dwcotg_hw_info_t */ \
99 .buffer_word_size = 1024, \
100 .speed = VSF_HW_USB_OTG1_USB_CFG_SPEED, \
101 .dma_en = false, \
102 .ulpi_en = false, \
103 .utmi_en = true, \
104 .vbus_en = false,
105
106/*============================ MACROFIED FUNCTIONS ===========================*/
107/*============================ TYPES =========================================*/
108/*============================ GLOBAL VARIABLES ==============================*/
109/*============================ LOCAL VARIABLES ===============================*/
110/*============================ PROTOTYPES ====================================*/
111
112
113#endif // __HAL_DEVICE_GEEHY_APM32F407_H__
114#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
115/* EOF */
uint32_t SystemCoreClock
Definition system_CMSDK_ARMv8MBL.c:56