Each module follows a similar design:
- Message channel: Each module defines its own zbus channel. With some exceptions, a single channel is used for all messages that are specific to a module.
- Message types: Each module exposes a set of input and output message types. These can be considered events in the state machine sense and might have associated data.
- State machine: Most modules implement a state machine using SMF to manage their internal state and behavior.
- Thread: Most modules have dedicated threads.
- Watchdog: A task watchdog monitors each module thread. Each thread periodically calls
task_wdt_feed()to feed its watchdog. If a thread fails to feed its watchdog within its configured timeout, the system resets. - Initialization: Modules are initialized at system startup, either through
SYS_INIT()or in their dedicated thread throughK_THREAD_DEFINE().