diff --git a/script/cmake/targets/Luat/Air105.cmake b/script/cmake/targets/Luat/Air105.cmake new file mode 100644 index 000000000..e4a813c05 --- /dev/null +++ b/script/cmake/targets/Luat/Air105.cmake @@ -0,0 +1,14 @@ +set(VSF_HAL_CHIP_VENDOR Luat) +set(VSF_HAL_CHIP_SERIES Air105) +set(VSF_HAL_CHIP_NAME Air105) + +set(VSF_TARGET_DEFINITIONS + "__Luat__" + "__Air105__" + + ${VSF_TARGET_DEFINITIONS} +) + +include(${VSF_CMAKE_ROOT}/targets/arm/__cortex_m4.cmake) + +set(VSF_TARGET_PATH ${VSF_SRC_PATH}/hal/driver/${VSF_HAL_CHIP_VENDOR}/${VSF_HAL_CHIP_SERIES}) diff --git a/source/hal/driver/Luat/Air105/CMakeLists.txt b/source/hal/driver/Luat/Air105/CMakeLists.txt new file mode 100644 index 000000000..ee84be6d0 --- /dev/null +++ b/source/hal/driver/Luat/Air105/CMakeLists.txt @@ -0,0 +1,4 @@ +vsf_add_sources( + driver.c + startup_Air105.c +) diff --git a/source/hal/driver/Luat/Air105/__common.h b/source/hal/driver/Luat/Air105/__common.h new file mode 100644 index 000000000..dc83b5f23 --- /dev/null +++ b/source/hal/driver/Luat/Air105/__common.h @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +#ifndef __HAL_DRIVER_LUAT_AIR105_COMMON_H__ +#define __HAL_DRIVER_LUAT_AIR105_COMMON_H__ + +/* \note __common.h should only be included by device.h */ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" +#include "hal/arch/vsf_arch.h" + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ INCLUDES ======================================*/ +/*============================ PROTOTYPES ====================================*/ + +#endif +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/__device.h b/source/hal/driver/Luat/Air105/__device.h new file mode 100644 index 000000000..f9a322f0a --- /dev/null +++ b/source/hal/driver/Luat/Air105/__device.h @@ -0,0 +1,51 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" + +#undef VSF_DEVICE_HEADER + +#if defined(__Air105__) +# define VSF_DEVICE_HEADER "./device.h" +#else +# error No supported device found. +#endif + +/* include specified device driver header file */ +#include VSF_DEVICE_HEADER + +#ifdef __VSF_HEADER_ONLY_SHOW_ARCH_INFO__ +# ifndef __CPU_ARM__ +# define __CPU_ARM__ +# endif +#else + +#ifndef __HAL_DEVICE_LUAT_AIR105_H__ +#define __HAL_DEVICE_LUAT_AIR105_H__ + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ + +#endif // __HAL_DEVICE_LUAT_AIR105_H__ +#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__ +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/common.h b/source/hal/driver/Luat/Air105/common.h new file mode 100644 index 000000000..251b93439 --- /dev/null +++ b/source/hal/driver/Luat/Air105/common.h @@ -0,0 +1,34 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +#ifndef __HAL_DRIVER_LUAT_AIR105_COMMON_H__ +#define __HAL_DRIVER_LUAT_AIR105_COMMON_H__ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" +#include "hal/arch/vsf_arch.h" + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ + +#endif +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/device.h b/source/hal/driver/Luat/Air105/device.h new file mode 100644 index 000000000..09263d9b2 --- /dev/null +++ b/source/hal/driver/Luat/Air105/device.h @@ -0,0 +1,76 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" + +/*============================ MACROS ========================================*/ + +#if defined(__VSF_HEADER_ONLY_SHOW_ARCH_INFO__) + +/*\note first define basic info for arch. */ +//! arch info +# define VSF_ARCH_PRI_NUM 64 +# define VSF_ARCH_PRI_BIT 6 + +// software interrupt provided by a dedicated device +#define VSF_DEV_SWI_NUM 9 + +#elif defined(__VSF_HAL_SHOW_VENDOR_INFO__) + +# ifdef FALSE +# undef FALSE +# endif +# ifdef TRUE +# undef TRUE +# endif + +# define __VSF_HEADER_ONLY_SHOW_VENDOR_INFO__ +# include "air105.h" + +#else + +#ifndef __HAL_DEVICE_LUAT_AIR05_H__ +#define __HAL_DEVICE_LUAT_AIR05_H__ + +/*============================ INCLUDES ======================================*/ + +#include "common.h" + +/*============================ MACROS ========================================*/ + +// software interrupt provided by a dedicated device +#define VSF_DEV_SWI_LIST 28, 30, 31, 34, 41, 43, 44, 45, 48 + +#define VSF_MUSB_FDRC_PRIV_REG_T +#define VSF_MUSB_FDRC_DYNAMIC_FIFO2 + +#define USB_OTG_COUNT 1 +#define USB_OTG0_CONFIG \ + .reg = (void *)0x40000C00, \ + .irqn = 1, + +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ + +#endif // __HAL_DEVICE_LUAT_AIR05_H__ +#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__ +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/driver.c b/source/hal/driver/Luat/Air105/driver.c new file mode 100644 index 000000000..622515e32 --- /dev/null +++ b/source/hal/driver/Luat/Air105/driver.c @@ -0,0 +1,80 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" + +#ifdef FALSE +# undef FALSE +#endif +#ifdef TRUE +# undef TRUE +#endif +#include "air105.h" +#undef CRC + +#include "global_config.h" + +#include "./device.h" +#include "./driver.h" + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ + +uint32_t SystemCoreClock; + +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ +/*============================ IMPLEMENTATION ================================*/ + +#include "hal/driver/common/swi/arm/vsf_swi_template.inc" + +int vsf_hal_pre_startup_init(void) +{ + // seems systick is not reset on hw reset of aic8800 + // avoid systick interrupt before os started + SysTick->CTRL = 0; + return 1; +} + +/*! \note initialize device driver + * \param none + * \retval true initialization succeeded. + * \retval false initialization failed + */ +WEAK(vsf_driver_init) +bool vsf_driver_init(void) +{ + //SystemInit(); + SYSCTRL->CG_CTRL1 = SYSCTRL_APBPeriph_ALL; + SYSCTRL->SOFT_RST1 = SYSCTRL_APBPeriph_ALL; + SYSCTRL->SOFT_RST2 &= ~SYSCTRL_USB_RESET; + SYSCTRL->LOCK_R |= SYSCTRL_USB_RESET; + SYSCTRL->LDO25_CR &= ~(VSF_BIT(4) | VSF_BIT(5)); + BPU->SEN_ANA0 |= (7 << 25) | (2 << 29); + + //SystemCoreClockUpdate(); + SystemCoreClock = HSE_VALUE * (((SYSCTRL->FREQ_SEL & SYSCTRL_FREQ_SEL_XTAL_Mask) >> SYSCTRL_FREQ_SEL_XTAL_Pos) + 1); + + return true; +} + + +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/driver.h b/source/hal/driver/Luat/Air105/driver.h new file mode 100644 index 000000000..55e1ddd21 --- /dev/null +++ b/source/hal/driver/Luat/Air105/driver.h @@ -0,0 +1,42 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +#if defined(__VSF_HEADER_ONLY_SHOW_ARCH_INFO__) || defined(__VSF_HAL_SHOW_VENDOR_INFO__) + +# include "__device.h" + +#else + +#ifndef __HAL_DRIVER_LUAT_AIR05_H__ +#define __HAL_DRIVER_LUAT_AIR05_H__ + +/*============================ INCLUDES ======================================*/ + +# include "hal/vsf_hal_cfg.h" +# include "./device.h" + +# include "./usb/usb.h" + +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ INCLUDES ======================================*/ +/*============================ TYPES =========================================*/ +/*============================ INCLUDES ======================================*/ + +# endif // __HAL_DRIVER_LUAT_AIR05_H__ +#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__ +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/startup_Air105.c b/source/hal/driver/Luat/Air105/startup_Air105.c new file mode 100644 index 000000000..07402f886 --- /dev/null +++ b/source/hal/driver/Luat/Air105/startup_Air105.c @@ -0,0 +1,210 @@ +/****************************************************************************** + * @file startup_ARMCM4.c + * @brief CMSIS-Core(M) Device Startup File for a Cortex-M4 Device + * @version V2.0.0 + * @date 04. June 2019 + ******************************************************************************/ +/* + * Copyright (c) 2009-2019 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "./device.h" + +// for WEAK in compiler +#include "utilities/vsf_utilities.h" + +// header which will include core_cm4.h +#ifdef FALSE +# undef FALSE +#endif +#ifdef TRUE +# undef TRUE +#endif +#include "air105.h" +#include "global_config.h" + +#define __imp_unprocessed_weak_handler(__name) \ + WEAK(__name) \ + void __name(void){} +#define __imp_blocked_weak_handler(__name) \ + WEAK(__name) \ + void __name(void){while(1);} + +/*---------------------------------------------------------------------------- + Exception / Interrupt Handler Function Prototype + *----------------------------------------------------------------------------*/ +typedef void( *pFunc )( void ); + +/*---------------------------------------------------------------------------- + External References + *----------------------------------------------------------------------------*/ +extern uint32_t __INITIAL_SP; + +extern __NO_RETURN void __PROGRAM_START(void); + +/*---------------------------------------------------------------------------- + Internal References + *----------------------------------------------------------------------------*/ + +void __NO_RETURN Reset_Handler (void); + +/*---------------------------------------------------------------------------- + Exception / Interrupt Handler + *----------------------------------------------------------------------------*/ +/* Exceptions */ +__imp_unprocessed_weak_handler(NMI_Handler) +__imp_blocked_weak_handler(HardFault_Handler) +__imp_blocked_weak_handler(MemManage_Handler) +__imp_blocked_weak_handler(BusFault_Handler) +__imp_blocked_weak_handler(UsageFault_Handler) + +__imp_unprocessed_weak_handler(SVC_Handler) +__imp_unprocessed_weak_handler(DebugMon_Handler) +__imp_unprocessed_weak_handler(PendSV_Handler) +__imp_unprocessed_weak_handler(SysTick_Handler) + +/* External interrupts */ +__imp_unprocessed_weak_handler(ISR_GlobalHandler) +__imp_unprocessed_weak_handler(SWI0_Handler) +__imp_unprocessed_weak_handler(SWI1_Handler) +__imp_unprocessed_weak_handler(SWI2_Handler) +__imp_unprocessed_weak_handler(SWI3_Handler) +__imp_unprocessed_weak_handler(SWI4_Handler) +__imp_unprocessed_weak_handler(SWI5_Handler) +__imp_unprocessed_weak_handler(SWI6_Handler) +__imp_unprocessed_weak_handler(SWI7_Handler) +__imp_unprocessed_weak_handler(SWI8_Handler) +__imp_unprocessed_weak_handler(USB_OTG0_Handler) + +/*---------------------------------------------------------------------------- + Exception / Interrupt Vector table + *----------------------------------------------------------------------------*/ + +#if defined ( __GNUC__ ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#endif + +ROOT const pFunc __VECTOR_TABLE[] = { + (pFunc)(&__INITIAL_SP), /* Initial Stack Pointer */ + Reset_Handler, /* Reset Handler */ + NMI_Handler, /* -14 NMI Handler */ + HardFault_Handler, /* -13 Hard Fault Handler */ + MemManage_Handler, /* -12 MPU Fault Handler */ + BusFault_Handler, /* -11 Bus Fault Handler */ + UsageFault_Handler, /* -10 Usage Fault Handler */ + 0, /* Reserved */ + 0, /* Reserved */ + 0, /* Reserved */ + 0, /* Reserved */ + SVC_Handler, /* -5 SVCall Handler */ + DebugMon_Handler, /* -4 Debug Monitor Handler */ + 0, /* Reserved */ + PendSV_Handler, /* -2 PendSV Handler */ + SysTick_Handler, /* -1 SysTick Handler */ + + /* Interrupts */ + ISR_GlobalHandler, + USB_OTG0_Handler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + SWI0_Handler, + ISR_GlobalHandler, + SWI1_Handler, + SWI2_Handler, + ISR_GlobalHandler, + ISR_GlobalHandler, + SWI3_Handler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, + SWI4_Handler, + ISR_GlobalHandler, + SWI5_Handler, + SWI6_Handler, + SWI7_Handler, + ISR_GlobalHandler, + ISR_GlobalHandler, + SWI8_Handler, + ISR_GlobalHandler, + ISR_GlobalHandler, + ISR_GlobalHandler, +}; + +WEAK(g_CAppInfo) +ROOT const uint32_t g_CAppInfo[] __VECTOR_TABLE_ATTRIBUTE = { + __APP_START_MAGIC__, + (uint32_t)__VECTOR_TABLE, + __BL_VERSION__, + __CORE_VERSION__, + 0, + 0, + 0, + 0, +}; + +#if defined ( __GNUC__ ) +#pragma GCC diagnostic pop +#endif + +WEAK(vsf_hal_pre_startup_init) +void vsf_hal_pre_startup_init(void) +{} + +/*---------------------------------------------------------------------------- + Reset Handler called on controller reset + *----------------------------------------------------------------------------*/ +void Reset_Handler(void) +{ + vsf_arch_set_stack((uintptr_t)&__INITIAL_SP); + vsf_hal_pre_startup_init(); + + //! enable FPU + SCB->CPACR |= ((3U << 10U*2U) | /* enable CP10 Full Access */ + (3U << 11U*2U) ); /* enable CP11 Full Access */ + + SCB->VTOR = (uint32_t)__VECTOR_TABLE; + + __PROGRAM_START(); /* Enter PreMain (C library entry point) */ +} diff --git a/source/hal/driver/Luat/Air105/usb/dc/usbd.c b/source/hal/driver/Luat/Air105/usb/dc/usbd.c new file mode 100644 index 000000000..a4b337e69 --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/dc/usbd.c @@ -0,0 +1,96 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "../../__common.h" +#include "./usbd.h" + +#if VSF_USE_USB_DEVICE == ENABLED && VSF_HAL_USE_USBD == ENABLED + +#include "component/usb/driver/otg/musb/fdrc/vsf_musb_fdrc_hw.h" + +#ifdef FALSE +# undef FALSE +#endif +#ifdef TRUE +# undef TRUE +#endif +#include "air105.h" + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ + +extern void __vsf_hw_usb_fifo_reset(vsf_hw_usb_t *usb); +extern vsf_err_t __vsf_hw_usb_init_interrupt(vsf_hw_usb_t *usb, vsf_arch_prio_t priority); +extern void __vsf_hw_usb_irq(vsf_hw_usb_t *usb); + +/*============================ IMPLEMENTATION ================================*/ + +vsf_err_t vsf_hw_usbd_init(vsf_hw_usb_t *dc, usb_dc_ip_cfg_t *cfg) +{ +#if VSF_HAL_USE_USBH == ENABLED + // hc->is_host only exists when both host and device modes are enabled + dc->is_host = false; +#endif + dc->callback.irqhandler = cfg->irqhandler; + dc->callback.param = cfg->param; + + __vsf_hw_usb_fifo_reset(dc); + __vsf_hw_usb_init_interrupt(dc, cfg->priority); + + return VSF_ERR_NONE; +} + +void vsf_hw_usbd_fini(vsf_hw_usb_t *dc) +{ + +} + +void vsf_hw_usbd_get_info(vsf_hw_usb_t *dc, usb_dc_ip_info_t *info) +{ + VSF_HAL_ASSERT(info != NULL); + const vsf_hw_usb_const_t *musb_param = dc->param; + vk_musb_fdrc_dc_ip_info_t *musb_hw_info = (vk_musb_fdrc_dc_ip_info_t *)info; + + musb_hw_info->Common = (void *)((uintptr_t)musb_param->reg + 0x00); + musb_hw_info->EP = (void *)((uintptr_t)musb_param->reg + 0x10); + musb_hw_info->FIFO = (void *)((uintptr_t)musb_param->reg + 0x20); + musb_hw_info->ep_num = vsf_hw_usbd_ep_number; + musb_hw_info->is_dma = vsf_hw_usbd_ep_is_dma; +} + +void vsf_hw_usbd_connect(vsf_hw_usb_t *dc) +{ + +} + +void vsf_hw_usbd_disconnect(vsf_hw_usb_t *dc) +{ + +} + +void vsf_hw_usbd_irq(vsf_hw_usb_t *dc) +{ + __vsf_hw_usb_irq(dc); +} + +#endif // VSF_HAL_USE_USBD diff --git a/source/hal/driver/Luat/Air105/usb/dc/usbd.h b/source/hal/driver/Luat/Air105/usb/dc/usbd.h new file mode 100644 index 000000000..0ced427c2 --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/dc/usbd.h @@ -0,0 +1,50 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +#ifndef __HAL_DRIVER_AIR105_USBD_H__ +#define __HAL_DRIVER_AIR105_USBD_H__ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" +#include "../../__device.h" + +#include "../usb.h" + +#if VSF_HAL_USE_USBD == ENABLED + +/*============================ MACROS ========================================*/ + +#define vsf_hw_usbd_ep_number 10 +#define vsf_hw_usbd_ep_is_dma false + +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ INCLUDES ======================================*/ +/*============================ PROTOTYPES ====================================*/ + +extern vsf_err_t vsf_hw_usbd_init(vsf_hw_usb_t *dc, usb_dc_ip_cfg_t *cfg); +extern void vsf_hw_usbd_fini(vsf_hw_usb_t *dc); +extern void vsf_hw_usbd_get_info(vsf_hw_usb_t *dc, usb_dc_ip_info_t *info); +extern void vsf_hw_usbd_connect(vsf_hw_usb_t *dc); +extern void vsf_hw_usbd_disconnect(vsf_hw_usb_t *dc); +extern void vsf_hw_usbd_irq(vsf_hw_usb_t *dc); + +#endif // VSF_HAL_USE_USBD +#endif // __HAL_DRIVER_AIR105_USBD_H__ +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/usb/hc/usbh.c b/source/hal/driver/Luat/Air105/usb/hc/usbh.c new file mode 100644 index 000000000..12fec6387 --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/hc/usbh.c @@ -0,0 +1,88 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "../../__common.h" +#include "./usbh.h" + +#if VSF_USE_USB_HOST == ENABLED && VSF_HAL_USE_USBH == ENABLED + +#include "component/usb/driver/otg/musb/fdrc/vsf_musb_fdrc_hw.h" + +#ifdef FALSE +# undef FALSE +#endif +#ifdef TRUE +# undef TRUE +#endif +#include "air105.h" + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ + +extern vsf_err_t __vsf_hw_usb_init_interrupt(vsf_hw_usb_t *usb, vsf_arch_prio_t priority); +extern void __vsf_hw_usb_irq(vsf_hw_usb_t *usb); + +/*============================ IMPLEMENTATION ================================*/ + +vsf_err_t vsf_hw_usbh_init(vsf_hw_usb_t *hc, usb_hc_ip_cfg_t *cfg) +{ + int idx = hc->param->idx; + JL_USB_TypeDef *usb_reg = (JL_USB_TypeDef *)hc->param->reg.usb_reg; + JL_USB_IO_TypeDef *usb_io_reg = (JL_USB_IO_TypeDef *)hc->param->reg.io_reg; + +#if VSF_HAL_USE_USBD == ENABLED + // hc->is_host only exists when both host and device modes are enabled + hc->is_host = true; +#endif + hc->callback.irqhandler = cfg->irqhandler; + hc->callback.param = cfg->param; + + __vsf_hw_usb_fifo_reset(hc); + __vsf_hw_usb_init_interrupt(hc, cfg->priority); + + return VSF_ERR_NONE; +} + +void vsf_hw_usbh_get_info(vsf_hw_usb_t *hc, usb_hc_ip_info_t *info) +{ + VSF_ASSERT(info != NULL); + vsf_hw_usb_const_t *musb_param = hc->param; + vk_musb_fdrc_hc_ip_info_t *musb_hw_info = (vk_musb_fdrc_hc_ip_info_t *)info; + + musb_hw_info->Common = musb_param->reg.sie_reg; + musb_hw_info->EP = musb_param->reg.ep_reg; + musb_hw_info->FIFO = NULL; + musb_hw_info->param = hc; + musb_hw_info->get_ep_reg = musb_param->fn.get_ep_reg; + musb_hw_info->set_ep_fifo = musb_param->fn.set_ep_fifo; + musb_hw_info->write_ep_fifo = musb_param->fn.write_ep_fifo; + musb_hw_info->ep_num = vsf_hw_usbh_ep_number; + musb_hw_info->is_dma = vsf_hw_usbh_ep_is_dma; +} + +void vsf_hw_usbh_irq(vsf_hw_usb_t *hc) +{ + __vsf_hw_usb_irq(hc); +} + +#endif // VSF_HAL_USE_USBH diff --git a/source/hal/driver/Luat/Air105/usb/hc/usbh.h b/source/hal/driver/Luat/Air105/usb/hc/usbh.h new file mode 100644 index 000000000..f03feba20 --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/hc/usbh.h @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +#ifndef __HAL_DRIVER_AIR105_USBH_H__ +#define __HAL_DRIVER_AIR105_USBH_H__ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" +#include "../../__device.h" + +#include "../usb.h" + +#if VSF_HAL_USE_USBH == ENABLED + +/*============================ MACROS ========================================*/ + +#define vsf_hw_usbh_ep_number 5 +#define vsf_hw_usbh_ep_is_dma true + +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ INCLUDES ======================================*/ +/*============================ PROTOTYPES ====================================*/ + +extern vsf_err_t vsf_hw_usbh_init(vsf_hw_usb_t *hc, usb_hc_ip_cfg_t *cfg); +extern void vsf_hw_usbh_get_info(vsf_hw_usb_t *hc, usb_hc_ip_info_t *info); +extern void vsf_hw_usbh_irq(vsf_hw_usb_t *hc); + +#endif // VSF_HAL_USE_USBH +#endif // __HAL_DRIVER_AIR105_USBH_H__ +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/usb/usb.c b/source/hal/driver/Luat/Air105/usb/usb.c new file mode 100644 index 000000000..c3b2abc64 --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/usb.c @@ -0,0 +1,66 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "../__common.h" +#include "./usb.h" + +#if VSF_HAL_USE_USBD == ENABLED || VSF_HAL_USE_USBH == ENABLED + +/*============================ MACROS ========================================*/ + +#if VSF_HAL_USE_USBH == ENABLED +# define __USB_HC_INTERFACE_DEF(__N, __VALUE) \ +const i_usb_hc_ip_t VSF_USB_HC##__N##_IP = __USB_HC_IP_INTERFACE_FUNC_DEF(__N, __VALUE); +#endif + +#if VSF_HAL_USE_USBD == ENABLED +# define __USB_DC_INTERFACE_DEF(__N, __VALUE) \ +const i_usb_dc_ip_t VSF_USB_DC##__N##_IP = __USB_DC_IP_INTERFACE_FUNC_DEF(__N, __VALUE); +#endif + +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ + +#if USB_OTG_COUNT > 0 +# if VSF_HAL_USE_USBH == ENABLED +VSF_MREPEAT(USB_OTG_COUNT, __USB_HC_IP_FUNC_DEF, NULL) +VSF_MREPEAT(USB_OTG_COUNT, __USB_HC_INTERFACE_DEF, NULL) +# endif + +# if VSF_HAL_USE_USBD == ENABLED +VSF_MREPEAT(USB_OTG_COUNT, __USB_DC_IP_FUNC_DEF, NULL) +VSF_MREPEAT(USB_OTG_COUNT, __USB_DC_INTERFACE_DEF, NULL) +# endif +#endif + +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ +/*============================ IMPLEMENTATION ================================*/ + +#if USB_OTG_COUNT > 0 +# if VSF_HAL_USE_USBH == ENABLED +VSF_MREPEAT(USB_OTG_COUNT, __USB_OTG_HC_IP_BODY, vsf_hw_usbh) +# endif +# if VSF_HAL_USE_USBD == ENABLED +VSF_MREPEAT(USB_OTG_COUNT, __USB_OTG_DC_IP_BODY, vsf_hw_usbd) +# endif +#endif + +#endif // VSF_HAL_USE_USBD || VSF_HAL_USE_USBH diff --git a/source/hal/driver/Luat/Air105/usb/usb.h b/source/hal/driver/Luat/Air105/usb/usb.h new file mode 100644 index 000000000..104c4a9ce --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/usb.h @@ -0,0 +1,107 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +#ifndef __HAL_DRIVER_AIR105_USB_H__ +#define __HAL_DRIVER_AIR105_USB_H__ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" + +#if VSF_HAL_USE_USBD == ENABLED || VSF_HAL_USE_USBH == ENABLED + +#include "../__device.h" + +#include "hal/driver/common/template/vsf_template_usb.h" + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ + +#if VSF_HAL_USE_USBD == ENABLED && VSF_HAL_USE_USBH == ENABLED +# define __USB_OTG_DEF(__N, __VALUE) \ + extern vsf_hw_usb_t USB_OTG##__N##_IP; \ + extern const i_usb_hc_ip_t VSF_USB_HC##__N##_IP; \ + extern const i_usb_dc_ip_t VSF_USB_DC##__N##_IP; +#elif VSF_HAL_USE_USBD == ENABLED +# define __USB_OTG_DEF(__N, __VALUE) \ + extern vsf_hw_usb_t USB_OTG##__N##_IP; \ + extern const i_usb_dc_ip_t VSF_USB_DC##__N##_IP; +#elif VSF_HAL_USE_USBH == ENABLED +# define __USB_OTG_DEF(__N, __VALUE) \ + extern vsf_hw_usb_t USB_OTG##__N##_IP; \ + extern const i_usb_hc_ip_t VSF_USB_HC##__N##_IP; +#endif + +#define _USB_OTG_DEF(__N, __VALUE) __USB_OTG_DEF(__N, __VALUE) +#define USB_OTG_DEF(__N, __VALUE) _USB_OTG_DEF(__N, __VALUE) + +/*============================ TYPES =========================================*/ + +#ifdef VSF_MUSB_FDRC_PRIV_REG_T +typedef struct vk_musb_fdrc_common_reg_t { + volatile uint8_t FAddr; + volatile uint8_t Power; + volatile uint8_t IntrTx1; + volatile uint8_t IntrTx2; + volatile uint8_t IntrRx1; + volatile uint8_t IntrRx2; + volatile uint8_t IntrTx1E; + volatile uint8_t IntrTx2E; + volatile uint8_t IntrRx1E; + volatile uint8_t IntrRx2E; + volatile uint8_t IntrUSB; + volatile uint8_t IntrUSBE; + volatile uint8_t Frame1; + volatile uint8_t Frame2; + volatile uint8_t Index; + volatile uint8_t Dummy[1 + 0x50]; + volatile uint8_t DevCtl; +} PACKED vk_musb_fdrc_common_reg_t; +#endif + +typedef struct vsf_hw_usb_const_t { + void *reg; + uint8_t irqn; +} vsf_hw_usb_const_t; + +typedef struct vsf_hw_usb_t { +#if VSF_HAL_USE_USBD == ENABLED && VSF_HAL_USE_USBH == ENABLED + bool is_host; +#endif + + struct { + usb_ip_irqhandler_t irqhandler; + void *param; + } callback; + const vsf_hw_usb_const_t *param; +} vsf_hw_usb_t; + +/*============================ INCLUDES ======================================*/ + +#include "./hc/usbh.h" +#include "./dc/usbd.h" + +/*============================ GLOBAL VARIABLES ==============================*/ + +VSF_MREPEAT(USB_OTG_COUNT, USB_OTG_DEF, NULL) + +/*============================ INCLUDES ======================================*/ +/*============================ PROTOTYPES ====================================*/ + +#endif // VSF_HAL_USE_USBD || VSF_HAL_USE_USBH +#endif // __HAL_DRIVER_AIR105_USB_H__ +/* EOF */ diff --git a/source/hal/driver/Luat/Air105/usb/usb_common.c b/source/hal/driver/Luat/Air105/usb/usb_common.c new file mode 100644 index 000000000..9436831dd --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/usb_common.c @@ -0,0 +1,80 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "../__common.h" +#include "./usb.h" + +#if VSF_HAL_USE_USBD == ENABLED || VSF_HAL_USE_USBH == ENABLED + +#include "component/usb/driver/otg/musb/fdrc/vsf_musb_fdrc_hw.h" + +#ifdef FALSE +# undef FALSE +#endif +#ifdef TRUE +# undef TRUE +#endif +#include "air105.h" + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ + +#define __AIR105_MUSB_ISR_DEF(__N, __VALUE) \ + USB_OTG##__N##_IRQHandler, +#define _AIR105_MUSB_ISR_DEF(__N, __VALUE) __AIR105_MUSB_ISR_DEF(__N, __VALUE) +#define AIR105_MUSB_ISR_DEF(__N, __VALUE) _AIR105_MUSB_ISR_DEF(__N, __VALUE) + +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ +/*============================ IMPLEMENTATION ================================*/ + +void __vsf_hw_usb_irq(vsf_hw_usb_t *usb) +{ + if (usb->callback.irqhandler != NULL) { + usb->callback.irqhandler(usb->callback.param); + } +} + +vsf_err_t __vsf_hw_usb_init_interrupt(vsf_hw_usb_t *usb, vsf_arch_prio_t priority) +{ + { + vk_musb_fdrc_common_reg_t *common_reg = (vk_musb_fdrc_common_reg_t *)usb->param->reg; + common_reg->Power = 0; + common_reg->IntrUSBE = 0; + common_reg->IntrTx1E = 0; + common_reg->IntrTx2E = 0; + common_reg->IntrRx1E = 0; + common_reg->IntrRx2E = 0; + } + + if (priority >= 0) { + IRQn_Type irq = usb->param->irqn; + NVIC_SetPriority(irq, (uint32_t)priority); + NVIC_EnableIRQ(irq); + } + return VSF_ERR_NONE; +} + +void __vsf_hw_usb_fifo_reset(vsf_hw_usb_t *usb) +{ +} + +#endif // VSF_HAL_USE_USBD && VSF_HAL_USE_USBH diff --git a/source/hal/driver/Luat/Air105/usb/usb_lv0.c b/source/hal/driver/Luat/Air105/usb/usb_lv0.c new file mode 100644 index 000000000..45a5d707d --- /dev/null +++ b/source/hal/driver/Luat/Air105/usb/usb_lv0.c @@ -0,0 +1,75 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "../__common.h" +#include "./usb.h" + +#if VSF_HAL_USE_USBD == ENABLED || VSF_HAL_USE_USBH == ENABLED + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ + +#if VSF_HAL_USE_USBD == ENABLED && VSF_HAL_USE_USBH == ENABLED +# define __USB_OTG_IMPLEMENT_IRQHANDLER(__N) \ + if (USB_OTG##__N##_IP.is_host) { \ + vsf_hw_usbh_irq(&USB_OTG##__N##_IP); \ + } else { \ + vsf_hw_usbd_irq(&USB_OTG##__N##_IP); \ + } +#elif VSF_HAL_USE_USBD == ENABLED +# define __USB_OTG_IMPLEMENT_IRQHANDLER(__N) \ + vsf_hw_usbd_irq(&USB_OTG##__N##_IP); +#elif VSF_HAL_USE_USBH == ENABLED +# define __USB_OTG_IMPLEMENT_IRQHANDLER(__N) \ + vsf_hw_usbh_irq(&USB_OTG##__N##_IP); +#endif + +#define ____USB_OTG_IMPLEMENT(__N, __VALUE) \ +extern vsf_err_t USB_OTG##__N##_set_ep_fifo(vsf_hw_usb_t *usb, uint8_t ep, uint8_t *buffer, uint_fast16_t size);\ +extern vsf_err_t USB_OTG##__N##_write_ep_fifo(vsf_hw_usb_t *usb, uint8_t ep, uint_fast16_t size);\ +extern void * USB_OTG##__N##_get_ep_reg(void); \ +void USB_OTG##__N##_IRQHandler(void) \ +{ \ + __USB_OTG_IMPLEMENT_IRQHANDLER(__N) \ +} \ +static const vsf_hw_usb_const_t __USB_OTG##__N##_const = { \ + USB_OTG##__N##_CONFIG \ +}; \ +vsf_hw_usb_t USB_OTG##__N##_IP = { \ + .param = &__USB_OTG##__N##_const, \ +}; + + +#define __USB_OTG_IMPLEMENT(__N, __VALUE) ____USB_OTG_IMPLEMENT(__N, __VALUE) +#define USB_OTG_IMPLEMENT(__N, __VALUE) __USB_OTG_IMPLEMENT(__N, __VALUE) + +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ +/*============================ IMPLEMENTATION ================================*/ + +WEAK(vsf_hw_usbd_irq) +void vsf_hw_usbd_irq(vsf_hw_usb_t *dc) { VSF_HAL_ASSERT(false); } +WEAK(vsf_hw_usbh_irq) +void vsf_hw_usbh_irq(vsf_hw_usb_t *dc) { VSF_HAL_ASSERT(false); } + +VSF_MREPEAT(USB_OTG_COUNT, USB_OTG_IMPLEMENT, NULL) + +#endif // VSF_HAL_USE_USBD || VSF_HAL_USE_USBH diff --git a/source/hal/driver/Luat/CMakeLists.txt b/source/hal/driver/Luat/CMakeLists.txt new file mode 100644 index 000000000..9a66efd1e --- /dev/null +++ b/source/hal/driver/Luat/CMakeLists.txt @@ -0,0 +1,5 @@ +if(NOT IS_DIRECTORY ${VSF_PRIVATE_BASE}/hal/driver/${VSF_HAL_CHIP_VENDOR}/${VSF_HAL_CHIP_SERIES}) + add_subdirectory_existed(${VSF_HAL_CHIP_SERIES}) +else() + message(STATUS "User defined driver is detected: ${VSF_PRIVATE_BASE}/hal/driver/${VSF_HAL_CHIP_VENDOR}/${VSF_HAL_CHIP_SERIES}") +endif() diff --git a/source/hal/driver/Luat/driver.h b/source/hal/driver/Luat/driver.h new file mode 100644 index 000000000..1f562e931 --- /dev/null +++ b/source/hal/driver/Luat/driver.h @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright(C)2009-2022 by VSF Team * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + ****************************************************************************/ + +/*============================ INCLUDES ======================================*/ + +#include "hal/vsf_hal_cfg.h" + +#undef VSF_LUAT_DRIVER_HEADER + +#if defined(__Air105__) +# define VSF_LUAT_DRIVER_HEADER "./Air105/driver.h" +#else +# error No supported device found. +#endif + +/* include specified device driver header file */ +#include VSF_LUAT_DRIVER_HEADER + + + +#ifndef __HAL_DRIVER_LUAT_H__ +#define __HAL_DRIVER_LUAT_H__ + + +/*============================ MACROS ========================================*/ +/*============================ MACROFIED FUNCTIONS ===========================*/ +/*============================ TYPES =========================================*/ +/*============================ GLOBAL VARIABLES ==============================*/ +/*============================ LOCAL VARIABLES ===============================*/ +/*============================ PROTOTYPES ====================================*/ + + +#endif +/* EOF */ diff --git a/source/hal/driver/driver.h b/source/hal/driver/driver.h index 6a5660d87..e3b389584 100644 --- a/source/hal/driver/driver.h +++ b/source/hal/driver/driver.h @@ -70,6 +70,8 @@ # define VSF_DRIVER_HEADER "./Artery/driver.h" # elif defined(__BouffaloLab__) # define VSF_DRIVER_HEADER "./BouffaloLab/driver.h" +# elif defined(__Luat__) +# define VSF_DRIVER_HEADER "./Luat/driver.h" /* example # elif defined(__COMPANY_NAME_A__) # define VSF_DRIVER_HEADER "./company_name_a/driver.h"