1/*
2 * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 *    conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 *    of conditions and the following disclaimer in the documentation and/or other materials
13 *    provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 *    to endorse or promote products derived from this software without specific prior written
17 *    permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _USB_API_H
33#define	_USB_API_H
34
35#include <los_config.h>
36#include "sys/module.h"
37
38#ifdef __cplusplus
39#if __cplusplus
40extern "C" {
41#endif /* __cplusplus */
42#endif /* __cplusplus */
43
44/* extern struct module_data bsd_##name##_##busname##_driver_mod */
45#ifdef LOSCFG_DRIVERS_USB_HOST_EHCI
46/* host or device controller modules */
47/* usb controller modules  link xxx-controller bus */
48extern struct driver_module_data usbus_ehci_driver_mod;
49#endif
50
51#ifdef LOSCFG_DRIVERS_USB_HOST_XHCI
52extern struct driver_module_data usbus_xhci_driver_mod;
53#endif
54
55#ifdef LOSCFG_DRIVERS_USB_HOST_DRIVER
56/* root hub driver modules  link to usb bus */
57extern struct driver_module_data uhub_usbus_driver_mod;
58/* xxx class driver moudles  link to usb hub bus */
59extern struct driver_module_data uhub_uhub_driver_mod;
60#endif
61
62#ifdef LOSCFG_DRIVERS_USB_4G_MODEM
63extern struct driver_module_data cdce_uhub_driver_mod;
64#endif
65
66#if defined (LOSCFG_DRIVERS_USB_SERIAL) || defined (LOSCFG_DRIVERS_USB_4G_MODEM)
67extern struct driver_module_data u3g_uhub_driver_mod;
68#endif
69
70#ifdef LOSCFG_DRIVERS_USB_ETHERNET
71extern struct driver_module_data axe_uhub_driver_mod;
72extern struct driver_module_data axge_uhub_driver_mod;
73#endif
74
75#ifdef LOSCFG_DRIVERS_USB_RNDIS_HOST
76extern struct driver_module_data urndis_uhub_driver_mod;
77#endif
78
79#ifdef LOSCFG_DRIVERS_USB_MASS_STORAGE
80extern struct driver_module_data umass_uhub_driver_mod;
81#endif
82
83#ifdef LOSCFG_DRIVERS_USB_WIRELESS
84extern struct driver_module_data usb_linux_uhub_driver_mod;
85#endif
86
87#if defined (LOSCFG_DRIVERS_USB_HID_CLASS) && defined (LOSCFG_DRIVERS_HDF_INPUT)
88extern struct driver_module_data uhid_uhub_driver_mod;
89#endif
90
91extern struct driver_module_data composite_hiudc3_driver_mod;
92
93extern struct driver_module_data fcdcacm_simple_driver_mod;
94extern struct driver_module_data fconfig_simple_driver_mod;
95
96extern int hiudc3_init(void);
97extern int usbd_load_driver(void);
98extern int usbd_start_udc(void);
99extern int usbd_enable_interrupt(void);
100
101#ifdef LOSCFG_DRIVERS_USB_HOST_XHCI
102int hixhci_init(void);
103#endif
104
105#ifdef LOSCFG_DRIVERS_USB_HOST_EHCI
106int hiehci_init(void);
107#endif
108
109#ifdef LOSCFG_USB_DEBUG
110void usb_debug_module_regsiter(void);
111void usb_debug_module_unregsiter(void);
112#endif
113
114const char* fetach_usbversion(void);
115
116volatile unsigned int userial_mask_get(void);
117void userial_mask_set(unsigned int val);
118
119#ifdef __cplusplus
120#if __cplusplus
121}
122#endif
123#endif /* __cplusplus */
124
125#endif /* _USB_API_H */
126
127