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
30include $(LITEOSTOPDIR)/config.mk
31include $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos/lite.mk
32
33MODULE_NAME := usb_base
34
35CONTROLLER_HOST_SRC = controller
36CORE_SRC = .
37IMPLEMENTATION_SRC = implementation
38Net_SRC = net
39QUIRK_SRC = quirk
40SERIAL_SRC = serial
41STORAGE_SRC = storage
42INPUT_SRC = input
43LOCAL_SRCS := $(CORE_SRC)/usb_debug.c  \
44              $(IMPLEMENTATION_SRC)/bsd_busspace.c  \
45              $(IMPLEMENTATION_SRC)/usb_busdma_loader.c  \
46              $(IMPLEMENTATION_SRC)/bsd_kernel.c \
47              $(IMPLEMENTATION_SRC)/usb_init.c  \
48              $(IMPLEMENTATION_SRC)/usb_version.c \
49              $(IMPLEMENTATION_SRC)/usb_btree.c
50
51ifeq ($(LOSCFG_DRIVERS_USB), y)
52LOCAL_SRCS += $(CORE_SRC)/usb_dynamic.c  \
53              $(CORE_SRC)/usb_parse.c  \
54              $(CORE_SRC)/usb_error.c  \
55              $(CORE_SRC)/usb_handle_request.c  \
56              $(CORE_SRC)/usb_util.c  \
57              $(CORE_SRC)/usb_lookup.c  \
58              $(CONTROLLER_HOST_SRC)/usb_controller.c  \
59              $(QUIRK_SRC)/usb_quirk.c \
60              $(CORE_SRC)/usb_device.c  \
61              $(CORE_SRC)/usb_process.c  \
62              $(CORE_SRC)/usb_hub.c  \
63              $(CORE_SRC)/usb_request.c  \
64              $(CORE_SRC)/usb_transfer.c  \
65              $(CORE_SRC)/usb_dev.c  \
66              $(CORE_SRC)/usb_mbuf.c  \
67              $(CORE_SRC)/usb_generic.c \
68              $(CORE_SRC)/usb_if.c
69endif
70
71ifeq ($(LOSCFG_DRIVERS_USB_4G_MODEM), y)
72LOCAL_SRCS += $(Net_SRC)/if_cdce.c
73endif
74
75ifeq ($(LOSCFG_DRIVERS_USB_ETHERNET), y)
76LOCAL_SRCS += $(Net_SRC)/if_axe.c \
77              $(Net_SRC)/if_axge.c
78endif
79
80ifeq ($(LOSCFG_DRIVERS_USB_RNDIS_HOST), y)
81LOCAL_SRCS += $(Net_SRC)/if_urndis.c
82endif
83
84ifeq ($(LOSCFG_DRIVERS_USB_4G_MODEM), y)
85LOCAL_SRCS += $(Net_SRC)/usb_eth_drv.c \
86              $(Net_SRC)/usb_ethernet.c
87else ifeq ($(LOSCFG_DRIVERS_USB_ETHERNET), y)
88LOCAL_SRCS += $(Net_SRC)/usb_eth_drv.c \
89              $(Net_SRC)/usb_ethernet.c
90else ifeq ($(LOSCFG_DRIVERS_USB_RNDIS_HOST), y)
91LOCAL_SRCS += $(Net_SRC)/usb_eth_drv.c\
92              $(Net_SRC)/usb_ethernet.c
93endif
94
95ifeq ($(LOSCFG_DRIVERS_USB_4G_MODEM), y)
96LOCAL_SRCS += $(SERIAL_SRC)/usb_serial.c  \
97              $(SERIAL_SRC)/u3g.c
98else ifeq ($(LOSCFG_DRIVERS_USB_SERIAL), y)
99LOCAL_SRCS += $(SERIAL_SRC)/usb_serial.c  \
100              $(SERIAL_SRC)/u3g.c
101endif
102
103ifeq ($(LOSCFG_DRIVERS_USB_HOST_EHCI), y)
104LOCAL_SRCS += $(CONTROLLER_HOST_SRC)/ehci_pci.c  \
105              $(CONTROLLER_HOST_SRC)/ehci.c
106endif
107
108ifeq ($(LOSCFG_DRIVERS_USB_HOST_XHCI), y)
109LOCAL_SRCS += $(CONTROLLER_HOST_SRC)/xhci.c  \
110              $(CONTROLLER_HOST_SRC)/xhci_pci.c
111else ifeq ($(LOSCFG_DRIVERS_USB_HOST_XHCI_FOR_PORT2), y)
112LOCAL_SRCS += $(CONTROLLER_HOST_SRC)/xhci.c  \
113              $(CONTROLLER_HOST_SRC)/xhci_pci.c
114endif
115
116ifeq ($(LOSCFG_DRIVERS_USB_WIRELESS), y)
117LOCAL_SRCS += $(CORE_SRC)/linux_usb.c
118endif
119
120ifeq ($(LOSCFG_DRIVERS_USB_MASS_STORAGE), y)
121LOCAL_SRCS += $(STORAGE_SRC)/umass.c
122endif
123
124ifeq ($(LOSCFG_DRIVERS_USB_HID_CLASS)_$(LOSCFG_DRIVERS_HDF_INPUT), y_y)
125LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/model/input/driver \
126               -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/core \
127               -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/core/common/include/host \
128               -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/utils \
129               -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/osal \
130               -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/ability/sbuf/include \
131               -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/osal \
132               -I$(LITEOSTOPDIR)/../../third_party/FreeBSD/sys/dev/evdev
133
134LOCAL_SRCS += $(INPUT_SRC)/uhid.c  \
135              $(CORE_SRC)/usb_hid.c
136endif
137
138include $(HDF_DRIVER)
139