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