7#ifndef _MODULES_COMMON_H_
8#define _MODULES_COMMON_H_
14#include <zephyr/kernel.h>
34#define IS_EVENT(_ptr, _mod, _evt) \
35 is_ ## _mod ## _module_event(&_ptr->module._mod.header) && \
36 _ptr->module._mod.type == _evt
43#define SEND_EVENT(_mod, _type) \
44 struct _mod ## _module_event *event = new_ ## _mod ## _module_event(); \
45 __ASSERT(event, "Not enough heap left to allocate event"); \
46 event->type = _type; \
47 APP_EVENT_SUBMIT(event)
55#define SEND_ERROR(_mod, _type, _error_code) \
56 struct _mod ## _module_event *event = new_ ## _mod ## _module_event(); \
57 __ASSERT(event, "Not enough heap left to allocate event"); \
58 event->type = _type; \
59 event->data.err = _error_code; \
60 APP_EVENT_SUBMIT(event)
68#define SEND_SHUTDOWN_ACK(_mod, _type, _id) \
69 struct _mod ## _module_event *event = new_ ## _mod ## _module_event(); \
70 __ASSERT(event, "Not enough heap left to allocate event"); \
71 event->type = _type; \
72 event->data.id = _id; \
73 APP_EVENT_SUBMIT(event)
void module_purge_queue(struct module_data *module)
Purge a module's queue.
uint32_t module_active_count_get(void)
Get the number of active modules in the application.
bool modules_shutdown_register(uint32_t id_reg)
Register that a module has performed a graceful shutdown.
int module_enqueue_msg(struct module_data *module, void *msg)
Enqueue message to a module's queue.
int module_get_next_msg(struct module_data *module, void *msg)
Get the next message in a module's queue.
int module_start(struct module_data *module)
Register and start a module.
struct k_msgq * msg_q
Definition: modules_common.h:86
k_tid_t thread_id
Definition: modules_common.h:82
uint32_t id
Definition: modules_common.h:80
char * name
Definition: modules_common.h:84
sys_snode_t header
Definition: modules_common.h:78
bool supports_shutdown
Definition: modules_common.h:88
Structure that contains module metadata.
Definition: modules_common.h:76