| # Copyright 2020 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("bind") { |
| rules = "usb-hub.bind" |
| bind_output = "usb-hub.bindbc" |
| deps = [ "//src/devices/bind/fuchsia.usb" ] |
| } |
| |
| source_set("usb-hub-common") { |
| sources = [ "usb-hub.cc" ] |
| public_configs = [ "//build/config:all_source" ] |
| 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.hub:fuchsia.hardware.usb.hub_banjo_cpp", |
| "//src/devices/lib/synchronous-executor", |
| "//src/devices/usb/lib/usb", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/inspect", |
| ] |
| deps = [ |
| ":bind", |
| "//sdk/banjo/fuchsia.hardware.usb.composite:fuchsia.hardware.usb.composite_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.hubdescriptor:fuchsia.hardware.usb.hubdescriptor_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp", |
| "//sdk/lib/fit-promise", |
| "//src/devices/lib/driver", |
| "//zircon/system/ulib/async", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| fuchsia_driver("usb-hub-driver") { |
| output_name = "usb-hub" |
| configs += [ "//build/config/fuchsia:enable_zircon_asserts" ] |
| deps = [ |
| ":usb-hub-common", |
| "//src/lib/ddk", |
| ] |
| } |
| |
| fuchsia_driver_component("usb-hub") { |
| visibility = [ ":*" ] |
| info = "usb-hub-info.json" |
| component_name = "usb-hub" |
| deps = [ ":usb-hub-driver" ] |
| manifest = "meta/usb-hub.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "usb-hub" |
| driver_components = [ ":usb-hub" ] |
| } |
| |
| test("usb-hub-test") { |
| sources = [ "usb-hub-test.cc" ] |
| defines = [ "UNITTEST" ] |
| deps = [ |
| ":usb-hub-common", |
| "//src/devices/testing/fake-bti", |
| "//src/devices/testing/mock-ddk", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("usb-hub-package") { |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| deps = [ ":usb-hub-test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":usb-hub-package" ] |
| } |