1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 2# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without modification, 5# are permitted provided that the following conditions are met: 6# 7# 1. Redistributions of source code must retain the above copyright notice, this list of 8# conditions and the following disclaimer. 9# 10# 2. Redistributions in binary form must reproduce the above copyright notice, this list 11# of conditions and the following disclaimer in the documentation and/or other materials 12# provided with the distribution. 13# 14# 3. Neither the name of the copyright holder nor the names of its contributors may be used 15# to endorse or promote products derived from this software without specific prior written 16# permission. 17# 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30import("//kernel/liteos_a/liteos.gni") 31 32module_switch = defined(LOSCFG_DRIVERS_USB) 33module_name = "usb_base" 34kernel_module(module_name) { 35 sources = [ 36 "implementation/bsd_busspace.c", 37 "implementation/bsd_kernel.c", 38 "implementation/usb_btree.c", 39 "implementation/usb_busdma_loader.c", 40 "implementation/usb_init.c", 41 "implementation/usb_version.c", 42 "usb_debug.c", 43 ] 44 45 if (defined(LOSCFG_DRIVERS_USB)) { 46 sources += [ 47 "controller/usb_controller.c", 48 "quirk/usb_quirk.c", 49 "usb_dev.c", 50 "usb_device.c", 51 "usb_dynamic.c", 52 "usb_error.c", 53 "usb_generic.c", 54 "usb_handle_request.c", 55 "usb_hub.c", 56 "usb_if.c", 57 "usb_lookup.c", 58 "usb_mbuf.c", 59 "usb_parse.c", 60 "usb_process.c", 61 "usb_request.c", 62 "usb_transfer.c", 63 "usb_util.c", 64 ] 65 } 66 67 if (defined(LOSCFG_DRIVERS_USB_4G_MODEM)) { 68 sources += [ "net/if_cdce.c" ] 69 } 70 71 if (defined(LOSCFG_DRIVERS_USB_ETHERNET)) { 72 sources += [ 73 "net/if_axe.c", 74 "net/if_axge.c", 75 ] 76 } 77 78 if (defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) { 79 sources += [ "net/if_urndis.c" ] 80 } 81 82 if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) || 83 defined(LOSCFG_DRIVERS_USB_ETHERNET) || 84 defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) { 85 sources += [ 86 "net/usb_eth_drv.c", 87 "net/usb_ethernet.c", 88 ] 89 } 90 91 if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) || 92 defined(LOSCFG_DRIVERS_USB_SERIAL)) { 93 sources += [ 94 "serial/u3g.c", 95 "serial/usb_serial.c", 96 ] 97 } 98 99 if (defined(LOSCFG_DRIVERS_USB_HOST_EHCI)) { 100 sources += [ 101 "controller/ehci.c", 102 "controller/ehci_pci.c", 103 ] 104 } 105 106 if (defined(LOSCFG_DRIVERS_USB_HOST_XHCI) || 107 defined(LOSCFG_DRIVERS_USB_HOST_XHCI_FOR_PORT2)) { 108 sources += [ 109 "controller/xhci.c", 110 "controller/xhci_pci.c", 111 ] 112 } 113 114 if (defined(LOSCFG_DRIVERS_USB_WIRELESS)) { 115 sources += [ "linux_usb.c" ] 116 } 117 118 if (defined(LOSCFG_DRIVERS_USB_MASS_STORAGE)) { 119 sources += [ "storage/umass.c" ] 120 } 121 122 if (defined(LOSCFG_DRIVERS_USB_HID_CLASS) && 123 defined(LOSCFG_DRIVERS_HDF_INPUT)) { 124 sources += [ 125 "input/uhid.c", 126 "usb_hid.c", 127 ] 128 129 include_dirs = [ 130 "//drivers/framework/model/input/driver", 131 "//drivers/framework/include/core", 132 "//drivers/framework/core/common/include/host", 133 "//drivers/framework/utils", 134 "//drivers/framework/osal", 135 "//drivers/framework/ability/sbuf/include", 136 "//drivers/framework/include/osal", 137 ] 138 } 139 140 configs += [ "$HDFTOPDIR:hdf_config" ] 141 142 public_configs = [ ":public" ] 143} 144 145config("public") { 146 defines = [ "USB_DEBUG_VAR=5" ] 147 include_dirs = [ "." ] 148 include_dirs += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/dev/evdev" ] 149} 150