Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 1 | # Copyright 2020 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 18 | "pw_cc_test", |
Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 19 | ) |
| 20 | |
| 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
| 23 | licenses(["notice"]) # Apache License 2.0 |
| 24 | |
| 25 | pw_cc_library( |
| 26 | name = "id_headers", |
| 27 | hdrs = [ |
| 28 | "public/pw_thread_freertos/id_inline.h", |
| 29 | "public/pw_thread_freertos/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 | ], |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 45 | # TODO(pwbug/317): This should depend on FreeRTOS but our third parties |
| 46 | # currently do not have Bazel support. |
Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 47 | ) |
| 48 | |
| 49 | pw_cc_library( |
| 50 | name = "sleep_headers", |
| 51 | hdrs = [ |
| 52 | "public/pw_thread_freertos/sleep_inline.h", |
| 53 | "public_overrides/pw_thread_backend/sleep_inline.h", |
| 54 | ], |
| 55 | includes = [ |
| 56 | "public", |
| 57 | "public_overrides", |
| 58 | ], |
| 59 | deps = [ |
| 60 | "//pw_chrono:system_clock", |
| 61 | ], |
| 62 | ) |
| 63 | |
| 64 | pw_cc_library( |
| 65 | name = "sleep", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 66 | srcs = [ |
| 67 | "sleep.cc", |
| 68 | ], |
Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 69 | deps = [ |
| 70 | ":sleep_headers", |
Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 71 | "//pw_assert", |
| 72 | "//pw_chrono:system_clock", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 73 | "//pw_chrono_freertos:system_clock_headers", |
Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 74 | "//pw_thread:sleep_facade", |
| 75 | ], |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 76 | # TODO(pwbug/317): This should depend on FreeRTOS but our third parties |
| 77 | # currently do not have Bazel support. |
| 78 | ) |
| 79 | |
| 80 | # This target provides the FreeRTOS specific headers needs for thread creation. |
| 81 | pw_cc_library( |
| 82 | name = "thread_headers", |
| 83 | hdrs = [ |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 84 | "public/pw_thread_freertos/config.h", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 85 | "public/pw_thread_freertos/context.h", |
| 86 | "public/pw_thread_freertos/options.h", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 87 | "public/pw_thread_freertos/thread_inline.h", |
| 88 | "public/pw_thread_freertos/thread_native.h", |
| 89 | "public_overrides/pw_thread_backend/thread_inline.h", |
| 90 | "public_overrides/pw_thread_backend/thread_native.h", |
| 91 | ], |
| 92 | includes = [ |
| 93 | "public", |
| 94 | "public_overrides", |
| 95 | ], |
| 96 | deps = [ |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 97 | ":id", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 98 | "//pw_assert", |
Ewout van Bekkum | 3f00a3e | 2021-05-14 10:28:49 -0700 | [diff] [blame] | 99 | "//pw_string", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 100 | "//pw_sync:binary_semaphore", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 101 | "//pw_thread:thread_headers", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 102 | ], |
| 103 | # TODO(pwbug/317): This should depend on FreeRTOS but our third parties |
| 104 | # currently do not have Bazel support. |
| 105 | ) |
| 106 | |
| 107 | pw_cc_library( |
| 108 | name = "thread", |
| 109 | srcs = [ |
| 110 | "thread.cc", |
| 111 | ], |
| 112 | deps = [ |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 113 | ":id", |
| 114 | ":thread_headers", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 115 | "//pw_assert", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 116 | ], |
| 117 | # TODO(pwbug/317): This should depend on FreeRTOS but our third parties |
| 118 | # currently do not have Bazel support. |
| 119 | ) |
| 120 | |
| 121 | pw_cc_library( |
| 122 | name = "dynamic_test_threads", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 123 | srcs = [ |
| 124 | "dynamic_test_threads.cc", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 125 | ], |
| 126 | deps = [ |
| 127 | "//pw_chrono:system_clock", |
| 128 | "//pw_thread:sleep", |
| 129 | "//pw_thread:test_threads_header", |
| 130 | "//pw_thread:thread_facade", |
| 131 | ], |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 132 | ) |
| 133 | |
| 134 | pw_cc_test( |
| 135 | name = "dynamic_thread_backend_test", |
| 136 | deps = [ |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 137 | ":dynamic_test_threads", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 138 | "//pw_thread:thread_facade_test", |
| 139 | ], |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 140 | ) |
| 141 | |
| 142 | pw_cc_library( |
| 143 | name = "static_test_threads", |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 144 | srcs = [ |
| 145 | "static_test_threads.cc", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 146 | ], |
| 147 | deps = [ |
| 148 | "//pw_chrono:system_clock", |
| 149 | "//pw_thread:sleep", |
| 150 | "//pw_thread:test_threads_header", |
| 151 | "//pw_thread:thread_facade", |
| 152 | ], |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 153 | ) |
| 154 | |
| 155 | pw_cc_test( |
| 156 | name = "static_thread_backend_test", |
| 157 | deps = [ |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 158 | ":static_test_threads", |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 159 | "//pw_thread:thread_facade_test", |
| 160 | ], |
Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 161 | ) |
| 162 | |
| 163 | pw_cc_library( |
| 164 | name = "yield_headers", |
| 165 | hdrs = [ |
| 166 | "public/pw_thread_freertos/yield_inline.h", |
| 167 | "public_overrides/pw_thread_backend/yield_inline.h", |
| 168 | ], |
| 169 | includes = [ |
| 170 | "public", |
| 171 | "public_overrides", |
| 172 | ], |
Ewout van Bekkum | ae6c03a | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 173 | # TODO(pwbug/317): This should depend on FreeRTOS but our third parties |
| 174 | # currently do not have Bazel support. |
Ewout van Bekkum | 749342b | 2021-01-19 14:53:19 -0800 | [diff] [blame] | 175 | ) |
| 176 | |
| 177 | pw_cc_library( |
| 178 | name = "yield", |
| 179 | deps = [ |
| 180 | ":yield_headers", |
| 181 | "//pw_thread:yield_facade", |
| 182 | ], |
| 183 | ) |