blob: 376874a8ee3a4be8b1a8c86c3d4bf5ccee014d75 [file] [log] [blame]
# 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/cipd.gni")
import("//build/config/fuchsia/rules.gni")
import("//build/driver_package.gni")
import("//build/test.gni")
import("//build/test/test_package.gni")
import("//src/sys/build/components.gni")
import("//src/sys/build/fuchsia_unittest_package.gni")
pramboot_path = "ft8201/FT8006_Pramboot_V1.6_20180426_le.bin"
firmware_path =
"ft8201/LQ_T800_FT8201_BOE_8.0inch_TP0x05_Lcd0x08_20190921_all.bin"
driver_package("ft8201") {
deps = [ ":ft8201-module" ]
drivers = [
{
name = "ft8201.so"
},
]
libraries = []
if (internal_access) {
deps += [
":firmware-copy($shlib_toolchain)",
":pramboot-copy($shlib_toolchain)",
]
libraries += [
{
name = "firmware/$firmware_path"
},
{
name = "firmware/$pramboot_path"
},
]
}
}
if (internal_access) {
copy("firmware-copy") {
sources = [ "//prebuilt/touch/$firmware_path" ]
outputs = [ "$root_out_dir/firmware/$firmware_path" ]
}
copy("pramboot-copy") {
sources = [ "//prebuilt/touch/$pramboot_path" ]
outputs = [ "$root_out_dir/firmware/$pramboot_path" ]
}
}
bind_rules("ft8201-bind") {
rules = "ft8201.bind"
output = "ft8201-bind.h"
tests = "ft8201-bind-test.json"
deps = [
"//src/devices/bind/fuchsia.focaltech.platform",
"//src/devices/bind/fuchsia.platform",
]
}
source_set("common") {
public_deps = [
":ft8201-bind",
"//sdk/banjo/fuchsia.hardware.gpio",
"//sdk/banjo/fuchsia.hardware.hidbus",
"//sdk/banjo/fuchsia.hardware.i2c",
"//sdk/banjo/fuchsia.hardware.platform.device",
"//sdk/fidl/fuchsia.input.report:fuchsia.input.report_llcpp",
"//src/devices/i2c/lib/device-protocol-i2c-channel",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//src/ui/input/lib/input-report-reader",
"//zircon/public/lib/fbl",
"//zircon/public/lib/sync",
"//zircon/public/lib/zircon-internal",
"//zircon/public/lib/zx",
"//zircon/public/lib/zxc",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/hid",
]
}
driver_module("ft8201-module") {
output_name = "ft8201"
sources = [ "ft8201.cc" ]
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
deps = [ ":common" ]
defines = [
"FT8201_FIRMWARE_PATH=\"$firmware_path\"",
"FT8201_PRAMBOOT_PATH=\"$pramboot_path\"",
]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
}
executable("ft8201-test-bin") {
testonly = true
output_name = "ft8201-test"
configs += [ "//build/config:all_source" ]
sources = [
"ft8201-firmware-test.cc",
"ft8201-test.cc",
"ft8201.cc",
]
deps = [
":common",
"//sdk/banjo/fuchsia.hardware.gpio:fuchsia.hardware.gpio_mock",
"//src/devices/i2c/testing/fake-i2c",
"//src/devices/testing/fake_ddk",
"//zircon/public/lib/mock-function",
"//zircon/public/lib/zxtest",
]
defines = [
"FT8201_FIRMWARE_PATH=\"$firmware_path\"",
"FT8201_PRAMBOOT_PATH=\"$pramboot_path\"",
]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
}
fuchsia_unittest_package("ft8201-test") {
deps = [ ":ft8201-test-bin" ]
if (internal_access) {
deps += [
":test-firmware",
":test-pramboot",
]
}
}
if (internal_access) {
resource("test-firmware") {
sources = [ "//prebuilt/touch/$firmware_path" ]
outputs = [ "data/firmware/$firmware_path" ]
}
resource("test-pramboot") {
sources = [ "//prebuilt/touch/$pramboot_path" ]
outputs = [ "data/firmware/$pramboot_path" ]
}
}
group("tests") {
testonly = true
deps = [
":ft8201-bind_test",
":ft8201-test",
]
}