blob: 427af06d972b21bbc01adcc6d2069165b5487aec [file] [log] [blame]
Ewout van Bekkumf4da4892021-03-05 15:05:37 -08001# Copyright 2021 The Pigweed Authors
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -08002#
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",
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080018 "pw_cc_test",
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -080019)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"]) # Apache License 2.0
24
25pw_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
39pw_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
46 # currently do not have Bazel support.
47)
48
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080049# This target provides the ThreadX specific headers needs for thread creation.
50pw_cc_library(
51 name = "thread_headers",
52 hdrs = [
53 "public/pw_thread_threadx/context.h",
54 "public/pw_thread_threadx/options.h",
55 "public/pw_thread_threadx/config.h",
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 = [
66 "//pw_assert",
67 ":id",
68 "//pw_thread:thread_headers",
69 ],
70 # TODO(pwbug/317): This should depend on ThreadX but our third parties
71 # currently do not have Bazel support.
72)
73
74pw_cc_library(
75 name = "thread",
76 srcs = [
77 "thread.cc",
78 ],
79 deps = [
80 "//pw_assert",
81 ":id",
82 ":thread_headers",
83 ],
84 # TODO(pwbug/317): This should depend on ThreadX but our third parties
85 # currently do not have Bazel support.
86)
87
88pw_cc_library(
89 name = "test_threads",
90 deps = [
91 "//pw_thread:thread_facade",
92 "//pw_thread:test_threads_header",
93 "//pw_chrono:system_clock",
94 "//pw_thread:sleep",
95 ],
96 srcs = [
97 "test_threads.cc",
98 ]
99)
100
101pw_cc_test(
102 name = "thread_backend_test",
103 deps = [
104 "//pw_thread:thread_facade_test",
105 ":test_threads",
106 ]
107)
108
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -0800109pw_cc_library(
110 name = "sleep_headers",
111 hdrs = [
112 "public/pw_thread_threadx/sleep_inline.h",
113 "public_overrides/pw_thread_backend/sleep_inline.h",
114 ],
115 includes = [
116 "public",
117 "public_overrides",
118 ],
119 deps = [
120 "//pw_chrono:system_clock",
121 ],
122)
123
124pw_cc_library(
125 name = "sleep",
126 srcs = [
127 "sleep.cc",
128 ],
129 deps = [
130 ":sleep_headers",
131 "//pw_chrono_threadx:system_clock_headers",
132 "//pw_assert",
133 "//pw_chrono:system_clock",
134 "//pw_thread:sleep_facade",
135 ],
136 # TODO(pwbug/317): This should depend on ThreadX but our third parties
137 # currently do not have Bazel support.
138)
139
140pw_cc_library(
141 name = "yield_headers",
142 hdrs = [
143 "public/pw_thread_threadx/yield_inline.h",
144 "public_overrides/pw_thread_backend/yield_inline.h",
145 ],
146 includes = [
147 "public",
148 "public_overrides",
149 ],
150 # TODO(pwbug/317): This should depend on ThreadX but our third parties
151 # currently do not have Bazel support.
152)
153
154pw_cc_library(
155 name = "yield",
156 deps = [
157 ":yield_headers",
158 "//pw_thread:yield_facade",
159 ],
160)