blob: fc3718ddceb26bc83699cff665706e24e763ff31 [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
Rob Mohr5fc25412021-06-23 09:35:23 -070023licenses(["notice"])
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -080024
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
Nathaniel Brougha1113be2021-03-07 09:05:41 +080046 # currently do not have Bazel support.
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -080047)
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 = [
Nathaniel Brougha1113be2021-03-07 09:05:41 +080053 "public/pw_thread_threadx/config.h",
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080054 "public/pw_thread_threadx/context.h",
55 "public/pw_thread_threadx/options.h",
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080056 "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 Bekkumf4da4892021-03-05 15:05:37 -080066 ":id",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080067 "//pw_assert",
Ewout van Bekkumcd765c02021-05-14 10:28:26 -070068 "//pw_string",
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080069 "//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
75pw_cc_library(
76 name = "thread",
77 srcs = [
78 "thread.cc",
79 ],
80 deps = [
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080081 ":id",
82 ":thread_headers",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080083 "//pw_assert",
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080084 ],
85 # TODO(pwbug/317): This should depend on ThreadX but our third parties
86 # currently do not have Bazel support.
87)
88
89pw_cc_library(
90 name = "test_threads",
Ewout van Bekkumf4da4892021-03-05 15:05:37 -080091 srcs = [
92 "test_threads.cc",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080093 ],
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 Bekkumf4da4892021-03-05 15:05:37 -0800100)
101
102pw_cc_test(
103 name = "thread_backend_test",
104 deps = [
Ewout van Bekkumf4da4892021-03-05 15:05:37 -0800105 ":test_threads",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800106 "//pw_thread:thread_facade_test",
107 ],
Ewout van Bekkumf4da4892021-03-05 15:05:37 -0800108)
109
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -0800110pw_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
125pw_cc_library(
126 name = "sleep",
127 srcs = [
128 "sleep.cc",
129 ],
130 deps = [
131 ":sleep_headers",
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -0800132 "//pw_assert",
133 "//pw_chrono:system_clock",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800134 "//pw_chrono_threadx:system_clock_headers",
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -0800135 "//pw_thread:sleep_facade",
136 ],
137 # TODO(pwbug/317): This should depend on ThreadX but our third parties
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800138 # currently do not have Bazel support.
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -0800139)
140
141pw_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 Brougha1113be2021-03-07 09:05:41 +0800152 # currently do not have Bazel support.
Ewout van Bekkumfe5b4a72021-02-01 17:03:58 -0800153)
154
155pw_cc_library(
156 name = "yield",
157 deps = [
158 ":yield_headers",
159 "//pw_thread:yield_facade",
160 ],
161)
Armando Montanezfec572b2021-06-28 12:13:57 -0700162
163pw_cc_library(
164 name = "util",
Armando Montanezfec572b2021-06-28 12:13:57 -0700165 srcs = [
Rob Mohre93dc3b2021-07-12 07:28:32 -0700166 "util.cc",
167 ],
168 hdrs = [
169 "public/pw_thread_threadx/util.h",
Armando Montanezfec572b2021-06-28 12:13:57 -0700170 ],
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
179pw_cc_library(
180 name = "snapshot",
Armando Montanezfec572b2021-06-28 12:13:57 -0700181 srcs = [
Rob Mohre93dc3b2021-07-12 07:28:32 -0700182 "snapshot.cc",
183 ],
184 hdrs = [
185 "public/pw_thread_threadx/snapshot.h",
Armando Montanezfec572b2021-06-28 12:13:57 -0700186 ],
187 deps = [
188 ":util",
Armando Montanezfec572b2021-06-28 12:13:57 -0700189 "//pw_bytes",
190 "//pw_function",
Ewout van Bekkum29404f92021-07-22 08:09:48 -0700191 "//pw_log",
Armando Montanezfec572b2021-06-28 12:13:57 -0700192 "//pw_protobuf",
193 "//pw_status",
Rob Mohre93dc3b2021-07-12 07:28:32 -0700194 "//pw_thread:protos",
Armando Montanezfec572b2021-06-28 12:13:57 -0700195 ],
196 # TODO(pwbug/317): This should depend on ThreadX but our third parties
197 # currently do not have Bazel support.
198)