1# Copyright 2023 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni") 20import("$dir_pw_unit_test/test.gni") 21 22config("default_config") { 23 include_dirs = [ "public" ] 24} 25 26group("pw_spi_mcuxpresso") { 27 deps = [ 28 ":flexio_spi", 29 ":spi", 30 ] 31} 32 33if (pw_third_party_mcuxpresso_SDK != "") { 34 pw_source_set("spi") { 35 public_configs = [ ":default_config" ] 36 public = [ "public/pw_spi_mcuxpresso/spi.h" ] 37 public_deps = [ 38 "$dir_pw_spi:chip_selector", 39 "$dir_pw_spi:initiator", 40 "$dir_pw_status", 41 "$dir_pw_sync:binary_semaphore", 42 "$dir_pw_sync:lock_annotations", 43 "$dir_pw_sync:mutex", 44 "$pw_third_party_mcuxpresso_SDK", 45 ] 46 deps = [ 47 "$dir_pw_assert", 48 "$dir_pw_chrono:system_clock", 49 "$dir_pw_log", 50 ] 51 sources = [ "spi.cc" ] 52 } 53 54 pw_source_set("flexio_spi") { 55 public_configs = [ ":default_config" ] 56 public = [ "public/pw_spi_mcuxpresso/flexio_spi.h" ] 57 public_deps = [ 58 "$dir_pw_digital_io", 59 "$dir_pw_spi:chip_selector", 60 "$dir_pw_spi:initiator", 61 "$dir_pw_status", 62 "$dir_pw_sync:binary_semaphore", 63 "$dir_pw_sync:lock_annotations", 64 "$dir_pw_sync:mutex", 65 "$pw_third_party_mcuxpresso_SDK", 66 ] 67 deps = [ 68 "$dir_pw_chrono:system_clock", 69 "$dir_pw_log", 70 ] 71 sources = [ "flexio_spi.cc" ] 72 } 73 74 pw_source_set("responder") { 75 public_configs = [ ":default_config" ] 76 public = [ "public/pw_spi_mcuxpresso/responder.h" ] 77 public_deps = [ 78 "$dir_pw_digital_io", 79 "$dir_pw_spi:initiator", 80 "$dir_pw_spi:responder", 81 "$dir_pw_status", 82 "$dir_pw_sync:binary_semaphore", 83 "$dir_pw_sync:lock_annotations", 84 "$dir_pw_sync:mutex", 85 "$pw_third_party_mcuxpresso_SDK", 86 ] 87 deps = [ 88 "$dir_pw_chrono:system_clock", 89 "$dir_pw_log", 90 ] 91 sources = [ "responder.cc" ] 92 } 93 94 pw_test("spi_test") { 95 enable_if = 96 pw_third_party_mcuxpresso_SDK == 97 "//targets/mimxrt595_evk_freertos:sdk" && 98 (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" || 99 pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" || 100 pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized") 101 sources = [ "spi_test.cc" ] 102 deps = [ 103 ":spi", 104 "$dir_pw_spi:device", 105 "//targets/mimxrt595_evk_freertos:sdk", 106 ] 107 } 108 109 pw_test("flexio_spi_test") { 110 enable_if = 111 pw_third_party_mcuxpresso_SDK == 112 "//targets/mimxrt595_evk_freertos:sdk" && 113 (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" || 114 pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" || 115 pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized") 116 sources = [ "flexio_spi_test.cc" ] 117 deps = [ 118 ":flexio_spi", 119 "//targets/mimxrt595_evk_freertos:sdk", 120 ] 121 } 122 123 pw_test_group("tests") { 124 tests = [ 125 ":spi_test", 126 ":flexio_spi_test", 127 ] 128 } 129} else { 130 pw_test_group("tests") { 131 tests = [] 132 } 133} 134 135pw_doc_group("docs") { 136 sources = [ "docs.rst" ] 137} 138