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("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 16 17package(default_visibility = ["//visibility:public"]) 18 19licenses(["notice"]) 20 21cc_library( 22 name = "pw_channel", 23 hdrs = [ 24 "public/pw_channel/channel.h", 25 "public/pw_channel/internal/channel_specializations.h", 26 "public/pw_channel/properties.h", 27 ], 28 strip_include_prefix = "public", 29 deps = [ 30 "//pw_assert", 31 "//pw_async2:dispatcher", 32 "//pw_async2:poll", 33 "//pw_bytes", 34 "//pw_multibuf", 35 "//pw_result", 36 "//pw_span", 37 "//pw_status", 38 "//pw_toolchain:sibling_cast", 39 ], 40) 41 42pw_cc_test( 43 name = "channel_test", 44 srcs = ["channel_test.cc"], 45 deps = [ 46 ":pw_channel", 47 "//pw_allocator:testing", 48 "//pw_compilation_testing:negative_compilation_testing", 49 "//pw_multibuf:simple_allocator", 50 "//pw_preprocessor", 51 "//pw_unit_test", 52 ], 53) 54 55cc_library( 56 name = "forwarding_channel", 57 srcs = ["forwarding_channel.cc"], 58 hdrs = ["public/pw_channel/forwarding_channel.h"], 59 strip_include_prefix = "public", 60 deps = [ 61 ":pw_channel", 62 "//pw_multibuf:allocator", 63 "//pw_sync:mutex", 64 ], 65) 66 67pw_cc_test( 68 name = "forwarding_channel_test", 69 srcs = ["forwarding_channel_test.cc"], 70 deps = [ 71 ":forwarding_channel", 72 "//pw_allocator:testing", 73 "//pw_multibuf:header_chunk_region_tracker", 74 "//pw_multibuf:simple_allocator", 75 "//pw_unit_test", 76 ], 77) 78 79cc_library( 80 name = "loopback_channel", 81 srcs = ["loopback_channel.cc"], 82 hdrs = ["public/pw_channel/loopback_channel.h"], 83 strip_include_prefix = "public", 84 deps = [ 85 ":pw_channel", 86 "//pw_multibuf:allocator", 87 ], 88) 89 90pw_cc_test( 91 name = "loopback_channel_test", 92 srcs = ["loopback_channel_test.cc"], 93 deps = [ 94 ":loopback_channel", 95 "//pw_multibuf:testing", 96 "//pw_unit_test", 97 ], 98) 99 100cc_library( 101 name = "epoll_channel", 102 srcs = ["epoll_channel.cc"], 103 hdrs = ["public/pw_channel/epoll_channel.h"], 104 strip_include_prefix = "public", 105 target_compatible_with = ["@platforms//os:linux"], 106 deps = [ 107 ":pw_channel", 108 "//pw_multibuf:allocator", 109 ], 110) 111 112pw_cc_test( 113 name = "epoll_channel_test", 114 srcs = ["epoll_channel_test.cc"], 115 target_compatible_with = ["@platforms//os:linux"], 116 deps = [ 117 ":epoll_channel", 118 "//pw_multibuf:testing", 119 "//pw_thread:sleep", 120 "//pw_thread:thread", 121 "//pw_unit_test", 122 ], 123) 124 125cc_library( 126 name = "rp2_stdio_channel", 127 srcs = ["rp2_stdio_channel.cc"], 128 hdrs = ["public/pw_channel/rp2_stdio_channel.h"], 129 strip_include_prefix = "public", 130 target_compatible_with = [ 131 "//pw_build/constraints/chipset:rp2040", 132 ], 133 deps = [ 134 ":pw_channel", 135 "//pw_log", 136 "//pw_multibuf:allocator", 137 "@pico-sdk//src/rp2_common/pico_stdlib", 138 ], 139) 140 141cc_library( 142 name = "stream_channel", 143 srcs = ["stream_channel.cc"], 144 hdrs = ["public/pw_channel/stream_channel.h"], 145 strip_include_prefix = "public", 146 deps = [ 147 ":pw_channel", 148 "//pw_log", 149 "//pw_multibuf:allocator", 150 "//pw_stream", 151 "//pw_sync:interrupt_spin_lock", 152 "//pw_sync:thread_notification", 153 "//pw_thread:thread", 154 ], 155) 156 157pw_cc_test( 158 name = "stream_channel_test", 159 srcs = ["stream_channel_test.cc"], 160 deps = [ 161 ":stream_channel", 162 "//pw_async2:pend_func_task", 163 "//pw_multibuf:testing", 164 "//pw_stream", 165 "//pw_stream:mpsc_stream", 166 "//pw_thread:test_thread_context", 167 "//pw_thread:thread", 168 "//pw_unit_test", 169 ], 170) 171 172filegroup( 173 name = "doxygen", 174 srcs = [ 175 "public/pw_channel/channel.h", 176 "public/pw_channel/epoll_channel.h", 177 "public/pw_channel/forwarding_channel.h", 178 "public/pw_channel/loopback_channel.h", 179 "public/pw_channel/rp2_stdio_channel.h", 180 "public/pw_channel/stream_channel.h", 181 ], 182) 183