• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:device",
39      "$dir_pw_status",
40      "$dir_pw_sync:binary_semaphore",
41      "$dir_pw_sync:lock_annotations",
42      "$dir_pw_sync:mutex",
43      "$pw_third_party_mcuxpresso_SDK",
44    ]
45    deps = [
46      "$dir_pw_assert",
47      "$dir_pw_chrono:system_clock",
48      "$dir_pw_log",
49    ]
50    sources = [ "spi.cc" ]
51  }
52
53  pw_source_set("flexio_spi") {
54    public_configs = [ ":default_config" ]
55    public = [ "public/pw_spi_mcuxpresso/flexio_spi.h" ]
56    public_deps = [
57      "$dir_pw_digital_io",
58      "$dir_pw_spi:device",
59      "$dir_pw_status",
60      "$dir_pw_sync:binary_semaphore",
61      "$dir_pw_sync:lock_annotations",
62      "$dir_pw_sync:mutex",
63      "$pw_third_party_mcuxpresso_SDK",
64    ]
65    deps = [
66      "$dir_pw_chrono:system_clock",
67      "$dir_pw_log",
68    ]
69    sources = [ "flexio_spi.cc" ]
70  }
71
72  pw_source_set("responder") {
73    public_configs = [ ":default_config" ]
74    public = [ "public/pw_spi_mcuxpresso/responder.h" ]
75    public_deps = [
76      "$dir_pw_digital_io",
77      "$dir_pw_spi:initiator",
78      "$dir_pw_spi:responder",
79      "$dir_pw_status",
80      "$dir_pw_sync:binary_semaphore",
81      "$dir_pw_sync:lock_annotations",
82      "$dir_pw_sync:mutex",
83      "$pw_third_party_mcuxpresso_SDK",
84    ]
85    deps = [
86      "$dir_pw_chrono:system_clock",
87      "$dir_pw_log",
88    ]
89    sources = [ "responder.cc" ]
90  }
91
92  pw_test("spi_test") {
93    enable_if =
94        pw_third_party_mcuxpresso_SDK ==
95        "//targets/mimxrt595_evk_freertos:sdk" &&
96        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
97         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
98         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
99    sources = [ "spi_test.cc" ]
100    deps = [
101      ":spi",
102      "//targets/mimxrt595_evk_freertos:sdk",
103    ]
104  }
105
106  pw_test("flexio_spi_test") {
107    enable_if =
108        pw_third_party_mcuxpresso_SDK ==
109        "//targets/mimxrt595_evk_freertos:sdk" &&
110        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
111         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
112         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
113    sources = [ "flexio_spi_test.cc" ]
114    deps = [
115      ":flexio_spi",
116      "//targets/mimxrt595_evk_freertos:sdk",
117    ]
118  }
119
120  pw_test_group("tests") {
121    tests = [
122      ":spi_test",
123      ":flexio_spi_test",
124    ]
125  }
126} else {
127  pw_test_group("tests") {
128    tests = []
129  }
130}
131
132pw_doc_group("docs") {
133  sources = [ "docs.rst" ]
134}
135