Ewout van Bekkum | 5890193 | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
| 18 | ) |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 19 | load( |
| 20 | "//pw_build:selects.bzl", |
| 21 | "TARGET_COMPATIBLE_WITH_HOST_SELECT", |
| 22 | ) |
Ewout van Bekkum | 5890193 | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 23 | |
| 24 | package(default_visibility = ["//visibility:public"]) |
| 25 | |
| 26 | licenses(["notice"]) # Apache License 2.0 |
| 27 | |
| 28 | pw_cc_library( |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 29 | 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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 40 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 41 | deps = [ |
| 42 | "//pw_chrono:system_clock", |
| 43 | ], |
| 44 | ) |
| 45 | |
| 46 | pw_cc_library( |
| 47 | name = "binary_semaphore", |
| 48 | srcs = [ |
| 49 | "binary_semaphore.cc", |
| 50 | ], |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 51 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 52 | deps = [ |
| 53 | ":binary_semaphore_headers", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 54 | "//pw_assert", |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 55 | "//pw_chrono:system_clock", |
| 56 | "//pw_sync:binary_semaphore_facade", |
| 57 | ], |
| 58 | ) |
| 59 | |
| 60 | pw_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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 72 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 73 | deps = [ |
| 74 | "//pw_chrono:system_clock", |
| 75 | ], |
| 76 | ) |
| 77 | |
| 78 | pw_cc_library( |
| 79 | name = "counting_semaphore", |
| 80 | srcs = [ |
| 81 | "counting_semaphore.cc", |
| 82 | ], |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 83 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 84 | deps = [ |
| 85 | ":counting_semaphore_headers", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 86 | "//pw_assert", |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 87 | "//pw_chrono:system_clock", |
| 88 | "//pw_sync:counting_semaphore_facade", |
| 89 | ], |
| 90 | ) |
| 91 | |
| 92 | pw_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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 104 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 105 | ) |
| 106 | |
| 107 | pw_cc_library( |
| 108 | name = "mutex", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 109 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 110 | deps = [ |
| 111 | ":mutex_headers", |
Ewout van Bekkum | 9618d8a | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 112 | "//pw_sync:mutex_facade", |
| 113 | ], |
| 114 | ) |
| 115 | |
| 116 | pw_cc_library( |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 117 | 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 Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 126 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 127 | deps = [ |
| 128 | "//pw_chrono:system_clock", |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 129 | ], |
| 130 | ) |
| 131 | |
| 132 | pw_cc_library( |
| 133 | name = "timed_mutex", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 134 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 135 | deps = [ |
| 136 | ":timed_mutex_headers", |
| 137 | "//pw_sync:timed_mutex_facade", |
| 138 | ], |
| 139 | ) |
| 140 | |
| 141 | pw_cc_library( |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 142 | name = "interrupt_spin_lock_headers", |
Ewout van Bekkum | 5890193 | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 143 | hdrs = [ |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 144 | "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 Bekkum | 5890193 | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 148 | ], |
| 149 | includes = [ |
| 150 | "public", |
| 151 | "public_overrides", |
| 152 | ], |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 153 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
| 154 | deps = [ |
| 155 | "//pw_sync:yield_core", |
| 156 | ], |
Ewout van Bekkum | 5890193 | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 157 | ) |
| 158 | |
| 159 | pw_cc_library( |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 160 | name = "interrupt_spin_lock", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 161 | target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
Ewout van Bekkum | 5890193 | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 162 | deps = [ |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 163 | ":interrupt_spin_lock_headers", |
| 164 | "//pw_sync:interrupt_spin_lock_facade", |
Ewout van Bekkum | 5890193 | 2020-11-09 12:46:52 -0800 | [diff] [blame] | 165 | "//pw_sync:yield_core", |
| 166 | ], |
| 167 | ) |