blob: 55c05c38486580105d18ebd3b4539cd48acb6be7 [file] [log] [blame]
# 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_peripheral_bind") {
rules = "usb_peripheral.bind"
bind_output = "usb-peripheral.bindbc"
tests = "tests.json"
deps = [ "//src/devices/bind/fuchsia.usb" ]
}
fuchsia_driver("usb-peripheral-driver") {
output_name = "usb-peripheral"
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
sources = [
"usb-function.cc",
"usb-peripheral.cc",
]
deps = [
":usb_peripheral_bind",
"//sdk/banjo/fuchsia.hardware.usb:fuchsia.hardware.usb_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.dci:fuchsia.hardware.usb.dci_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.function:fuchsia.hardware.usb.function_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp",
"//sdk/fidl/fuchsia.hardware.usb.dci:fuchsia.hardware.usb.dci_cpp",
"//sdk/fidl/fuchsia.hardware.usb.function:fuchsia.hardware.usb.function_cpp",
"//sdk/fidl/fuchsia.hardware.usb.peripheral:fuchsia.hardware.usb.peripheral_cpp",
"//sdk/lib/component/outgoing/cpp",
"//sdk/lib/fidl",
"//src/devices/lib/driver",
"//src/devices/lib/driver:driver_runtime",
"//src/devices/usb/lib/usb",
"//src/devices/usb/lib/usb:cdc",
"//src/devices/usb/lib/usb:peripheral",
"//src/devices/usb/lib/usb-monitor-util",
"//src/lib/ddk",
"//src/lib/ddk:ddk-metadata-headers",
"//src/lib/ddktl",
"//zircon/system/ulib/fbl",
]
# Set default configuration here, rather than relying on usbctl to do it.
defines = [
"USB_DEVICE_VID=0x18D1",
"USB_DEVICE_PID=0xA020",
"USB_DEVICE_MANUFACTURER=\"Zircon\"",
"USB_DEVICE_PRODUCT=\"CDC-Ethernet\"",
"USB_DEVICE_SERIAL=\"0123456789ABCDEF\"",
"USB_DEVICE_FUNCTIONS=\"cdc\"",
]
}
fuchsia_driver_component("usb-peripheral") {
info = "usb-peripheral-info.json"
component_name = "usb-peripheral"
deps = [ ":usb-peripheral-driver" ]
manifest = "meta/usb-peripheral.cml"
}
fuchsia_driver_package("package") {
package_name = "usb-peripheral"
driver_components = [ ":usb-peripheral" ]
}
test("usb-peripheral-unittest-bin") {
sources = [
"usb-function.cc",
"usb-peripheral-test.cc",
"usb-peripheral.cc",
]
output_name = "usb-peripheral-unittest"
deps = [
":usb_peripheral_bind",
"//sdk/banjo/fuchsia.hardware.usb:fuchsia.hardware.usb_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.dci:fuchsia.hardware.usb.dci_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.function:fuchsia.hardware.usb.function_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.dci:fuchsia.hardware.usb.dci_cpp",
"//sdk/fidl/fuchsia.hardware.usb.function:fuchsia.hardware.usb.function_cpp",
"//sdk/fidl/fuchsia.hardware.usb.peripheral:fuchsia.hardware.usb.peripheral_cpp",
"//sdk/lib/component/outgoing/cpp",
"//src/devices/bus/lib/device-protocol-pdev",
"//src/devices/lib/amlogic",
"//src/devices/lib/driver",
"//src/devices/lib/mmio",
"//src/devices/testing/mock-ddk",
"//src/devices/usb/lib/usb",
"//src/devices/usb/lib/usb:cdc",
"//src/devices/usb/lib/usb:peripheral",
"//src/devices/usb/lib/usb-monitor-util",
"//src/lib/ddk",
# TODO(https://fxbug.dev/42113849): Migrate to the new bind rules and delete the below
"//src/lib/ddk:ddk-deprecated-binding-headers",
"//src/lib/ddk:ddk-metadata-headers",
"//src/lib/ddktl",
"//src/lib/utf_conversion",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/hwreg",
"//zircon/system/ulib/pretty",
"//zircon/system/ulib/sync",
"//zircon/system/ulib/zxtest",
]
}
fuchsia_unittest_package("usb-peripheral-unittest") {
deps = [ ":usb-peripheral-unittest-bin" ]
test_specs = {
environments = basic_envs
log_settings = {
max_severity = "ERROR"
}
}
}
group("tests") {
testonly = true
deps = [
":usb-peripheral-unittest",
":usb_peripheral_bind_test",
]
}