Lines Matching full:zbus
3 Zephyr bus (zbus)
9 https://www.figma.com/community/file/1292866458780627559/zbus-diagram-assets
12 The :dfn:`Zephyr bus - zbus` is a lightweight and flexible software bus enabling a simple way for
21 Threads can send messages to one or more observers using zbus. It makes the many-to-many
25 The communication through zbus is channel-based. Threads (or callbacks) use channels to exchange
31 The figure below shows an example of a typical application using zbus in which the application logic
33 from each other because they only use zbus channels and do not need to know each other to talk.
37 :alt: zbus usage overview
40 A typical zbus application architecture.
53 :alt: ZBus anatomy
56 ZBus anatomy.
62 Another essential aspect of zbus is the observers. There are three types of observers:
65 :alt: ZBus observers type
68 ZBus observers.
86 :alt: ZBus observation mask.
89 ZBus observation mask.
114 :alt: ZBus sensor-based application
117 ZBus sensor-based application.
124 block of the image. Based on that, there is a sign zbus promotes decoupling in the system
127 Another important aspect of using zbus is the reuse of system modules. If a code portion with
128 well-defined behaviors (we call that module) only uses zbus channels and not hardware interfaces, it
130 channels) the module needs to work. That indicates zbus could improve the module reuse.
132 The last important note is the zbus solution reach. We can count on many ways of using zbus to
138 the solutions that can be done with zbus and make it a good fit as an open-source community tool.
167 :alt: ZBus example scenario
170 ZBus VDED execution example scenario.
194 :alt: ZBus publish processing detail
197 ZBus VDED execution detail for priority T1 > MS1 > MS2 > S1.
257 :alt: ZBus publish processing detail
260 ZBus VDED execution detail for priority T1 < MS1 < MS2 < S1.
304 ZBus implements the Highest Locker Protocol that relies on the observers' thread priority to
315 ZBus priority boost does not consider runtime observers on the HOP calculations.
322 :alt: ZBus publishing process details using priority boost.
325 ZBus VDED execution detail with priority boost enabled and for priority T1 < MS1 < MS2 < S1.
363 * The HLP is more effective for zbus than the mutexes priority inheritance;
370 * ZBus operations can be used inside ISRs;
374 acceptable in the zbus scenario since it will ensure a small bus latency.
380 Based on the fact that developers can use zbus to solve many different problems, some challenges
381 arise. ZBus will not solve every problem, so it is necessary to analyze the situation to be sure
382 zbus is applicable. For instance, based on the zbus benchmark, it would not be well suited to a
389 ZBus always delivers the messages to the listeners and message subscribers. However, there are no
390 message delivery guarantees for subscribers because zbus only sends the notification, but the
401 ZBus uses :zephyr_file:`include/zephyr/net_buf.h` (network buffers) to exchange data with message
408 at the :zephyr:code-sample:`zbus-msg-subscriber` to see the isolation in action.
437 ZBus operation depends on channels and observers. Therefore, it is necessary to determine its
560 The following sections describe in detail how to use zbus features.
568 Messages are published to a channel in zbus by calling :c:func:`zbus_chan_pub`. For example, the
587 Messages are read from a channel in zbus by calling :c:func:`zbus_chan_read`. So, for example, the
610 It is possible to force zbus to notify a channel's observers by calling :c:func:`zbus_chan_notify`.
627 words, zbus channel definitions and declarations with the same channel names in different files
642 ZBus subsystem also implements :ref:`Iterable Sections <iterable_sections_api>` for channels and
648 Sections <iterable_sections_api>` documentation for details). ZBus also implements this feature for
733 ZBus was designed to be as flexible and extensible as possible. Thus, there are some features
777 Never change the fields of the channel struct directly. It may cause zbus behavior
824 nodes dynamically. The heap size limits the number of dynamic observers zbus can create. Therefore,
846 For a complete overview of zbus usage, take a look at the samples. There are the following samples
849 * :zephyr:code-sample:`zbus-hello-world` illustrates the code used above in action;
850 * :zephyr:code-sample:`zbus-work-queue` shows how to define and use different kinds of observers.
853 * :zephyr:code-sample:`zbus-msg-subscriber` illustrates how to use message subscribers;
854 * :zephyr:code-sample:`zbus-dyn-channel` demonstrates how to use dynamically allocated exchanging
855 data in zbus;
856 * :zephyr:code-sample:`zbus-uart-bridge` shows an example of sending the operation of the channel to
858 * :zephyr:code-sample:`zbus-remote-mock` illustrates how to implement an external mock (on the host)
860 * :zephyr:code-sample:`zbus-priority-boost` illustrates zbus priority boost feature with a priority
862 * :zephyr:code-sample:`zbus-runtime-obs-registration` illustrates a way of using the runtime
864 * :zephyr:code-sample:`zbus-confirmed-channel` implements a way of implement confirmed channel only
866 * :zephyr:code-sample:`zbus-benchmark` implements a benchmark with different combinations of inputs.
871 Use zbus to transfer data (messages) between threads in one-to-one, one-to-many, and many-to-many
879 ZBus can be used to transfer streams from the producer to the consumer. However, this can
880 increase zbus' communication latency. So maybe consider a Pipe a good alternative for this
886 For enabling zbus, it is necessary to enable the :kconfig:option:`CONFIG_ZBUS` option.
890 * :kconfig:option:`CONFIG_ZBUS_PRIORITY_BOOST` zbus Highest Locker Protocol implementation;
892 priority used by zbus to organize the channels observations by channel;
906 * :kconfig:option:`CONFIG_ZBUS_MSG_SUBSCRIBER_NET_BUF_STATIC_DATA_SIZE` the biggest message of zbus