xref: /aosp_15_r20/external/pigweed/pw_sync_baremetal/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2021 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")
20import("$dir_pw_unit_test/test.gni")
21
22config("public_include_path") {
23  include_dirs = [ "public" ]
24  visibility = [ ":*" ]
25}
26
27config("backend_config") {
28  include_dirs = [ "public_overrides" ]
29  visibility = [ ":*" ]
30}
31
32# This target provides the backend for pw::sync::InterruptSpinLock.
33# The provided implementation makes a single attempt to acquire the lock and
34# asserts if it is unavailable. It does not perform interrupt masking or disable
35# global interrupts, so this implementation does not support simultaneous
36# multi-threaded environments including IRQs, and is only meant to prevent
37# data corruption. This implementation is not yet set up to support hardware
38# multi-threading (SMP, SMT, etc).
39pw_source_set("interrupt_spin_lock") {
40  public_configs = [
41    ":public_include_path",
42    ":backend_config",
43  ]
44  public = [
45    "public/pw_sync_baremetal/interrupt_spin_lock_inline.h",
46    "public/pw_sync_baremetal/interrupt_spin_lock_native.h",
47    "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h",
48    "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h",
49  ]
50  public_deps = [
51    "$dir_pw_assert",
52    "$dir_pw_sync:interrupt_spin_lock.facade",
53    "$dir_pw_sync:yield_core",
54  ]
55}
56
57# This target provides the backend for pw::sync::Mutex.
58# The provided implementation makes a single attempt to acquire the lock and
59# asserts if it is unavailable. This implementation is not yet set up to support
60# hardware multi-threading (SMP, SMT, etc).
61pw_source_set("mutex") {
62  public_configs = [
63    ":public_include_path",
64    ":backend_config",
65  ]
66  public = [
67    "public/pw_sync_baremetal/mutex_inline.h",
68    "public/pw_sync_baremetal/mutex_native.h",
69    "public_overrides/pw_sync_backend/mutex_inline.h",
70    "public_overrides/pw_sync_backend/mutex_native.h",
71  ]
72  public_deps = [
73    "$dir_pw_assert",
74    "$dir_pw_sync:mutex.facade",
75  ]
76}
77
78# This target provides the backend for pw::sync::RecursiveMutex.
79# The provided implementation makes a single attempt to acquire the lock and
80# asserts if it is unavailable. This implementation is not yet set up to support
81# hardware multi-threading (SMP, SMT, etc).
82pw_source_set("recursive_mutex") {
83  public_configs = [
84    ":public_include_path",
85    ":backend_config",
86  ]
87  public = [
88    "public/pw_sync_baremetal/recursive_mutex_inline.h",
89    "public/pw_sync_baremetal/recursive_mutex_native.h",
90    "public_overrides/pw_sync_backend/recursive_mutex_inline.h",
91    "public_overrides/pw_sync_backend/recursive_mutex_native.h",
92  ]
93  public_deps = [
94    "$dir_pw_assert",
95    "$dir_pw_sync:recursive_mutex.facade",
96  ]
97  visibility = [ "$dir_pw_sync:*" ]
98}
99
100pw_doc_group("docs") {
101  sources = [ "docs.rst" ]
102}
103
104pw_test_group("tests") {
105}
106