• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15load(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_library",
18    "pw_cc_test",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"])
24
25pw_cc_library(
26    name = "pw_hdlc",
27    srcs = [
28        "decoder.cc",
29        "encoder.cc",
30        "public/pw_hdlc/internal/encoder.h",
31        "public/pw_hdlc/internal/protocol.h",
32    ],
33    hdrs = [
34        "public/pw_hdlc/decoder.h",
35        "public/pw_hdlc/encoded_size.h",
36        "public/pw_hdlc/encoder.h",
37    ],
38    includes = ["public"],
39    deps = [
40        "//pw_bytes",
41        "//pw_checksum",
42        "//pw_log",
43        "//pw_result",
44        "//pw_span",
45        "//pw_status",
46        "//pw_stream",
47        "//pw_varint",
48    ],
49)
50
51pw_cc_library(
52    name = "rpc_channel_output",
53    hdrs = ["public/pw_hdlc/rpc_channel.h"],
54    includes = ["public"],
55    deps = [
56        ":pw_hdlc",
57        "//pw_rpc",
58        "//pw_span",
59    ],
60)
61
62pw_cc_library(
63    name = "pw_rpc",
64    srcs = ["rpc_packets.cc"],
65    hdrs = ["public/pw_hdlc/rpc_packets.h"],
66    includes = ["public"],
67    deps = [
68        ":pw_hdlc",
69        "//pw_rpc",
70    ],
71)
72
73pw_cc_library(
74    name = "packet_parser",
75    srcs = ["wire_packet_parser.cc"],
76    hdrs = ["public/pw_hdlc/wire_packet_parser.h"],
77    includes = ["public"],
78    deps = [
79        ":pw_hdlc",
80        "//pw_assert",
81        "//pw_bytes",
82        "//pw_checksum",
83        "//pw_router:packet_parser",
84    ],
85)
86
87# A backend for pw_rpc's `system_server` that sends and receives HDLC-framed RPC
88# packets over pw_sys_io.
89#
90# Warning: This system server is polling and blocking, so it's not
91# production-ready. This exists for simplifying initial bringup/testing, and
92# should not be used in any performance-sensitive application.
93pw_cc_library(
94    name = "hdlc_sys_io_system_server",
95    srcs = [
96        "hdlc_sys_io_system_server.cc",
97    ],
98    deps = [
99        ":pw_rpc",
100        ":rpc_channel_output",
101        "//pw_log",
102        "//pw_rpc/system_server:facade",
103        "//pw_stream:sys_io_stream",
104    ],
105)
106
107pw_cc_test(
108    name = "encoder_test",
109    srcs = ["encoder_test.cc"],
110    deps = [
111        ":pw_hdlc",
112        "//pw_stream",
113        "//pw_unit_test",
114    ],
115)
116
117pw_cc_test(
118    name = "decoder_test",
119    srcs = ["decoder_test.cc"],
120    deps = [
121        ":pw_hdlc",
122        "//pw_result",
123        "//pw_stream",
124        "//pw_unit_test",
125    ],
126)
127
128pw_cc_test(
129    name = "encoded_size_test",
130    srcs = ["encoded_size_test.cc"],
131    deps = [
132        ":pw_hdlc",
133        "//pw_bytes",
134        "//pw_result",
135        "//pw_stream",
136        "//pw_unit_test",
137        "//pw_varint",
138    ],
139)
140
141pw_cc_test(
142    name = "wire_packet_parser_test",
143    srcs = ["wire_packet_parser_test.cc"],
144    deps = [
145        ":packet_parser",
146        "//pw_bytes",
147    ],
148)
149
150pw_cc_test(
151    name = "rpc_channel_test",
152    srcs = ["rpc_channel_test.cc"],
153    deps = [
154        ":pw_hdlc",
155        ":rpc_channel_output",
156        "//pw_stream",
157        "//pw_unit_test",
158    ],
159)
160