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#if defined(__VSF_HEADER_ONLY_SHOW_ARCH_INFO__)
25
26/*\note __VSF_HEADER_ONLY_SHOW_ARCH_INFO__ is defined to include arch information only.
27 * Some arch provide chip-vendor with some vendor-specified options, define these options here.
28 */
29
31// for ARM, number of interrupt priority is vendor-specified, so define here
32
33# define VSF_ARCH_PRI_NUM 64
34# define VSF_ARCH_PRI_BIT 6
35
36#elif defined(__VSF_HAL_SHOW_VENDOR_INFO__)
37
38/*\note __VSF_HAL_SHOW_VENDOR_INFO__ is defined to include vendor information only.
39 * Vendor information means the registers/structures/macros from vendor SDK.
40 * Usually these information are not visible from user side to avoid name-space pollution.
41 */
42
43# define __VSF_HEADER_ONLY_SHOW_VENDOR_INFO__
44# include "vendor_header.h"
45
46#else
47
48/*\note __VSF_HEADER_ONLY_SHOW_ARCH_INFO__ and __VSF_HAL_SHOW_VENDOR_INFO__ are not defined.
49 * Define device information here.
50 */
51
52#ifndef __VSF_HAL_DEVICE_${VENDOR}_${DEVICE}_H__
53#define __VSF_HAL_DEVICE_${VENDOR}_${DEVICE}_H__
54
55/*============================ INCLUDES ======================================*/
56
57/*\note this is should be the only place where __common.h is included if implemented.
58 The path of __common.h is up to developer to decide.
59*/
60//#include "../common/__common.h"
61
62/*============================ MACROS ========================================*/
63
64// software interrupt provided by a dedicated device
65#define VSF_DEV_SWI_NUM 0
66
67/*\note For specified peripheral, VSF_HW_PERIPHERIAL_COUNT MUST be defined as number of peripheral instance.
68 * If peripheral instances start from 0, and are in sequence order(eg, 3 I2Cs: I2C0, I2C1, I2C2), VSF_HW_PERIPHERIAL_MASK is not needed.
69 * Otherwise, define VSF_HW_PERIPHERIAL_MASK to indicate which peripheral instances to implmenent.
70 * eg: 3 I2Cs: I2C0, I2C2, I2C4, define VSF_HW_I2C_MASK to 0x15(BIT(0) | BIT(2)) | BIT(4)).
71 *
72 * Other configurations are vendor specified, drivers will use these information to generate peripheral instances.
73 * Usually need irqn, irqhandler, peripheral clock enable bits, peripheral reset bites, etc.
74 */
75
76// GPIO
77
78#define VSF_HW_GPIO_PORT_COUNT 1
79#define VSF_HW_GPIO_PIN_COUNT 32
80
81// I2C0, I2C2
82
83#define VSF_HW_I2C_COUNT 2
84#define VSF_HW_I2C_MASK 0x05
85#define VSF_HW_I2C0_IRQN I2C0_IRQn
86#define VSF_HW_I2C0_IRQHandler I2C0_IRQHandler
87#define VSF_HW_I2C0_REG I2C0_BASE
88#define VSF_HW_I2C2_IRQN I2C2_IRQn
89#define VSF_HW_I2C2_IRQHandler I2C2_IRQHandler
90#define VSF_HW_I2C2_REG I2C2_BASE
91
92// SPI0, SPI1
93
94#define VSF_HW_SPI_COUNT 2
95#define VSF_HW_SPI0_IRQN SPI0_IRQn
96#define VSF_HW_SPI0_IRQHandler SPI0_IRQHandler
97#define VSF_HW_SPI0_REG SPI0_BASE
98#define VSF_HW_SPI1_IRQN SPI1_IRQn
99#define VSF_HW_SPI1_IRQHandler SPI1_IRQHandler
100#define VSF_HW_SPI1_REG SPI1_BASE
101
102// QSPI0
103#define VSF_HW_QSPI_COUNT 1
104#define VSF_HW_QSPI0_IRQN QSPI0_IRQn
105#define VSF_HW_QSPI0_IRQHandler QSPI0_IRQHandler
106#define VSF_HW_QSPI0_REG QSPI0_BASE
107#define VSF_HW_QSPI1_IRQN QSPI1_IRQn
108#define VSF_HW_QSPI1_IRQHandler QSPI1_IRQHandler
109#define VSF_HW_QSPI1_REG QSPI1_BASE
110
111/*============================ MACROFIED FUNCTIONS ===========================*/
112/*============================ TYPES =========================================*/
113/*============================ GLOBAL VARIABLES ==============================*/
114/*============================ LOCAL VARIABLES ===============================*/
115/*============================ PROTOTYPES ====================================*/
116
117#endif // __VSF_HAL_DEVICE_&{VENDOR}_${DEVICE}_H__
118#endif
119/* EOF */
Generated from commit: vsfteam/vsf@cfd571b