| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/bind/bind.gni") |
| import("//build/components.gni") |
| import("//build/drivers.gni") |
| import("//build/test.gni") |
| |
| driver_bind_rules("usb_bus_bind") { |
| rules = "usb_bus.bind" |
| header_output = "usb_bus_bind.h" |
| bind_output = "usb-bus.bindbc" |
| tests = "tests.json" |
| deps = [ "//src/devices/bind/fuchsia.usb" ] |
| } |
| |
| fuchsia_driver("usb-bus-driver") { |
| output_name = "usb-bus" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| sources = [ "usb-bus.cc" ] |
| deps = [ |
| ":common", |
| ":usb_bus_bind", |
| "//src/devices/lib/driver", |
| "//zircon/system/ulib/fbl", |
| ] |
| } |
| |
| fuchsia_driver_component("usb-bus") { |
| info = "usb-bus-info.json" |
| component_name = "usb-bus" |
| deps = [ ":usb-bus-driver" ] |
| colocate = true |
| } |
| |
| source_set("common") { |
| configs += [ "//build/config:all_source" ] |
| sources = [ "usb-device.cc" ] |
| deps = [ |
| "//sdk/banjo/fuchsia.hardware.usb.composite:fuchsia.hardware.usb.composite_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.hub:fuchsia.hardware.usb.hub_banjo_cpp", |
| "//src/lib/ddk", |
| "//src/lib/utf_conversion", |
| "//zircon/system/ulib/fbl", |
| |
| # TODO(fxb/38132): Migrate to the new bind rules and delete the below |
| "//src/lib/ddk:ddk-deprecated-binding-headers", |
| ] |
| public_deps = [ |
| "//sdk/banjo/fuchsia.hardware.usb:fuchsia.hardware.usb_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.bus:fuchsia.hardware.usb.bus_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.hci:fuchsia.hardware.usb.hci_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.usb.device:fuchsia.hardware.usb.device_llcpp", |
| "//src/devices/usb/lib/usb", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/sync", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":usb-device-test-pkg", |
| ":usb_bus_bind_test", |
| ] |
| } |
| |
| test("usb-device") { |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ "tests/usb-device.cc" ] |
| deps = [ |
| ":common", |
| "//src/devices/testing/fake-bti", |
| "//src/devices/testing/fake_ddk", |
| "//src/lib/utf_conversion", |
| "//zircon/system/ulib/zxtest", |
| ] |
| |
| # TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated. |
| # Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>). |
| # See linked bug for details. |
| configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ] |
| } |
| |
| fuchsia_unittest_package("usb-device-test-pkg") { |
| package_name = "usb-device" |
| deps = [ ":usb-device" ] |
| } |