VSF Documented
usb.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#ifndef __HAL_DRIVER_MT071_USB_H__
19#define __HAL_DRIVER_MT071_USB_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_USBD == ENABLED || VSF_HAL_USE_USBH == ENABLED
26
27#include "../device.h"
28
29#include "../pm/pm.h"
31
32/*============================ MACROS ========================================*/
33/*============================ MACROFIED FUNCTIONS ===========================*/
34
35#if VSF_HAL_USE_USBD == ENABLED && VSF_HAL_USE_USBH == ENABLED
36# define __USB_OTG_DEF(__N, __VALUE) \
37 extern mt071_usb_t USB_OTG##__N##_IP; \
38 extern const i_usb_hc_ip_t VSF_USB_HC##__N##_IP; \
39 extern const i_usb_dc_ip_t VSF_USB_DC##__N##_IP;
40#elif VSF_HAL_USE_USBD == ENABLED
41# define __USB_OTG_DEF(__N, __VALUE) \
42 extern mt071_usb_t USB_OTG##__N##_IP; \
43 extern const i_usb_dc_ip_t VSF_USB_DC##__N##_IP;
44#elif VSF_HAL_USE_USBH == ENABLED
45# define __USB_OTG_DEF(__N, __VALUE) \
46 extern mt071_usb_t USB_OTG##__N##_IP; \
47 extern const i_usb_hc_ip_t VSF_USB_HC##__N##_IP;
48#endif
49
50#define _USB_OTG_DEF(__N, __VALUE) __USB_OTG_DEF(__N, __VALUE)
51#define USB_OTG_DEF(__N, __VALUE) _USB_OTG_DEF(__N, __VALUE)
52
53/*============================ TYPES =========================================*/
54
55typedef struct mt071_usb_const_t {
59 void *reg;
61
62typedef struct mt071_usb_t {
63#if VSF_HAL_USE_USBD == ENABLED && VSF_HAL_USE_USBH == ENABLED
64 bool is_host;
65#endif
66 struct {
68 void *param;
72
73/*============================ INCLUDES ======================================*/
74
75#include "./hc/usbh.h"
76#include "./dc/usbd.h"
77
78/*============================ GLOBAL VARIABLES ==============================*/
79
81
82/*============================ INCLUDES ======================================*/
83/*============================ PROTOTYPES ====================================*/
84
85#endif // VSF_HAL_USE_USBD || VSF_HAL_USE_USBH
86#endif // __HAL_DRIVER_MT071_USB_H__
87/* EOF */
enum IRQn IRQn_Type
#define USB_OTG_COUNT
Definition device.h:75
#define USB_OTG_DEF(__N, __VALUE)
Definition usb.h:43
#define NULL
Definition stddef.h:52
Definition usb.h:55
vsf_pm_sclk_no_t sclk
Definition usb.h:57
vsf_pm_pclk_no_t pclk
Definition usb.h:58
void * reg
Definition usb.h:59
IRQn_Type irq
Definition usb.h:56
Definition usb.h:62
void * param
Definition usb.h:68
const mt071_usb_const_t * param
Definition usb.h:70
bool is_host
Definition usb.h:64
usb_ip_irqhandler_t irqhandler
Definition usb.h:67
struct mt071_usb_t::@642 callback
#define VSF_MREPEAT(__COUNT, __MACRO, __PARAM)
Definition vsf_repeat_macro.h:51
vsf_pm_pclk_no_t
Definition vsf_template_pm.h:304
vsf_pm_sclk_no_t
Definition vsf_template_pm.h:242
void(* usb_ip_irqhandler_t)(void *param)
Definition vsf_template_usb.h:308