aboutsummaryrefslogtreecommitdiff
path: root/pw_router
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2021-10-26 22:55:27 -0600
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-12-17 00:09:32 +0000
commitb8f3ad2db9ad0f08970d62af3910f91ee5389e12 (patch)
tree75f9676f73cd9db2a2f01744d500d65e1a9788d8 /pw_router
parent6f6b6a12665eaac4854c6399e919736a9e32778c (diff)
downloadpigweed-b8f3ad2db9ad0f08970d62af3910f91ee5389e12.tar.gz
Zephyr implementation of pw_rpc and dependencies
Provide a Zephyr implementation of the pigweed modules and facades required for using pw_rpc in a Zephyr application. Change-Id: I6f148e7d85b338fcb7045460912d228f1785576c Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/67186 Reviewed-by: Keir Mierle <keir@google.com> Reviewed-by: Paul Fagerburg <pfagerburg@google.com> Reviewed-by: Wyatt Hepler <hepler@google.com> Pigweed-Auto-Submit: Yuval Peress <peress@google.com> Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Diffstat (limited to 'pw_router')
-rw-r--r--pw_router/CMakeLists.txt12
-rw-r--r--pw_router/Kconfig40
-rw-r--r--pw_router/docs.rst14
3 files changed, 66 insertions, 0 deletions
diff --git a/pw_router/CMakeLists.txt b/pw_router/CMakeLists.txt
index cf80e79dd..a971d5765 100644
--- a/pw_router/CMakeLists.txt
+++ b/pw_router/CMakeLists.txt
@@ -25,21 +25,33 @@ pw_add_module_library(pw_router.static_router
PRIVATE_DEPS
pw_log
)
+if(Zephyr_FOUND AND CONFIG_PIGWEED_ROUTER_STATIC_ROUTER)
+ zephyr_link_libraries(pw_router.static_router)
+endif()
pw_add_module_library(pw_router.egress
PUBLIC_DEPS
pw_bytes
)
+if(Zephyr_FOUND AND CONFIG_PIGWEED_ROUTER_EGRESS)
+ zephyr_link_libraries(pw_router.egress)
+endif()
pw_add_module_library(pw_router.packet_parser
PUBLIC_DEPS
pw_bytes
)
+if(Zephyr_FOUND AND CONFIG_PIGWEED_ROUTER_PACKET_PARSER)
+ zephyr_link_libraries(pw_router.packet_parser)
+endif()
pw_add_module_library(pw_router.egress_function
PUBLIC_DEPS
pw_rpc.egress
)
+if(Zephyr_FOUND AND CONFIG_PIGWEED_ROUTER_EGRESS_FUNCTION)
+ zephyr_link_libraries(pw_router.egress_function)
+endif()
pw_auto_add_module_tests(pw_router
PRIVATE_DEPS
diff --git a/pw_router/Kconfig b/pw_router/Kconfig
new file mode 100644
index 000000000..090e34e24
--- /dev/null
+++ b/pw_router/Kconfig
@@ -0,0 +1,40 @@
+# Copyright 2021 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+menuconfig PIGWEED_ROUTER
+ bool "Enable the Pigweed router library (pw_router)"
+
+if PIGWEED_ROUTER
+
+config PIGWEED_ROUTER_STATIC_ROUTER
+ bool "Enable the Pigweed static router library (pw_router.static_router)"
+ select PIGWEED_METRIC
+ select PIGWEED_ROUTER_EGRESS
+ select PIGWEED_ROUTER_PACKET_PARSER
+ select PIGWEED_SYNC_MUTEX
+ select PIGWEED_LOG
+
+config PIGWEED_ROUTER_EGRESS
+ bool "Enable the Pigweed router egress library (pw_router.egress)"
+ select PIGWEED_BYTES
+
+config PIGWEED_ROUTER_PACKET_PARSER
+ bool "Enable the Pigweed router packet parser library (pw_router.packet_parser)"
+ select PIGWEED_BYTES
+
+config PIGWEED_ROUTER_EGRESS_FUNCTION
+ bool "Enable the Pigweed router egress function library (pw_router.egress_function)"
+ select PIGWEED_RPC_EGRESS
+
+endif # PIGWEED_ROUTER
diff --git a/pw_router/docs.rst b/pw_router/docs.rst
index 8788826b1..3ce051c9a 100644
--- a/pw_router/docs.rst
+++ b/pw_router/docs.rst
@@ -68,3 +68,17 @@ Usage example
.. ``PacketParser`` implementation and a single route using an ``EgressFunction``.
.. .. include:: static_router_size
+
+Zephyr
+======
+To enable ``pw_router.*`` for Zephyr add ``CONFIG_PIGWEED_ROUTER=y`` to the
+project's configuration. This will enable the Kconfig menu for the following:
+
+* ``pw_router.static_router`` which can be enabled via
+ ``CONFIG_PIGWEED_ROUTER_STATIC_ROUTER=y``.
+* ``pw_router.egress`` which can be enabled via
+ ``CONFIG_PIGWEED_ROUTER_EGRESS=y``.
+* ``pw_router.packet_parser`` which can be enabled via
+ ``CONFIG_PIGWEED_ROUTER_PACKET_PARSER=y``.
+* ``pw_router.egress_function`` which can be enabled via
+ ``CONFIG_PIGWEED_ROUTER_EGRESS_FUNCTION=y``. \ No newline at end of file