Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 1 | # Copyright 2021 The Pigweed Authors |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 18 | "pw_cc_test", |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 19 | ) |
| 20 | |
| 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
Rob Mohr | 5fc2541 | 2021-06-23 09:35:23 -0700 | [diff] [blame] | 23 | licenses(["notice"]) |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 24 | |
| 25 | pw_cc_library( |
| 26 | name = "id_headers", |
| 27 | hdrs = [ |
| 28 | "public/pw_thread_threadx/id_inline.h", |
| 29 | "public/pw_thread_threadx/id_native.h", |
| 30 | "public_overrides/pw_thread_backend/id_inline.h", |
| 31 | "public_overrides/pw_thread_backend/id_native.h", |
| 32 | ], |
| 33 | includes = [ |
| 34 | "public", |
| 35 | "public_overrides", |
| 36 | ], |
| 37 | ) |
| 38 | |
| 39 | pw_cc_library( |
| 40 | name = "id", |
| 41 | deps = [ |
| 42 | ":id_headers", |
| 43 | "//pw_thread:id_facade", |
| 44 | ], |
| 45 | # TODO(pwbug/317): This should depend on ThreadX but our third parties |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 46 | # currently do not have Bazel support. |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 47 | ) |
| 48 | |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 49 | # This target provides the ThreadX specific headers needs for thread creation. |
| 50 | pw_cc_library( |
| 51 | name = "thread_headers", |
| 52 | hdrs = [ |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 53 | "public/pw_thread_threadx/config.h", |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 54 | "public/pw_thread_threadx/context.h", |
| 55 | "public/pw_thread_threadx/options.h", |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 56 | "public/pw_thread_threadx/thread_inline.h", |
| 57 | "public/pw_thread_threadx/thread_native.h", |
| 58 | "public_overrides/pw_thread_backend/thread_inline.h", |
| 59 | "public_overrides/pw_thread_backend/thread_native.h", |
| 60 | ], |
| 61 | includes = [ |
| 62 | "public", |
| 63 | "public_overrides", |
| 64 | ], |
| 65 | deps = [ |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 66 | ":id", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 67 | "//pw_assert", |
Ewout van Bekkum | cd765c0 | 2021-05-14 10:28:26 -0700 | [diff] [blame] | 68 | "//pw_string", |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 69 | "//pw_thread:thread_headers", |
| 70 | ], |
| 71 | # TODO(pwbug/317): This should depend on ThreadX but our third parties |
| 72 | # currently do not have Bazel support. |
| 73 | ) |
| 74 | |
| 75 | pw_cc_library( |
| 76 | name = "thread", |
| 77 | srcs = [ |
| 78 | "thread.cc", |
| 79 | ], |
| 80 | deps = [ |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 81 | ":id", |
| 82 | ":thread_headers", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 83 | "//pw_assert", |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 84 | ], |
| 85 | # TODO(pwbug/317): This should depend on ThreadX but our third parties |
| 86 | # currently do not have Bazel support. |
| 87 | ) |
| 88 | |
| 89 | pw_cc_library( |
| 90 | name = "test_threads", |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 91 | srcs = [ |
| 92 | "test_threads.cc", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 93 | ], |
| 94 | deps = [ |
| 95 | "//pw_chrono:system_clock", |
| 96 | "//pw_thread:sleep", |
| 97 | "//pw_thread:test_threads_header", |
| 98 | "//pw_thread:thread_facade", |
| 99 | ], |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 100 | ) |
| 101 | |
| 102 | pw_cc_test( |
| 103 | name = "thread_backend_test", |
| 104 | deps = [ |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 105 | ":test_threads", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 106 | "//pw_thread:thread_facade_test", |
| 107 | ], |
Ewout van Bekkum | f4da489 | 2021-03-05 15:05:37 -0800 | [diff] [blame] | 108 | ) |
| 109 | |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 110 | pw_cc_library( |
| 111 | name = "sleep_headers", |
| 112 | hdrs = [ |
| 113 | "public/pw_thread_threadx/sleep_inline.h", |
| 114 | "public_overrides/pw_thread_backend/sleep_inline.h", |
| 115 | ], |
| 116 | includes = [ |
| 117 | "public", |
| 118 | "public_overrides", |
| 119 | ], |
| 120 | deps = [ |
| 121 | "//pw_chrono:system_clock", |
| 122 | ], |
| 123 | ) |
| 124 | |
| 125 | pw_cc_library( |
| 126 | name = "sleep", |
| 127 | srcs = [ |
| 128 | "sleep.cc", |
| 129 | ], |
| 130 | deps = [ |
| 131 | ":sleep_headers", |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 132 | "//pw_assert", |
| 133 | "//pw_chrono:system_clock", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 134 | "//pw_chrono_threadx:system_clock_headers", |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 135 | "//pw_thread:sleep_facade", |
| 136 | ], |
| 137 | # TODO(pwbug/317): This should depend on ThreadX but our third parties |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 138 | # currently do not have Bazel support. |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 139 | ) |
| 140 | |
| 141 | pw_cc_library( |
| 142 | name = "yield_headers", |
| 143 | hdrs = [ |
| 144 | "public/pw_thread_threadx/yield_inline.h", |
| 145 | "public_overrides/pw_thread_backend/yield_inline.h", |
| 146 | ], |
| 147 | includes = [ |
| 148 | "public", |
| 149 | "public_overrides", |
| 150 | ], |
| 151 | # TODO(pwbug/317): This should depend on ThreadX but our third parties |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 152 | # currently do not have Bazel support. |
Ewout van Bekkum | fe5b4a7 | 2021-02-01 17:03:58 -0800 | [diff] [blame] | 153 | ) |
| 154 | |
| 155 | pw_cc_library( |
| 156 | name = "yield", |
| 157 | deps = [ |
| 158 | ":yield_headers", |
| 159 | "//pw_thread:yield_facade", |
| 160 | ], |
| 161 | ) |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 162 | |
| 163 | pw_cc_library( |
| 164 | name = "util", |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 165 | srcs = [ |
Rob Mohr | e93dc3b | 2021-07-12 07:28:32 -0700 | [diff] [blame] | 166 | "util.cc", |
| 167 | ], |
| 168 | hdrs = [ |
| 169 | "public/pw_thread_threadx/util.h", |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 170 | ], |
| 171 | deps = [ |
| 172 | "//pw_function", |
| 173 | "//pw_status", |
| 174 | ], |
| 175 | # TODO(pwbug/317): This should depend on ThreadX but our third parties |
| 176 | # currently do not have Bazel support. |
| 177 | ) |
| 178 | |
| 179 | pw_cc_library( |
| 180 | name = "snapshot", |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 181 | srcs = [ |
Rob Mohr | e93dc3b | 2021-07-12 07:28:32 -0700 | [diff] [blame] | 182 | "snapshot.cc", |
| 183 | ], |
| 184 | hdrs = [ |
| 185 | "public/pw_thread_threadx/snapshot.h", |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 186 | ], |
| 187 | deps = [ |
| 188 | ":util", |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 189 | "//pw_bytes", |
| 190 | "//pw_function", |
Ewout van Bekkum | 29404f9 | 2021-07-22 08:09:48 -0700 | [diff] [blame] | 191 | "//pw_log", |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 192 | "//pw_protobuf", |
| 193 | "//pw_status", |
Rob Mohr | e93dc3b | 2021-07-12 07:28:32 -0700 | [diff] [blame] | 194 | "//pw_thread:protos", |
Armando Montanez | fec572b | 2021-06-28 12:13:57 -0700 | [diff] [blame] | 195 | ], |
| 196 | # TODO(pwbug/317): This should depend on ThreadX but our third parties |
| 197 | # currently do not have Bazel support. |
| 198 | ) |