• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("./../../../hdf_core/adapter/uhdf2/uhdf.gni")
16import("./../usb.gni")
17
18config("usbd_private_config") {
19  include_dirs = []
20}
21
22config("usbd_public_config") {
23  include_dirs = [
24    "${usb_driver_path}/hdi_service/include",
25    "${usb_driver_path}/ddk/host/include",
26    "${usb_driver_path}/interfaces/ddk/host",
27    "${usb_driver_path}/interfaces/ddk/common",
28    "${usb_driver_path}/gadget/function/include",
29    "${usb_driver_path}/gadget/function/mtp/include",
30    "./../../../hdf_core/framework/model/usb/include",
31    "${usb_driver_path}/hdi_service",
32    "${usb_driver_path}/interfaces/ddk/common/include",
33    "${usb_driver_path}/interfaces/ddk/device",
34  ]
35}
36
37ohos_shared_library("libusb_interface_service_1.0") {
38  sources = [
39    "src/usb_impl.cpp",
40    "src/usbd_dispatcher.cpp",
41    "src/usbd_function.cpp",
42    "src/usbd_load_usb_service.cpp",
43    "src/usbd_port.cpp",
44  ]
45
46  configs = [ ":usbd_private_config" ]
47
48  public_configs = [ ":usbd_public_config" ]
49
50  deps = [
51    "${usb_driver_path}/ddk:libusb_ddk_host",
52    "${usb_driver_path}/ddk:libusb_pnp_manager",
53    "./../gadget/function/mtp:libusbfn_mtp_interface_service_1.0",
54  ]
55
56  if (is_standard_system) {
57    external_deps = [
58      "c_utils:utils",
59      "drivers_interface_usb:libusbfn_mtp_stub_1.0",
60      "drivers_interface_usb:usb_idl_headers",
61      "drivers_interface_usb:usbfn_mtp_idl_headers",
62      "hdf_core:libhdf_host",
63      "hdf_core:libhdf_ipc_adapter",
64      "hdf_core:libhdf_utils",
65      "hdf_core:libhdi",
66      "hilog:libhilog",
67      "hisysevent:libhisysevent",
68      "hitrace:hitrace_meter",
69      "init:libbegetutil",
70      "ipc:ipc_single",
71      "samgr:samgr_proxy",
72    ]
73  } else {
74    external_deps = [
75      "drivers_interface_usb:libusbfn_mtp_stub_1.0",
76      "hilog:libhilog",
77      "ipc:ipc_single",
78    ]
79  }
80
81  install_images = [ chipset_base_dir ]
82  subsystem_name = "hdf"
83  part_name = "drivers_peripheral_usb"
84}
85
86ohos_shared_library("libusb_driver") {
87  sources = [ "src/usb_interface_driver.cpp" ]
88
89  public_deps = [ ":libusb_interface_service_1.0" ]
90
91  shlib_type = "hdi"
92
93  configs = [ ":usbd_private_config" ]
94
95  public_configs = [ ":usbd_public_config" ]
96
97  if (is_standard_system) {
98    external_deps = [
99      "c_utils:utils",
100      "drivers_interface_usb:libusb_stub_1.0",
101      "hdf_core:libhdf_host",
102      "hdf_core:libhdf_ipc_adapter",
103      "hdf_core:libhdf_utils",
104      "hdf_core:libhdi",
105      "hilog:libhilog",
106      "ipc:ipc_single",
107    ]
108  } else {
109    external_deps = [
110      "drivers_interface_usb:libusb_stub_1.0",
111      "hilog:libhilog",
112      "ipc:ipc_single",
113    ]
114  }
115
116  install_images = [ chipset_base_dir ]
117  subsystem_name = "hdf"
118  part_name = "drivers_peripheral_usb"
119}
120
121group("hdi_usb_service") {
122  deps = [
123    ":libusb_driver",
124    ":libusb_interface_service_1.0",
125  ]
126}
127