xref: /kernel/liteos_a/bsd/dev/usb/BUILD.gn (revision 0d163575)
10d163575Sopenharmony_ci# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
20d163575Sopenharmony_ci# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
30d163575Sopenharmony_ci#
40d163575Sopenharmony_ci# Redistribution and use in source and binary forms, with or without modification,
50d163575Sopenharmony_ci# are permitted provided that the following conditions are met:
60d163575Sopenharmony_ci#
70d163575Sopenharmony_ci# 1. Redistributions of source code must retain the above copyright notice, this list of
80d163575Sopenharmony_ci#    conditions and the following disclaimer.
90d163575Sopenharmony_ci#
100d163575Sopenharmony_ci# 2. Redistributions in binary form must reproduce the above copyright notice, this list
110d163575Sopenharmony_ci#    of conditions and the following disclaimer in the documentation and/or other materials
120d163575Sopenharmony_ci#    provided with the distribution.
130d163575Sopenharmony_ci#
140d163575Sopenharmony_ci# 3. Neither the name of the copyright holder nor the names of its contributors may be used
150d163575Sopenharmony_ci#    to endorse or promote products derived from this software without specific prior written
160d163575Sopenharmony_ci#    permission.
170d163575Sopenharmony_ci#
180d163575Sopenharmony_ci# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
190d163575Sopenharmony_ci# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
200d163575Sopenharmony_ci# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
210d163575Sopenharmony_ci# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
220d163575Sopenharmony_ci# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
230d163575Sopenharmony_ci# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
240d163575Sopenharmony_ci# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
250d163575Sopenharmony_ci# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
260d163575Sopenharmony_ci# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
270d163575Sopenharmony_ci# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
280d163575Sopenharmony_ci# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
290d163575Sopenharmony_ci
300d163575Sopenharmony_ciimport("//kernel/liteos_a/liteos.gni")
310d163575Sopenharmony_ci
320d163575Sopenharmony_cimodule_switch = defined(LOSCFG_DRIVERS_USB)
330d163575Sopenharmony_cimodule_name = "usb_base"
340d163575Sopenharmony_cikernel_module(module_name) {
350d163575Sopenharmony_ci  sources = [
360d163575Sopenharmony_ci    "implementation/bsd_busspace.c",
370d163575Sopenharmony_ci    "implementation/bsd_kernel.c",
380d163575Sopenharmony_ci    "implementation/usb_btree.c",
390d163575Sopenharmony_ci    "implementation/usb_busdma_loader.c",
400d163575Sopenharmony_ci    "implementation/usb_init.c",
410d163575Sopenharmony_ci    "implementation/usb_version.c",
420d163575Sopenharmony_ci    "usb_debug.c",
430d163575Sopenharmony_ci  ]
440d163575Sopenharmony_ci
450d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB)) {
460d163575Sopenharmony_ci    sources += [
470d163575Sopenharmony_ci      "controller/usb_controller.c",
480d163575Sopenharmony_ci      "quirk/usb_quirk.c",
490d163575Sopenharmony_ci      "usb_dev.c",
500d163575Sopenharmony_ci      "usb_device.c",
510d163575Sopenharmony_ci      "usb_dynamic.c",
520d163575Sopenharmony_ci      "usb_error.c",
530d163575Sopenharmony_ci      "usb_generic.c",
540d163575Sopenharmony_ci      "usb_handle_request.c",
550d163575Sopenharmony_ci      "usb_hub.c",
560d163575Sopenharmony_ci      "usb_if.c",
570d163575Sopenharmony_ci      "usb_lookup.c",
580d163575Sopenharmony_ci      "usb_mbuf.c",
590d163575Sopenharmony_ci      "usb_parse.c",
600d163575Sopenharmony_ci      "usb_process.c",
610d163575Sopenharmony_ci      "usb_request.c",
620d163575Sopenharmony_ci      "usb_transfer.c",
630d163575Sopenharmony_ci      "usb_util.c",
640d163575Sopenharmony_ci    ]
650d163575Sopenharmony_ci  }
660d163575Sopenharmony_ci
670d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_4G_MODEM)) {
680d163575Sopenharmony_ci    sources += [ "net/if_cdce.c" ]
690d163575Sopenharmony_ci  }
700d163575Sopenharmony_ci
710d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_ETHERNET)) {
720d163575Sopenharmony_ci    sources += [
730d163575Sopenharmony_ci      "net/if_axe.c",
740d163575Sopenharmony_ci      "net/if_axge.c",
750d163575Sopenharmony_ci    ]
760d163575Sopenharmony_ci  }
770d163575Sopenharmony_ci
780d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) {
790d163575Sopenharmony_ci    sources += [ "net/if_urndis.c" ]
800d163575Sopenharmony_ci  }
810d163575Sopenharmony_ci
820d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) ||
830d163575Sopenharmony_ci      defined(LOSCFG_DRIVERS_USB_ETHERNET) ||
840d163575Sopenharmony_ci      defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) {
850d163575Sopenharmony_ci    sources += [
860d163575Sopenharmony_ci      "net/usb_eth_drv.c",
870d163575Sopenharmony_ci      "net/usb_ethernet.c",
880d163575Sopenharmony_ci    ]
890d163575Sopenharmony_ci  }
900d163575Sopenharmony_ci
910d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) ||
920d163575Sopenharmony_ci      defined(LOSCFG_DRIVERS_USB_SERIAL)) {
930d163575Sopenharmony_ci    sources += [
940d163575Sopenharmony_ci      "serial/u3g.c",
950d163575Sopenharmony_ci      "serial/usb_serial.c",
960d163575Sopenharmony_ci    ]
970d163575Sopenharmony_ci  }
980d163575Sopenharmony_ci
990d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_HOST_EHCI)) {
1000d163575Sopenharmony_ci    sources += [
1010d163575Sopenharmony_ci      "controller/ehci.c",
1020d163575Sopenharmony_ci      "controller/ehci_pci.c",
1030d163575Sopenharmony_ci    ]
1040d163575Sopenharmony_ci  }
1050d163575Sopenharmony_ci
1060d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_HOST_XHCI) ||
1070d163575Sopenharmony_ci      defined(LOSCFG_DRIVERS_USB_HOST_XHCI_FOR_PORT2)) {
1080d163575Sopenharmony_ci    sources += [
1090d163575Sopenharmony_ci      "controller/xhci.c",
1100d163575Sopenharmony_ci      "controller/xhci_pci.c",
1110d163575Sopenharmony_ci    ]
1120d163575Sopenharmony_ci  }
1130d163575Sopenharmony_ci
1140d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_WIRELESS)) {
1150d163575Sopenharmony_ci    sources += [ "linux_usb.c" ]
1160d163575Sopenharmony_ci  }
1170d163575Sopenharmony_ci
1180d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_MASS_STORAGE)) {
1190d163575Sopenharmony_ci    sources += [ "storage/umass.c" ]
1200d163575Sopenharmony_ci  }
1210d163575Sopenharmony_ci
1220d163575Sopenharmony_ci  if (defined(LOSCFG_DRIVERS_USB_HID_CLASS) &&
1230d163575Sopenharmony_ci      defined(LOSCFG_DRIVERS_HDF_INPUT)) {
1240d163575Sopenharmony_ci    sources += [
1250d163575Sopenharmony_ci      "input/uhid.c",
1260d163575Sopenharmony_ci      "usb_hid.c",
1270d163575Sopenharmony_ci    ]
1280d163575Sopenharmony_ci
1290d163575Sopenharmony_ci    include_dirs = [
1300d163575Sopenharmony_ci      "//drivers/framework/model/input/driver",
1310d163575Sopenharmony_ci      "//drivers/framework/include/core",
1320d163575Sopenharmony_ci      "//drivers/framework/core/common/include/host",
1330d163575Sopenharmony_ci      "//drivers/framework/utils",
1340d163575Sopenharmony_ci      "//drivers/framework/osal",
1350d163575Sopenharmony_ci      "//drivers/framework/ability/sbuf/include",
1360d163575Sopenharmony_ci      "//drivers/framework/include/osal",
1370d163575Sopenharmony_ci    ]
1380d163575Sopenharmony_ci  }
1390d163575Sopenharmony_ci
1400d163575Sopenharmony_ci  configs += [ "$HDFTOPDIR:hdf_config" ]
1410d163575Sopenharmony_ci
1420d163575Sopenharmony_ci  public_configs = [ ":public" ]
1430d163575Sopenharmony_ci}
1440d163575Sopenharmony_ci
1450d163575Sopenharmony_ciconfig("public") {
1460d163575Sopenharmony_ci  defines = [ "USB_DEBUG_VAR=5" ]
1470d163575Sopenharmony_ci  include_dirs = [ "." ]
1480d163575Sopenharmony_ci  include_dirs += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/dev/evdev" ]
1490d163575Sopenharmony_ci}
150