• 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
18group("libusb_core") {
19  deps = [
20    ":libusb_ddk_device",
21    ":libusb_ddk_host",
22    ":libusb_pnp_manager",
23  ]
24}
25
26ohos_shared_library("libusb_ddk_host") {
27  sanitize = {
28    integer_overflow = true
29    ubsan = true
30    boundary_sanitize = true
31  }
32
33  include_dirs = [
34    "device/include",
35    "$hdf_framework_path/model/usb/include",
36    "host/include",
37    "./../interfaces/ddk/common",
38    "./../interfaces/ddk/device",
39    "./../interfaces/ddk/host",
40  ]
41  sources = [
42    "host/src/linux_adapter.c",
43    "host/src/usb_interface_pool.c",
44    "host/src/usb_io_manage.c",
45    "host/src/usb_protocol.c",
46    "host/src/usb_raw_api.c",
47    "host/src/usb_raw_api_library.c",
48  ]
49
50  if (drivers_peripheral_usb_feature_linux_native_model) {
51    if (defined(defines)) {
52      defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ]
53    } else {
54      defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ]
55    }
56  }
57
58  if (is_standard_system) {
59    external_deps = [
60      "c_utils:utils",
61      "hdf_core:libhdf_host",
62      "hdf_core:libhdf_utils",
63      "hilog:libhilog",
64    ]
65  } else {
66    external_deps = [ "hilog:libhilog" ]
67  }
68
69  install_images = [ chipset_base_dir ]
70  subsystem_name = "hdf"
71  part_name = "drivers_peripheral_usb"
72}
73
74ohos_shared_library("libusb_pnp_manager") {
75  sanitize = {
76    integer_overflow = true
77    ubsan = true
78    boundary_sanitize = true
79  }
80
81  include_dirs = [
82    "$hdf_framework_path/model/usb/include",
83    "host/include",
84    "device/include",
85  ]
86  sources = [
87    "$hdf_framework_path/model/usb/src/usb_ddk_pnp_loader.c",
88    "$hdf_framework_path/model/usb/src/usb_wrapper.cpp",
89    "device/src/usbfn_uevent_handle.c",
90    "host/src/ddk_device_manager.c",
91    "host/src/ddk_pnp_listener_mgr.c",
92    "host/src/ddk_sysfs_device.c",
93    "host/src/ddk_uevent_handle.c",
94    "host/src/usb_pnp_manager.c",
95  ]
96
97  if (drivers_peripheral_usb_feature_linux_native_model) {
98    if (defined(defines)) {
99      defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ]
100    } else {
101      defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ]
102    }
103    sources += [ "host/src/ddk_uevent_queue.cpp" ]
104  }
105
106  if (is_standard_system) {
107    external_deps = [
108      "c_utils:utils",
109      "hdf_core:libhdf_host",
110      "hdf_core:libhdf_utils",
111      "hilog:libhilog",
112      "hisysevent:libhisysevent",
113    ]
114  } else {
115    external_deps = [ "hilog:libhilog" ]
116  }
117
118  install_images = [ chipset_base_dir ]
119  subsystem_name = "hdf"
120  part_name = "drivers_peripheral_usb"
121}
122
123ohos_shared_library("libusb_ddk_device") {
124  sanitize = {
125    integer_overflow = true
126    ubsan = true
127    boundary_sanitize = true
128  }
129
130  include_dirs = [
131    "device/include",
132    "host/include",
133    "./../interfaces/ddk/common",
134    "./../interfaces/ddk/device",
135    "./../interfaces/ddk/host",
136  ]
137
138  sources = [
139    "device/src/adapter_if.c",
140    "device/src/usbfn_cfg_mgr.c",
141    "device/src/usbfn_dev_mgr.c",
142    "device/src/usbfn_io_mgr.c",
143    "device/src/usbfn_sdk_if.c",
144  ]
145
146  if (is_standard_system) {
147    external_deps = [
148      "c_utils:utils",
149      "hdf_core:libhdf_utils",
150      "hilog:libhilog",
151    ]
152  } else {
153    external_deps = [ "hilog:libhilog" ]
154  }
155
156  if (drivers_peripheral_usb_feature_linux_native_model) {
157    if (defined(defines)) {
158      defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ]
159    } else {
160      defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ]
161    }
162  }
163
164  install_images = [ chipset_base_dir ]
165  subsystem_name = "hdf"
166  part_name = "drivers_peripheral_usb"
167}
168