1# Copyright 2021 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 15load( 16 "//pw_build:pigweed.bzl", 17 "pw_cc_library", 18) 19 20package(default_visibility = ["//visibility:public"]) 21 22licenses(["notice"]) 23 24pw_cc_library( 25 name = "id_headers", 26 hdrs = [ 27 "id_public_overrides/pw_thread_backend/id_inline.h", 28 "id_public_overrides/pw_thread_backend/id_native.h", 29 "public/pw_thread_embos/id_inline.h", 30 "public/pw_thread_embos/id_native.h", 31 ], 32 includes = [ 33 "id_public_overrides", 34 "public", 35 ], 36 target_compatible_with = [ 37 "//pw_build/constraints/rtos:embos", 38 ], 39) 40 41pw_cc_library( 42 name = "id", 43 deps = [ 44 ":id_headers", 45 "//pw_thread:id_facade", 46 ], 47 # TODO(b/234876414): This should depend on embOS but our third parties 48 # currently do not have Bazel support. 49) 50 51pw_cc_library( 52 name = "sleep_headers", 53 hdrs = [ 54 "public/pw_thread_embos/sleep_inline.h", 55 "sleep_public_overrides/pw_thread_backend/sleep_inline.h", 56 ], 57 includes = [ 58 "public", 59 "sleep_public_overrides", 60 ], 61 deps = [ 62 "//pw_chrono:system_clock", 63 ], 64) 65 66pw_cc_library( 67 name = "sleep", 68 srcs = [ 69 "sleep.cc", 70 ], 71 deps = [ 72 ":sleep_headers", 73 "//pw_assert", 74 "//pw_chrono:system_clock", 75 "//pw_chrono_embos:system_clock_headers", 76 "//pw_thread:sleep_facade", 77 ], 78 # TODO(b/234876414): This should depend on embOS but our third parties 79 # currently do not have Bazel support. 80) 81 82# This target provides the embOS specific headers needs for thread creation. 83pw_cc_library( 84 name = "thread_headers", 85 hdrs = [ 86 "public/pw_thread_embos/config.h", 87 "public/pw_thread_embos/context.h", 88 "public/pw_thread_embos/options.h", 89 "public/pw_thread_embos/thread_inline.h", 90 "public/pw_thread_embos/thread_native.h", 91 "thread_public_overrides/pw_thread_backend/thread_inline.h", 92 "thread_public_overrides/pw_thread_backend/thread_native.h", 93 ], 94 includes = [ 95 "public", 96 "thread_public_overrides", 97 ], 98 deps = [ 99 ":id", 100 "//pw_assert", 101 "//pw_string", 102 "//pw_thread:thread_facade", 103 ], 104 # TODO(b/234876414): This should depend on embOS but our third parties 105 # currently do not have Bazel support. 106) 107 108pw_cc_library( 109 name = "thread", 110 srcs = [ 111 "thread.cc", 112 ], 113 deps = [ 114 ":id", 115 ":thread_headers", 116 "//pw_assert", 117 ], 118 # TODO(b/234876414): This should depend on embOS but our third parties 119 # currently do not have Bazel support. 120) 121 122pw_cc_library( 123 name = "test_threads", 124 srcs = [ 125 "test_threads.cc", 126 ], 127 includes = ["public"], 128 # TODO(b/260637734): This target doesn't build 129 tags = ["manual"], 130 deps = [ 131 "//pw_chrono:system_clock", 132 "//pw_thread:sleep", 133 "//pw_thread:test_threads_header", 134 "//pw_thread:thread_facade", 135 ], 136) 137 138pw_cc_library( 139 name = "yield_headers", 140 hdrs = [ 141 "public/pw_thread_embos/yield_inline.h", 142 "yield_public_overrides/pw_thread_backend/yield_inline.h", 143 ], 144 includes = [ 145 "public", 146 "yield_public_overrides", 147 ], 148 # TODO(b/234876414): This should depend on embOS but our third parties 149 # currently do not have Bazel support. 150) 151 152pw_cc_library( 153 name = "yield", 154 deps = [ 155 ":yield_headers", 156 "//pw_thread:yield_facade", 157 ], 158) 159 160pw_cc_library( 161 name = "util", 162 srcs = [ 163 "util.cc", 164 ], 165 hdrs = [ 166 "public/pw_thread_embos/util.h", 167 ], 168 includes = ["public"], 169 # TODO(b/260637734): This target doesn't build 170 tags = ["manual"], 171 deps = [ 172 "//pw_function", 173 "//pw_status", 174 ], 175 # TODO(b/234876414): This should depend on embOS but our third parties 176 # currently do not have Bazel support. 177) 178 179pw_cc_library( 180 name = "snapshot", 181 srcs = [ 182 "snapshot.cc", 183 ], 184 hdrs = [ 185 "public/pw_thread_embos/snapshot.h", 186 ], 187 includes = ["public"], 188 # TODO(b/260637734): This target doesn't build 189 tags = ["manual"], 190 deps = [ 191 ":util", 192 "//pw_bytes", 193 "//pw_function", 194 "//pw_log", 195 "//pw_protobuf", 196 "//pw_status", 197 "//pw_thread:snapshot", 198 ], 199 # TODO(b/234876414): This should depend on embOS but our third parties 200 # currently do not have Bazel support. 201) 202