blob: dc2303656b21c472bfb5b8ccd5f5871bb4185a59 [file] [log] [blame]
# Copyright 2021 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("fusb302-bind") {
rules = "fusb302.bind"
tests = "bind-tests.json"
deps = [
"//sdk/fidl/fuchsia.hardware.gpio:fuchsia.hardware.gpio_bindlib",
"//sdk/fidl/fuchsia.hardware.i2c:fuchsia.hardware.i2c_bindlib",
"//src/devices/bind/fuchsia.gpio",
]
}
group("common") {
public_deps = [
":fusb302-bind",
"//sdk/fidl/fuchsia.hardware.gpio:fuchsia.hardware.gpio_cpp",
"//sdk/fidl/fuchsia.hardware.i2c:fuchsia.hardware.i2c_cpp",
"//sdk/fidl/fuchsia.hardware.powersource:fuchsia.hardware.powersource_cpp",
"//sdk/lib/driver/component/cpp:cpp",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/hwreg-i2c",
"//zircon/system/ulib/inspect",
]
}
fuchsia_driver("fusb302-driver") {
output_name = "fusb302"
sources = [
"fusb302-controls.cc",
"fusb302-fifos.cc",
"fusb302-identity.cc",
"fusb302-protocol.cc",
"fusb302-sensors.cc",
"fusb302-signals.cc",
"fusb302.cc",
"pd-sink-state-machine.cc",
"registers.cc",
"typec-port-state-machine.cc",
"usb-pd-defs.cc",
"usb-pd-message-type.cc",
"usb-pd-sink-policy.cc",
]
configs += [ "//build/config:all_source" ]
deps = [
":common",
"//src/devices/lib/driver:driver_runtime",
]
# TODO: delete the below and fix compiler errors.
configs += [ "//build/config:Wno-unused-but-set-variable" ]
# TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
}
fuchsia_driver_component("fusb302") {
info = "fusb302-info.json"
component_name = "fusb302"
deps = [ ":fusb302-driver" ]
manifest = "meta/fusb302.cml"
}
fuchsia_driver_package("package") {
package_name = "fusb302"
driver_components = [ ":fusb302" ]
}
test("fusb302-test-bin") {
sources = [
"fusb302-controls-test.cc",
"fusb302-controls.cc",
"fusb302-fifos-test.cc",
"fusb302-fifos.cc",
"fusb302-identity-test.cc",
"fusb302-identity.cc",
"fusb302-protocol-test.cc",
"fusb302-protocol.cc",
"fusb302-sensors-test.cc",
"fusb302-sensors.cc",
"fusb302-signals-test.cc",
"fusb302-signals.cc",
"fusb302-test.cc",
"fusb302.cc",
"pd-sink-state-machine.cc",
"registers-test.cc",
"registers.cc",
"state-machine-base-test.cc",
"typec-port-state-machine.cc",
"usb-pd-defs.cc",
"usb-pd-message-objects-test.cc",
"usb-pd-message-test.cc",
"usb-pd-message-type-test.cc",
"usb-pd-message-type.cc",
"usb-pd-sink-policy-test.cc",
"usb-pd-sink-policy.cc",
]
output_name = "fusb302-test"
configs += [ "//build/config:all_source" ]
deps = [
":common",
"//sdk/lib/inspect/testing/cpp:zxtest",
"//src/devices/i2c/testing/mock-i2c",
"//src/devices/testing/mock-ddk",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/mock-function",
"//zircon/system/ulib/zxtest",
]
# TODO: delete the below and fix compiler errors.
configs += [ "//build/config:Wno-unused-but-set-variable" ]
# TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
}
fuchsia_unittest_package("fusb302-test") {
deps = [ ":fusb302-test-bin" ]
test_specs = {
environments = basic_envs
}
}
group("tests") {
testonly = true
deps = [
":fusb302-bind_test",
":fusb302-test",
]
}