• 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: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_span:cast",
80      "$dir_pw_spi:initiator",
81      "$dir_pw_spi:responder",
82      "$dir_pw_status",
83      "$dir_pw_sync:binary_semaphore",
84      "$dir_pw_sync:lock_annotations",
85      "$dir_pw_sync:mutex",
86      "$pw_third_party_mcuxpresso_SDK",
87    ]
88    deps = [
89      "$dir_pw_chrono:system_clock",
90      "$dir_pw_log",
91    ]
92    sources = [ "responder.cc" ]
93  }
94
95  pw_test("spi_test") {
96    enable_if =
97        pw_third_party_mcuxpresso_SDK ==
98        "//targets/mimxrt595_evk_freertos:sdk" &&
99        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
100         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
101         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
102    sources = [ "spi_test.cc" ]
103    deps = [
104      ":spi",
105      "$dir_pw_spi:device",
106      "//targets/mimxrt595_evk_freertos:sdk",
107    ]
108  }
109
110  pw_test("flexio_spi_test") {
111    enable_if =
112        pw_third_party_mcuxpresso_SDK ==
113        "//targets/mimxrt595_evk_freertos:sdk" &&
114        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
115         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
116         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
117    sources = [ "flexio_spi_test.cc" ]
118    deps = [
119      ":flexio_spi",
120      "//targets/mimxrt595_evk_freertos:sdk",
121    ]
122  }
123
124  pw_test_group("tests") {
125    tests = [
126      ":spi_test",
127      ":flexio_spi_test",
128    ]
129  }
130} else {
131  pw_test_group("tests") {
132    tests = []
133  }
134}
135
136pw_doc_group("docs") {
137  sources = [ "docs.rst" ]
138}
139