Ewout van Bekkum | 5bcd8c4 | 2020-11-23 10:46:16 -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 | import("//build_overrides/pigweed.gni") |
| 16 | |
| 17 | import("$dir_pw_build/target_types.gni") |
Ewout van Bekkum | f7e38b3 | 2020-11-16 11:56:41 -0800 | [diff] [blame] | 18 | import("$dir_pw_chrono/backend.gni") |
Ewout van Bekkum | 5bcd8c4 | 2020-11-23 10:46:16 -0800 | [diff] [blame] | 19 | import("$dir_pw_docgen/docs.gni") |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 20 | import("$dir_pw_sync/backend.gni") |
Ewout van Bekkum | 5bcd8c4 | 2020-11-23 10:46:16 -0800 | [diff] [blame] | 21 | |
| 22 | config("public_include_path") { |
| 23 | include_dirs = [ "public" ] |
| 24 | visibility = [ ":*" ] |
| 25 | } |
| 26 | |
| 27 | config("backend_config") { |
| 28 | include_dirs = [ "public_overrides" ] |
| 29 | visibility = [ ":*" ] |
| 30 | } |
| 31 | |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 32 | # This target provides the backend for pw::sync::Mutex. |
| 33 | pw_source_set("mutex") { |
| 34 | public_configs = [ |
| 35 | ":public_include_path", |
| 36 | ":backend_config", |
| 37 | ] |
| 38 | public = [ |
| 39 | "public/pw_sync_threadx/mutex_inline.h", |
| 40 | "public/pw_sync_threadx/mutex_native.h", |
| 41 | "public_overrides/pw_sync_backend/mutex_inline.h", |
| 42 | "public_overrides/pw_sync_backend/mutex_native.h", |
| 43 | ] |
| 44 | public_deps = [ |
| 45 | "$dir_pw_assert", |
| 46 | "$dir_pw_interrupt:context", |
| 47 | "$dir_pw_sync:mutex.facade", |
| 48 | "$dir_pw_third_party/threadx", |
| 49 | ] |
| 50 | } |
| 51 | |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 52 | if (pw_chrono_SYSTEM_CLOCK_BACKEND != "") { |
| 53 | # This target provides the backend for pw::sync::BinarySemaphore. |
| 54 | pw_source_set("binary_semaphore") { |
| 55 | public_configs = [ |
| 56 | ":public_include_path", |
| 57 | ":backend_config", |
| 58 | ] |
| 59 | public = [ |
| 60 | "public/pw_sync_threadx/binary_semaphore_inline.h", |
| 61 | "public/pw_sync_threadx/binary_semaphore_native.h", |
| 62 | "public_overrides/pw_sync_backend/binary_semaphore_inline.h", |
| 63 | "public_overrides/pw_sync_backend/binary_semaphore_native.h", |
| 64 | ] |
| 65 | public_deps = [ |
| 66 | "$dir_pw_assert", |
| 67 | "$dir_pw_chrono:system_clock", |
| 68 | "$dir_pw_interrupt:context", |
| 69 | "$dir_pw_third_party/threadx", |
| 70 | ] |
| 71 | sources = [ "binary_semaphore.cc" ] |
| 72 | deps = [ |
| 73 | "$dir_pw_sync:binary_semaphore.facade", |
| 74 | pw_chrono_SYSTEM_CLOCK_BACKEND, |
| 75 | ] |
| 76 | assert( |
| 77 | pw_sync_OVERRIDE_SYSTEM_CLOCK_BACKEND_CHECK || |
| 78 | pw_chrono_SYSTEM_CLOCK_BACKEND == |
| 79 | "$dir_pw_chrono_threadx:system_clock", |
| 80 | "The ThreadX pw::sync::BinarySemaphore backend only works with the " + |
| 81 | "ThreadX pw::chrono::SystemClock backend.") |
| 82 | } |
Ewout van Bekkum | f7e38b3 | 2020-11-16 11:56:41 -0800 | [diff] [blame] | 83 | |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 84 | # This target provides the backend for pw::sync::CountingSemaphore. |
| 85 | pw_source_set("counting_semaphore") { |
| 86 | public_configs = [ |
| 87 | ":public_include_path", |
| 88 | ":backend_config", |
| 89 | ] |
| 90 | public = [ |
| 91 | "public/pw_sync_threadx/counting_semaphore_inline.h", |
| 92 | "public/pw_sync_threadx/counting_semaphore_native.h", |
| 93 | "public_overrides/pw_sync_backend/counting_semaphore_inline.h", |
| 94 | "public_overrides/pw_sync_backend/counting_semaphore_native.h", |
| 95 | ] |
| 96 | public_deps = [ |
| 97 | "$dir_pw_assert", |
| 98 | "$dir_pw_chrono:system_clock", |
| 99 | "$dir_pw_interrupt:context", |
| 100 | "$dir_pw_third_party/threadx", |
| 101 | ] |
| 102 | sources = [ "counting_semaphore.cc" ] |
| 103 | deps = [ |
| 104 | "$dir_pw_sync:counting_semaphore.facade", |
| 105 | pw_chrono_SYSTEM_CLOCK_BACKEND, |
| 106 | ] |
| 107 | assert(pw_sync_OVERRIDE_SYSTEM_CLOCK_BACKEND_CHECK || |
| 108 | pw_chrono_SYSTEM_CLOCK_BACKEND == |
| 109 | "$dir_pw_chrono_threadx:system_clock", |
| 110 | "The ThreadX pw::sync::CountingSemaphore backend only works with " + |
| 111 | "the ThreadX pw::chrono::SystemClock backend.") |
| 112 | } |
Ewout van Bekkum | f7e38b3 | 2020-11-16 11:56:41 -0800 | [diff] [blame] | 113 | |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 114 | # This target provides the backend for pw::sync::TimedMutex. |
| 115 | pw_source_set("timed_mutex") { |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 116 | public_configs = [ |
| 117 | ":public_include_path", |
| 118 | ":backend_config", |
| 119 | ] |
| 120 | public = [ |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 121 | "public/pw_sync_threadx/timed_mutex_inline.h", |
| 122 | "public_overrides/pw_sync_backend/timed_mutex_inline.h", |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 123 | ] |
| 124 | public_deps = [ |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 125 | "$dir_pw_chrono:system_clock", |
Ewout van Bekkum | 6f5b8fb | 2021-04-06 16:15:22 -0700 | [diff] [blame] | 126 | "$dir_pw_sync:timed_mutex.facade", |
| 127 | ] |
| 128 | sources = [ "timed_mutex.cc" ] |
| 129 | deps = [ |
| 130 | "$dir_pw_assert", |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 131 | "$dir_pw_interrupt:context", |
| 132 | "$dir_pw_third_party/threadx", |
Ewout van Bekkum | f680eb1 | 2020-12-30 15:29:18 -0800 | [diff] [blame] | 133 | pw_chrono_SYSTEM_CLOCK_BACKEND, |
| 134 | ] |
| 135 | assert(pw_sync_OVERRIDE_SYSTEM_CLOCK_BACKEND_CHECK || |
| 136 | pw_chrono_SYSTEM_CLOCK_BACKEND == |
| 137 | "$dir_pw_chrono_threadx:system_clock", |
| 138 | "The ThreadX pw::sync::Mutex backend only works with the ThreadX " + |
| 139 | "pw::chrono::SystemClock backend.") |
| 140 | } |
Ewout van Bekkum | f7e38b3 | 2020-11-16 11:56:41 -0800 | [diff] [blame] | 141 | } |
| 142 | |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 143 | # This target provides the backend for pw::sync::InterruptSpinLock, note that |
| 144 | # this implementation does NOT support ThreadX w/ SMP. |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 145 | pw_source_set("interrupt_spin_lock") { |
Ewout van Bekkum | 5bcd8c4 | 2020-11-23 10:46:16 -0800 | [diff] [blame] | 146 | public_configs = [ |
| 147 | ":public_include_path", |
| 148 | ":backend_config", |
| 149 | ] |
| 150 | public = [ |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 151 | "public/pw_sync_threadx/interrupt_spin_lock_inline.h", |
| 152 | "public/pw_sync_threadx/interrupt_spin_lock_native.h", |
| 153 | "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h", |
| 154 | "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h", |
Ewout van Bekkum | 5bcd8c4 | 2020-11-23 10:46:16 -0800 | [diff] [blame] | 155 | ] |
| 156 | public_deps = [ "$dir_pw_third_party/threadx" ] |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 157 | sources = [ "interrupt_spin_lock.cc" ] |
Ewout van Bekkum | 5bcd8c4 | 2020-11-23 10:46:16 -0800 | [diff] [blame] | 158 | deps = [ |
| 159 | "$dir_pw_assert", |
Ewout van Bekkum | eded103 | 2021-06-22 14:19:42 -0700 | [diff] [blame^] | 160 | "$dir_pw_interrupt:context", |
Ewout van Bekkum | 126e011 | 2021-03-12 10:59:49 -0800 | [diff] [blame] | 161 | "$dir_pw_sync:interrupt_spin_lock.facade", |
Ewout van Bekkum | 5bcd8c4 | 2020-11-23 10:46:16 -0800 | [diff] [blame] | 162 | ] |
| 163 | } |
| 164 | |
| 165 | pw_doc_group("docs") { |
| 166 | sources = [ "docs.rst" ] |
| 167 | } |