1# Copyright 2024 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("@rules_cc//cc:cc_library.bzl", "cc_library") 16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 17load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 18load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 19 20package( 21 default_visibility = ["//visibility:public"], 22) 23 24licenses(["notice"]) 25 26cc_library( 27 name = "pw_channel", 28 hdrs = [ 29 "public/pw_channel/channel.h", 30 "public/pw_channel/internal/channel_specializations.h", 31 "public/pw_channel/properties.h", 32 ], 33 strip_include_prefix = "public", 34 tags = ["noclangtidy"], 35 deps = [ 36 "//pw_assert:assert", 37 "//pw_async2:dispatcher", 38 "//pw_async2:poll", 39 "//pw_bytes", 40 "//pw_multibuf", 41 "//pw_result", 42 "//pw_span", 43 "//pw_status", 44 "//pw_toolchain:sibling_cast", 45 ], 46) 47 48pw_cc_test( 49 name = "channel_test", 50 srcs = ["channel_test.cc"], 51 deps = [ 52 ":pw_channel", 53 "//pw_allocator:testing", 54 "//pw_assert:check", 55 "//pw_compilation_testing:negative_compilation_testing", 56 "//pw_multibuf:allocator", 57 "//pw_multibuf:allocator_async", 58 "//pw_multibuf:simple_allocator", 59 "//pw_preprocessor", 60 ], 61) 62 63cc_library( 64 name = "forwarding_channel", 65 srcs = ["forwarding_channel.cc"], 66 hdrs = ["public/pw_channel/forwarding_channel.h"], 67 strip_include_prefix = "public", 68 deps = [ 69 ":pw_channel", 70 "//pw_async2:dispatcher", 71 "//pw_async2:poll", 72 "//pw_multibuf:allocator", 73 "//pw_multibuf:allocator_async", 74 "//pw_sync:lock_annotations", 75 "//pw_sync:mutex", 76 ], 77) 78 79pw_cc_test( 80 name = "forwarding_channel_test", 81 srcs = ["forwarding_channel_test.cc"], 82 deps = [ 83 ":forwarding_channel", 84 "//pw_allocator:testing", 85 "//pw_multibuf:header_chunk_region_tracker", 86 "//pw_multibuf:simple_allocator", 87 "//pw_string:string", 88 ], 89) 90 91cc_library( 92 name = "loopback_channel", 93 srcs = ["loopback_channel.cc"], 94 hdrs = ["public/pw_channel/loopback_channel.h"], 95 strip_include_prefix = "public", 96 deps = [ 97 ":pw_channel", 98 "//pw_async2:dispatcher", 99 "//pw_async2:poll", 100 "//pw_multibuf", 101 "//pw_multibuf:allocator", 102 "//pw_multibuf:allocator_async", 103 ], 104) 105 106pw_cc_test( 107 name = "loopback_channel_test", 108 srcs = ["loopback_channel_test.cc"], 109 deps = [ 110 ":loopback_channel", 111 ":pw_channel", 112 "//pw_allocator:testing", 113 "//pw_assert:check", 114 "//pw_async2:dispatcher", 115 "//pw_bytes", 116 "//pw_multibuf:allocator_async", 117 "//pw_multibuf:testing", 118 "//pw_status", 119 ], 120) 121 122cc_library( 123 name = "epoll_channel", 124 srcs = ["epoll_channel.cc"], 125 hdrs = ["public/pw_channel/epoll_channel.h"], 126 strip_include_prefix = "public", 127 target_compatible_with = ["@platforms//os:linux"], 128 deps = [ 129 ":pw_channel", 130 "//pw_async2:dispatcher", 131 "//pw_async2:poll", 132 "//pw_log", 133 "//pw_multibuf", 134 "//pw_multibuf:allocator", 135 "//pw_multibuf:allocator_async", 136 "//pw_status", 137 ], 138) 139 140pw_cc_test( 141 name = "epoll_channel_test", 142 srcs = ["epoll_channel_test.cc"], 143 target_compatible_with = ["@platforms//os:linux"], 144 deps = [ 145 ":epoll_channel", 146 ":pw_channel", 147 "//pw_assert:check", 148 "//pw_async2:dispatcher", 149 "//pw_bytes", 150 "//pw_multibuf:allocator_async", 151 "//pw_multibuf:testing", 152 "//pw_status", 153 "//pw_thread:sleep", 154 "//pw_thread:thread", 155 "//pw_thread_stl:options", 156 ], 157) 158 159cc_library( 160 name = "rp2_stdio_channel", 161 srcs = ["rp2_stdio_channel.cc"], 162 hdrs = ["public/pw_channel/rp2_stdio_channel.h"], 163 implementation_deps = ["//pw_assert:check"], 164 strip_include_prefix = "public", 165 target_compatible_with = [ 166 "//pw_build/constraints/chipset:rp2040", 167 ], 168 deps = [ 169 ":pw_channel", 170 "//pw_log", 171 "//pw_multibuf:allocator", 172 "//pw_multibuf:allocator_async", 173 "@pico-sdk//src/rp2_common/pico_stdlib", 174 ], 175) 176 177cc_library( 178 name = "stream_channel", 179 srcs = ["stream_channel.cc"], 180 hdrs = ["public/pw_channel/stream_channel.h"], 181 strip_include_prefix = "public", 182 deps = [ 183 ":pw_channel", 184 "//pw_async2:dispatcher_base", 185 "//pw_log", 186 "//pw_multibuf", 187 "//pw_multibuf:allocator", 188 "//pw_multibuf:allocator_async", 189 "//pw_status", 190 "//pw_stream", 191 "//pw_sync:interrupt_spin_lock", 192 "//pw_sync:thread_notification", 193 "//pw_thread:thread", 194 ], 195) 196 197pw_cc_test( 198 name = "stream_channel_test", 199 srcs = ["stream_channel_test.cc"], 200 deps = [ 201 ":stream_channel", 202 "//pw_async2:pend_func_task", 203 "//pw_bytes", 204 "//pw_multibuf:allocator_async", 205 "//pw_multibuf:testing", 206 "//pw_status", 207 "//pw_stream", 208 "//pw_stream:mpsc_stream", 209 "//pw_thread:test_thread_context", 210 "//pw_thread:thread", 211 "//pw_toolchain:globals", 212 "//pw_toolchain:no_destructor", 213 ], 214) 215 216filegroup( 217 name = "doxygen", 218 srcs = [ 219 "public/pw_channel/channel.h", 220 "public/pw_channel/epoll_channel.h", 221 "public/pw_channel/forwarding_channel.h", 222 "public/pw_channel/loopback_channel.h", 223 "public/pw_channel/rp2_stdio_channel.h", 224 "public/pw_channel/stream_channel.h", 225 ], 226) 227 228sphinx_docs_library( 229 name = "docs", 230 srcs = [ 231 "design.rst", 232 "docs.rst", 233 "guides.rst", 234 "reference.rst", 235 ], 236 prefix = "pw_channel/", 237 target_compatible_with = incompatible_with_mcu(), 238) 239