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#include "vendor_header.h"
44
45#else
46
47/*\note __VSF_HEADER_ONLY_SHOW_ARCH_INFO__ and __VSF_HAL_SHOW_VENDOR_INFO__ are not defined.
48 * Define device information here.
49 */
50
51#ifndef __VSF_HAL_DEVICE_${VENDOR}_${DEVICE}_H__
52#define __VSF_HAL_DEVICE_${VENDOR}_${DEVICE}_H__
53
54/*============================ INCLUDES ======================================*/
55
56/*\note this is should be the only place where __common.h is included if implemented.
57 The path of __common.h is up to developer to decide.
58*/
59//#include "../common/__common.h"
60
61/*============================ MACROS ========================================*/
62
63// software interrupt provided by a dedicated device
64#define VSF_DEV_SWI_NUM 0
65
66/*\note For specified peripheral, VSF_HW_PERIPHERIAL_COUNT MUST be defined as number of peripheral instance.
67 * If peripheral instances start from 0, and are in sequence order(eg, 3 I2Cs: I2C0, I2C1, I2C2), VSF_HW_PERIPHERIAL_MASK is not needed.
68 * Otherwise, define VSF_HW_PERIPHERIAL_MASK to indicate which peripheral instances to implmenent.
69 * eg: 3 I2Cs: I2C0, I2C2, I2C4, define VSF_HW_I2C_MASK to 0x15(BIT(0) | BIT(2)) | BIT(4)).
70 *
71 * Other configurations are vendor specified, drivers will use these information to generate peripheral instances.
72 * Usually need irqn, irqhandler, peripheral clock enable bits, peripheral reset bites, etc.
73 */
74
75// IO
76
77// VSF_HW_IO_PORT_COUNT and VSF_HW_IO_PIN_COUNT are not necessary, io moudule is singleton mode.
78// Define below only if they are needed by the actual io driver.
79//#define VSF_HW_IO_PORT_COUNT VSF_HW_GPIO_PORT_COUNT
80//#define VSF_HW_IO_PIN_COUNT VSF_HW_GPIO_PIN_COUNT
81
82// GPIO
83
84#define VSF_HW_GPIO_PORT_COUNT 1
85#define VSF_HW_GPIO_PIN_COUNT 32
86
87// I2C0, I2C2
88
89#define VSF_HW_I2C_COUNT 2
90#define VSF_HW_I2C_MASK 0x05
91#define VSF_HW_I2C0_IRQN I2C0_IRQn
92#define VSF_HW_I2C0_IRQHandler I2C0_IRQHandler
93#define VSF_HW_I2C0_REG I2C0_BASE
94#define VSF_HW_I2C2_IRQN I2C2_IRQn
95#define VSF_HW_I2C2_IRQHandler I2C2_IRQHandler
96#define VSF_HW_I2C2_REG I2C2_BASE
97
98// SPI0, SPI1
99
100#define VSF_HW_USART_COUNT 2
101#define VSF_HW_USART0_IRQN UART0_IRQn
102#define VSF_HW_USART0_IRQHandler UART0_IRQHandler
103#define VSF_HW_USART0_REG UART0_BASE
104#define VSF_HW_USART1_IRQN UART1_IRQn
105#define VSF_HW_USART1_IRQHandler UART1_IRQHandler
106#define VSF_HW_USART1_REG UART1_BASE
107
108/*============================ MACROFIED FUNCTIONS ===========================*/
109/*============================ TYPES =========================================*/
110/*============================ GLOBAL VARIABLES ==============================*/
111/*============================ LOCAL VARIABLES ===============================*/
112/*============================ PROTOTYPES ====================================*/
113
114#endif // __VSF_HAL_DEVICE_&{VENDOR}_${DEVICE}_H__
115#endif
116/* EOF */