blob: 8235f15b9c0057a345633f00e26de6e6a918ad17 [file] [log] [blame]
Ewout van Bekkum58901932020-11-09 12:46:52 -08001# 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)
Nathaniel Broughc2d57812021-04-18 22:52:00 +080019load(
20 "//pw_build:selects.bzl",
21 "TARGET_COMPATIBLE_WITH_HOST_SELECT",
22)
Ewout van Bekkum58901932020-11-09 12:46:52 -080023
24package(default_visibility = ["//visibility:public"])
25
26licenses(["notice"]) # Apache License 2.0
27
28pw_cc_library(
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080029 name = "binary_semaphore_headers",
30 hdrs = [
31 "public/pw_sync_stl/binary_semaphore_inline.h",
32 "public/pw_sync_stl/binary_semaphore_native.h",
33 "public_overrides/pw_sync_backend/binary_semaphore_inline.h",
34 "public_overrides/pw_sync_backend/binary_semaphore_native.h",
35 ],
36 includes = [
37 "public",
38 "public_overrides",
39 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +080040 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080041 deps = [
42 "//pw_chrono:system_clock",
43 ],
44)
45
46pw_cc_library(
47 name = "binary_semaphore",
48 srcs = [
49 "binary_semaphore.cc",
50 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +080051 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080052 deps = [
53 ":binary_semaphore_headers",
Nathaniel Broughc2d57812021-04-18 22:52:00 +080054 "//pw_assert",
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080055 "//pw_chrono:system_clock",
56 "//pw_sync:binary_semaphore_facade",
57 ],
58)
59
60pw_cc_library(
61 name = "counting_semaphore_headers",
62 hdrs = [
63 "public/pw_sync_stl/counting_semaphore_inline.h",
64 "public/pw_sync_stl/counting_semaphore_native.h",
65 "public_overrides/pw_sync_backend/counting_semaphore_inline.h",
66 "public_overrides/pw_sync_backend/counting_semaphore_native.h",
67 ],
68 includes = [
69 "public",
70 "public_overrides",
71 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +080072 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080073 deps = [
74 "//pw_chrono:system_clock",
75 ],
76)
77
78pw_cc_library(
79 name = "counting_semaphore",
80 srcs = [
81 "counting_semaphore.cc",
82 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +080083 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080084 deps = [
85 ":counting_semaphore_headers",
Nathaniel Broughc2d57812021-04-18 22:52:00 +080086 "//pw_assert",
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080087 "//pw_chrono:system_clock",
88 "//pw_sync:counting_semaphore_facade",
89 ],
90)
91
92pw_cc_library(
93 name = "mutex_headers",
94 hdrs = [
95 "public/pw_sync_stl/mutex_inline.h",
96 "public/pw_sync_stl/mutex_native.h",
97 "public_overrides/pw_sync_backend/mutex_inline.h",
98 "public_overrides/pw_sync_backend/mutex_native.h",
99 ],
100 includes = [
101 "public",
102 "public_overrides",
103 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800104 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -0800105)
106
107pw_cc_library(
108 name = "mutex",
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800109 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -0800110 deps = [
111 ":mutex_headers",
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -0800112 "//pw_sync:mutex_facade",
113 ],
114)
115
116pw_cc_library(
Ewout van Bekkum6f5b8fb2021-04-06 16:15:22 -0700117 name = "timed_mutex_headers",
118 hdrs = [
119 "public/pw_sync_stl/timed_mutex_inline.h",
120 "public_overrides/pw_sync_backend/timed_mutex_inline.h",
121 ],
122 includes = [
123 "public",
124 "public_overrides",
125 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800126 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum6f5b8fb2021-04-06 16:15:22 -0700127 deps = [
128 "//pw_chrono:system_clock",
Ewout van Bekkum6f5b8fb2021-04-06 16:15:22 -0700129 ],
130)
131
132pw_cc_library(
133 name = "timed_mutex",
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800134 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum6f5b8fb2021-04-06 16:15:22 -0700135 deps = [
136 ":timed_mutex_headers",
137 "//pw_sync:timed_mutex_facade",
138 ],
139)
140
141pw_cc_library(
Ewout van Bekkum126e0112021-03-12 10:59:49 -0800142 name = "interrupt_spin_lock_headers",
Ewout van Bekkum58901932020-11-09 12:46:52 -0800143 hdrs = [
Ewout van Bekkum126e0112021-03-12 10:59:49 -0800144 "public/pw_sync_stl/interrupt_spin_lock_inline.h",
145 "public/pw_sync_stl/interrupt_spin_lock_native.h",
146 "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h",
147 "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h",
Ewout van Bekkum58901932020-11-09 12:46:52 -0800148 ],
149 includes = [
150 "public",
151 "public_overrides",
152 ],
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800153 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
154 deps = [
155 "//pw_sync:yield_core",
156 ],
Ewout van Bekkum58901932020-11-09 12:46:52 -0800157)
158
159pw_cc_library(
Ewout van Bekkum126e0112021-03-12 10:59:49 -0800160 name = "interrupt_spin_lock",
Nathaniel Broughc2d57812021-04-18 22:52:00 +0800161 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
Ewout van Bekkum58901932020-11-09 12:46:52 -0800162 deps = [
Ewout van Bekkum126e0112021-03-12 10:59:49 -0800163 ":interrupt_spin_lock_headers",
164 "//pw_sync:interrupt_spin_lock_facade",
Ewout van Bekkum58901932020-11-09 12:46:52 -0800165 "//pw_sync:yield_core",
166 ],
167)