• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15load(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_library",
18    "pw_cc_test",
19)
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_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
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 FreeRTOS but our third parties
46    # currently do not have Bazel support.
47)
48
49pw_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
64pw_cc_library(
65    name = "sleep",
66    srcs = [
67        "sleep.cc",
68    ],
69    deps = [
70        ":sleep_headers",
71        "//pw_chrono_freertos:system_clock_headers",
72        "//pw_assert",
73        "//pw_chrono:system_clock",
74        "//pw_thread:sleep_facade",
75    ],
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.
81pw_cc_library(
82    name = "thread_headers",
83    hdrs = [
84        "public/pw_thread_freertos/context.h",
85        "public/pw_thread_freertos/options.h",
86        "public/pw_thread_freertos/config.h",
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 = [
97        "//pw_assert",
98        ":id",
99        "//pw_thread:thread_headers",
100    ],
101    # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
102    # currently do not have Bazel support.
103)
104
105pw_cc_library(
106    name = "thread",
107    srcs = [
108        "thread.cc",
109    ],
110    deps = [
111        "//pw_assert",
112        ":id",
113        ":thread_headers",
114    ],
115    # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
116    # currently do not have Bazel support.
117)
118
119pw_cc_library(
120    name = "dynamic_test_threads",
121    deps = [
122        "//pw_thread:thread_facade",
123        "//pw_thread:test_threads_header",
124        "//pw_chrono:system_clock",
125        "//pw_thread:sleep",
126    ],
127    srcs = [
128        "dynamic_test_threads.cc",
129    ]
130)
131
132pw_cc_test(
133    name = "dynamic_thread_backend_test",
134    deps = [
135        "//pw_thread:thread_facade_test",
136        ":dynamic_test_threads",
137    ]
138)
139
140pw_cc_library(
141    name = "static_test_threads",
142    deps = [
143        "//pw_thread:thread_facade",
144        "//pw_thread:test_threads_header",
145        "//pw_chrono:system_clock",
146        "//pw_thread:sleep",
147    ],
148    srcs = [
149        "static_test_threads.cc",
150    ]
151)
152
153pw_cc_test(
154    name = "static_thread_backend_test",
155    deps = [
156        "//pw_thread:thread_facade_test",
157        ":static_test_threads",
158    ]
159)
160
161pw_cc_library(
162    name = "yield_headers",
163    hdrs = [
164        "public/pw_thread_freertos/yield_inline.h",
165        "public_overrides/pw_thread_backend/yield_inline.h",
166    ],
167    includes = [
168        "public",
169        "public_overrides",
170    ],
171    # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
172    # currently do not have Bazel support.
173)
174
175pw_cc_library(
176    name = "yield",
177    deps = [
178        ":yield_headers",
179        "//pw_thread:yield_facade",
180    ],
181)
182
183