| # 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" |
| header_output = "fusb302-bind.h" |
| tests = "bind-tests.json" |
| deps = [ "//src/devices/bind/fuchsia.platform" ] |
| } |
| |
| group("common") { |
| public_deps = [ |
| ":fusb302-bind", |
| "//sdk/banjo/fuchsia.hardware.gpio:fuchsia.hardware.gpio_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.power:fuchsia.hardware.power_llcpp", |
| "//src/devices/i2c/lib/device-protocol-i2c-channel", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/hwreg-i2c", |
| "//zircon/system/ulib/inspect", |
| ] |
| } |
| |
| fuchsia_driver("fusb302-driver") { |
| output_name = "fusb302" |
| sources = [ |
| "fusb302.cc", |
| "state-machine.cc", |
| ] |
| configs += [ "//build/config:all_source" ] |
| deps = [ |
| ":common", |
| "//src/devices/lib/driver", |
| ] |
| |
| # TODO: delete the below and fix compiler errors. |
| configs += [ "//build/config:Wno-unused-but-set-variable" ] |
| |
| # TODO(https://fxbug.dev/58162): 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" ] |
| colocate = true |
| } |
| |
| test("fusb302-test-bin") { |
| sources = [ |
| "fusb302-test.cc", |
| "fusb302.cc", |
| "state-machine.cc", |
| ] |
| output_name = "fusb302-test" |
| configs += [ "//build/config:all_source" ] |
| deps = [ |
| ":common", |
| "//sdk/fidl/fuchsia.hardware.i2c:fuchsia.hardware.i2c_llcpp", |
| "//sdk/lib/inspect/testing/cpp:zxtest", |
| "//src/devices/i2c/testing/mock-i2c", |
| "//src/devices/testing/no_ddk", |
| "//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/58162): 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", |
| ] |
| } |