| # 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") |
| |
| declare_args() { |
| # The default fan level used by the VIM3 MCU driver. |
| # |
| # Valid values are between 0 (completely off) and 3 (full power). |
| # |
| # Do not depend on this setting in checked-in code. This setting is intended |
| # to facilitate at-desk development, and will be replaced by a more robust |
| # configuration mechanism. |
| vim3_mcu_fan_default_level = 1 |
| } |
| |
| driver_bind_rules("vim3_mcu_bind") { |
| rules = "vim3_mcu.bind" |
| tests = "bind_tests.json" |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.i2c:fuchsia.hardware.i2c_bindlib", |
| "//src/devices/bind/fuchsia.devicetree", |
| "//src/devices/bind/fuchsia.khadas.platform", |
| ] |
| } |
| |
| source_set("common_sources") { |
| configs += [ "//build/config:all_source" ] |
| public_configs = [ "//build/config/fuchsia:enable_zircon_asserts" ] |
| |
| sources = [ "vim3-mcu.cc" ] |
| |
| defines = [ "VIM3_MCU_FAN_DEFAULT_LEVEL=${vim3_mcu_fan_default_level}" ] |
| |
| public_deps = [ |
| ":vim3_mcu_bind", |
| "//sdk/fidl/fuchsia.hardware.fan:fuchsia.hardware.fan_cpp", |
| "//src/devices/i2c/lib/device-protocol-i2c-channel", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/driver:driver_runtime", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/inspect", |
| ] |
| } |
| |
| fuchsia_driver("vim3-mcu-driver") { |
| output_name = "vim3-mcu" |
| deps = [ |
| ":common_sources", |
| "//zircon/system/ulib/pretty", |
| ] |
| } |
| |
| fuchsia_driver_component("vim3-mcu") { |
| component_name = "vim3-mcu" |
| deps = [ ":vim3-mcu-driver" ] |
| info = "vim3-mcu-info.json" |
| manifest = "meta/vim3-mcu.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "vim3-mcu" |
| driver_components = [ ":vim3-mcu" ] |
| } |
| |
| test("vim3-mcu-test-bin") { |
| output_name = "vim3-mcu-test" |
| sources = [ "vim3-mcu-test.cc" ] |
| deps = [ |
| ":common_sources", |
| "//sdk/fidl/fuchsia.hardware.i2c:fuchsia.hardware.i2c_cpp", |
| "//sdk/lib/fit", |
| "//sdk/lib/inspect/testing/cpp:zxtest", |
| "//src/devices/i2c/testing/mock-i2c", |
| "//src/devices/testing/no_ddk", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("vim3-mcu-test") { |
| deps = [ ":vim3-mcu-test-bin" ] |
| test_specs = { |
| environments = basic_envs |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":vim3-mcu-test", |
| ":vim3_mcu_bind_test", |
| ] |
| } |