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_AIR105_USB_H__
19#define __HAL_DRIVER_AIR105_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
30
31/*============================ MACROS ========================================*/
32/*============================ MACROFIED FUNCTIONS ===========================*/
33
34#if VSF_HAL_USE_USBD == ENABLED && VSF_HAL_USE_USBH == ENABLED
35# define __USB_OTG_DEF(__N, __VALUE) \
36 extern vsf_hw_usb_t USB_OTG##__N##_IP; \
37 extern const i_usb_hc_ip_t VSF_USB_HC##__N##_IP; \
38 extern const i_usb_dc_ip_t VSF_USB_DC##__N##_IP;
39#elif VSF_HAL_USE_USBD == ENABLED
40# define __USB_OTG_DEF(__N, __VALUE) \
41 extern vsf_hw_usb_t USB_OTG##__N##_IP; \
42 extern const i_usb_dc_ip_t VSF_USB_DC##__N##_IP;
43#elif VSF_HAL_USE_USBH == ENABLED
44# define __USB_OTG_DEF(__N, __VALUE) \
45 extern vsf_hw_usb_t USB_OTG##__N##_IP; \
46 extern const i_usb_hc_ip_t VSF_USB_HC##__N##_IP;
47#endif
48
49#define _USB_OTG_DEF(__N, __VALUE) __USB_OTG_DEF(__N, __VALUE)
50#define USB_OTG_DEF(__N, __VALUE) _USB_OTG_DEF(__N, __VALUE)
51
52/*============================ TYPES =========================================*/
53
54#ifdef VSF_MUSB_FDRC_PRIV_REG_T
55typedef struct vk_musb_fdrc_common_reg_t {
56 volatile uint8_t FAddr;
57 volatile uint8_t Power;
58 volatile uint8_t IntrTx1;
59 volatile uint8_t IntrTx2;
60 volatile uint8_t IntrRx1;
61 volatile uint8_t IntrRx2;
62 volatile uint8_t IntrTx1E;
63 volatile uint8_t IntrTx2E;
64 volatile uint8_t IntrRx1E;
65 volatile uint8_t IntrRx2E;
66 volatile uint8_t IntrUSB;
67 volatile uint8_t IntrUSBE;
68 volatile uint8_t Frame1;
69 volatile uint8_t Frame2;
70 volatile uint8_t Index;
71 volatile uint8_t Dummy[1 + 0x50];
72 volatile uint8_t DevCtl;
74#endif
75
76typedef struct vsf_hw_usb_const_t {
77 void *reg;
80
81typedef struct vsf_hw_usb_t {
82#if VSF_HAL_USE_USBD == ENABLED && VSF_HAL_USE_USBH == ENABLED
83 bool is_host;
84#endif
85
86 struct {
88 void *param;
92
93/*============================ INCLUDES ======================================*/
94
95#include "./hc/usbh.h"
96#include "./dc/usbd.h"
97
98/*============================ GLOBAL VARIABLES ==============================*/
99
101
102/*============================ INCLUDES ======================================*/
103/*============================ PROTOTYPES ====================================*/
104
105#endif // VSF_HAL_USE_USBD || VSF_HAL_USE_USBH
106#endif // __HAL_DRIVER_AIR105_USB_H__
107/* EOF */
#define USB_OTG_COUNT
Definition device.h:75
#define USB_OTG_DEF(__N, __VALUE)
Definition usb.h:43
struct vsf_hw_usb_t vsf_hw_usb_t
struct vsf_hw_usb_const_t vsf_hw_usb_const_t
#define NULL
Definition stddef.h:52
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_musb_fdrc_hw.h:153
volatile vk_musb_reg_t FAddr
Definition vsf_musb_fdrc_hw.h:154
volatile vk_musb_reg_t Frame2
Definition vsf_musb_fdrc_hw.h:167
volatile vk_musb_reg_t Power
Definition vsf_musb_fdrc_hw.h:155
volatile vk_musb_reg_t IntrRx2
Definition vsf_musb_fdrc_hw.h:159
volatile vk_musb_reg_t IntrUSBE
Definition vsf_musb_fdrc_hw.h:165
volatile vk_musb_reg_t IntrTx1
Definition vsf_musb_fdrc_hw.h:156
volatile vk_musb_reg_t Frame1
Definition vsf_musb_fdrc_hw.h:166
volatile vk_musb_reg_t IntrTx2
Definition vsf_musb_fdrc_hw.h:157
volatile vk_musb_reg_t Index
Definition vsf_musb_fdrc_hw.h:168
volatile vk_musb_reg_t IntrUSB
Definition vsf_musb_fdrc_hw.h:160
volatile vk_musb_reg_t IntrTx1E
Definition vsf_musb_fdrc_hw.h:161
volatile vk_musb_reg_t IntrRx1E
Definition vsf_musb_fdrc_hw.h:163
volatile vk_musb_reg_t IntrTx2E
Definition vsf_musb_fdrc_hw.h:162
volatile vk_musb_reg_t DevCtl
Definition vsf_musb_fdrc_hw.h:169
volatile vk_musb_reg_t IntrRx1
Definition vsf_musb_fdrc_hw.h:158
volatile vk_musb_reg_t IntrRx2E
Definition vsf_musb_fdrc_hw.h:164
Definition usb.h:44
uint8_t irqn
Definition usb.h:78
void * reg
Definition usb.h:48
Definition usb.h:53
usb_ip_irqhandler_t irqhandler
Definition usb.h:56
struct vsf_hw_usb_t::@498 callback
void * param
Definition usb.h:57
bool is_host
Definition usb.h:54
#define VSF_MREPEAT(__COUNT, __MACRO, __PARAM)
Definition vsf_repeat_macro.h:51
struct vk_romfs_header_t VSF_CAL_PACKED
void(* usb_ip_irqhandler_t)(void *param)
Definition vsf_template_usb.h:308