| # 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_xhci_bind") { |
| rules = "usb_xhci.bind" |
| bind_output = "xhci.bindbc" |
| tests = "tests.json" |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.pci:fuchsia.hardware.pci_bindlib", |
| "//sdk/fidl/fuchsia.hardware.platform.device:fuchsia.hardware.platform.device_bindlib", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_bindlib", |
| "//sdk/fidl/fuchsia.hardware.usb.phy:fuchsia.hardware.usb.phy_bindlib", |
| "//src/devices/bind/fuchsia.acpi", |
| "//src/devices/bind/fuchsia.devicetree", |
| "//src/devices/bind/fuchsia.pci", |
| "//src/devices/bind/fuchsia.pci:serial", |
| "//src/devices/bind/fuchsia.pci:serial.usb", |
| "//src/devices/bind/fuchsia.platform", |
| "//src/devices/bind/fuchsia.usb.phy", |
| ] |
| } |
| |
| fuchsia_driver("xhci-driver") { |
| output_name = "xhci" |
| |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| sources = [ |
| "usb-xhci.cc", |
| "xhci-device-state.cc", |
| "xhci-endpoint.cc", |
| "xhci-enumeration.cc", |
| "xhci-event-ring.cc", |
| "xhci-interrupter.cc", |
| "xhci-transfer-ring.cc", |
| ] |
| 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.hub:fuchsia.hardware.usb.hub_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.phy:fuchsia.hardware.usb.phy_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.usb.hci:fuchsia.hardware.usb.hci_cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/fit-promise", |
| "//src/devices/bus/lib/device-protocol-pdev", |
| "//src/devices/lib/dma-buffer", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/driver:driver_runtime", |
| "//src/devices/lib/mmio", |
| "//src/devices/lib/synchronous-executor", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/usb/lib/usb", |
| "//src/devices/usb/lib/usb-endpoint:usb-endpoint-server", |
| "//src/devices/usb/lib/usb-phy", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/async", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/hwreg", |
| "//zircon/system/ulib/inspect", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/xdc-server-utils", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| fuchsia_driver_component("xhci") { |
| info = "xhci-info.json" |
| component_name = "xhci" |
| manifest = "meta/xhci.cml" |
| deps = [ |
| ":usb_xhci_bind", |
| ":xhci-driver", |
| ] |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "xhci" |
| driver_components = [ ":xhci" ] |
| } |
| |
| source_set("test-libs") { |
| testonly = true |
| public_deps = [ |
| ":usb_xhci_bind", |
| "//sdk/banjo/fuchsia.hardware.serialimpl.async:fuchsia.hardware.serialimpl.async_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.hci:fuchsia.hardware.usb.hci_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.usb.phy:fuchsia.hardware.usb.phy_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.usb.hci:fuchsia.hardware.usb.hci_cpp", |
| "//sdk/lib/async_patterns/testing/cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/fit-promise", |
| "//src/devices/bus/lib/device-protocol-pdev", |
| "//src/devices/bus/testing/fake-pdev", |
| "//src/devices/lib/dma-buffer", |
| "//src/devices/lib/mmio", |
| "//src/devices/lib/mmio:test_helper", |
| "//src/devices/lib/synchronous-executor", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/testing/fake-dma-buffer", |
| "//src/devices/testing/fake-mmio-reg", |
| "//src/devices/testing/mock-ddk", |
| "//src/devices/usb/lib/usb", |
| "//src/devices/usb/lib/usb-endpoint:usb-endpoint-server", |
| "//src/devices/usb/lib/usb-phy", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/hwreg", |
| "//zircon/system/ulib/inspect", |
| "//zircon/system/ulib/mock-function", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| test("xhci-unittest-bin") { |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-unittest" |
| sources = [ |
| "xhci-enumeration-test.cc", |
| "xhci-enumeration.cc", |
| ] |
| deps = [ |
| ":test-libs", |
| "//zircon/system/ulib/mmio-ptr:mmio-ptr-fake", |
| ] |
| } |
| |
| test("xhci-core-unittest-bin") { |
| if (is_fuchsia) { |
| configs += [ "//build/config:all_source" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-core-unittest" |
| sources = [ |
| "usb-xhci-test.cc", |
| "usb-xhci.cc", |
| "xhci-device-state.cc", |
| "xhci-endpoint.cc", |
| ] |
| deps = [ |
| ":test-libs", |
| "//src/devices/lib/driver:driver_runtime", |
| ] |
| } |
| |
| test("xhci-event-ring-unittest-bin") { |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-event-ring-unittest" |
| sources = [ |
| "xhci-event-ring-test.cc", |
| "xhci-event-ring.cc", |
| "xhci-interrupter.cc", |
| ] |
| deps = [ |
| ":test-libs", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| ] |
| } |
| |
| test("xhci-transfer-ring-unittest-bin") { |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-transfer-ring-unittest" |
| sources = [ |
| "xhci-transfer-ring-test.cc", |
| "xhci-transfer-ring.cc", |
| ] |
| deps = [ ":test-libs" ] |
| } |
| |
| test("xhci-endpoint-unittest-bin") { |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| output_name = "xhci-endpoint-unittest" |
| sources = [ |
| "xhci-endpoint-test.cc", |
| "xhci-endpoint.cc", |
| ] |
| deps = [ |
| ":test-libs", |
| "//src/devices/testing/fake-bti", |
| ] |
| } |
| |
| fuchsia_unittest_package("xhci-unittest") { |
| deps = [ ":xhci-unittest-bin" ] |
| test_specs = { |
| environments = basic_envs |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| fuchsia_unittest_package("xhci-core-unittest") { |
| deps = [ ":xhci-core-unittest-bin" ] |
| test_specs = { |
| environments = basic_envs |
| } |
| } |
| |
| fuchsia_unittest_package("xhci-event-ring-unittest") { |
| deps = [ ":xhci-event-ring-unittest-bin" ] |
| test_specs = { |
| environments = basic_envs |
| } |
| } |
| |
| fuchsia_unittest_package("xhci-transfer-ring-unittest") { |
| deps = [ ":xhci-transfer-ring-unittest-bin" ] |
| test_specs = { |
| environments = basic_envs |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| fuchsia_unittest_package("xhci-endpoint-unittest") { |
| deps = [ ":xhci-endpoint-unittest-bin" ] |
| test_specs = { |
| environments = basic_envs |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":usb_xhci_bind_test", |
| ":xhci-core-unittest", |
| ":xhci-endpoint-unittest", |
| ":xhci-event-ring-unittest", |
| ":xhci-transfer-ring-unittest", |
| ":xhci-unittest", |
| ] |
| } |