6#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_H_
7#define ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_H_
110#define LOG_BACKEND_DEFINE(_name, _api, _autostart, ...) \
111 static struct log_backend_control_block UTIL_CAT(backend_cb_, _name) = \
113 COND_CODE_0(NUM_VA_ARGS_LESS_1(_, ##__VA_ARGS__), \
114 (), (.ctx = __VA_ARGS__,)) \
118 static const STRUCT_SECTION_ITERABLE(log_backend, _name) = \
121 .cb = &UTIL_CAT(backend_cb_, _name), \
122 .name = STRINGIFY(_name), \
123 .autostart = _autostart \
139 __ASSERT_NO_MSG(backend != NULL);
158 __ASSERT_NO_MSG(backend != NULL);
178 __ASSERT_NO_MSG(backend != NULL);
179 __ASSERT_NO_MSG(msg != NULL);
194 __ASSERT_NO_MSG(backend != NULL);
208 __ASSERT_NO_MSG(backend != NULL);
223 __ASSERT_NO_MSG(backend != NULL);
237 __ASSERT_NO_MSG(backend != NULL);
238 return backend->
cb->
id;
280 __ASSERT_NO_MSG(backend != NULL);
281 backend->
cb->
ctx = ctx;
293 __ASSERT_NO_MSG(backend != NULL);
307 __ASSERT_NO_MSG(backend != NULL);
322 extern size_t log_format_table_size(
void);
324 if ((
size_t)log_type >= log_format_table_size()) {
332 if (backend == NULL) {
354 __ASSERT_NO_MSG(backend != NULL);
357 backend->
api->
notify(backend, event, arg);
#define STRUCT_SECTION_GET(struct_type, i, dst)
Get element from section.
Definition iterable_sections.h:282
#define STRUCT_SECTION_COUNT(struct_type, dst)
Count elements in a section.
Definition iterable_sections.h:291
static void log_backend_init(const struct log_backend *const backend)
Initialize or initiate the logging backend.
Definition log_backend.h:137
log_backend_evt
Backend events.
Definition log_backend.h:34
static void log_backend_deactivate(const struct log_backend *const backend)
Deactivate backend.
Definition log_backend.h:290
static void log_backend_msg_process(const struct log_backend *const backend, union log_msg_generic *msg)
Process message.
Definition log_backend.h:175
static void log_backend_activate(const struct log_backend *const backend, void *ctx)
Activate backend.
Definition log_backend.h:277
static bool log_backend_is_active(const struct log_backend *const backend)
Check state of the backend.
Definition log_backend.h:304
static void log_backend_id_set(const struct log_backend *const backend, uint8_t id)
Set backend id.
Definition log_backend.h:220
static void log_backend_dropped(const struct log_backend *const backend, uint32_t cnt)
Notify backend about dropped log messages.
Definition log_backend.h:191
static int log_backend_format_set(const struct log_backend *backend, uint32_t log_type)
Set logging format.
Definition log_backend.h:320
static int log_backend_count_get(void)
Get number of backends.
Definition log_backend.h:262
static void log_backend_panic(const struct log_backend *const backend)
Reconfigure backend to panic mode.
Definition log_backend.h:206
static uint8_t log_backend_id_get(const struct log_backend *const backend)
Get backend id.
Definition log_backend.h:235
static void log_backend_notify(const struct log_backend *const backend, enum log_backend_evt event, union log_backend_evt_arg *arg)
Notify a backend of an event.
Definition log_backend.h:350
static const struct log_backend * log_backend_get(uint32_t idx)
Get backend.
Definition log_backend.h:248
static int log_backend_is_ready(const struct log_backend *const backend)
Poll for backend readiness.
Definition log_backend.h:156
@ LOG_BACKEND_EVT_PROCESS_THREAD_DONE
Event when process thread finishes processing.
Definition log_backend.h:46
@ LOG_BACKEND_EVT_MAX
Maximum number of backend events.
Definition log_backend.h:49
log_format_func_t log_format_func_t_get(uint32_t log_type)
Declaration of the get routine for function pointer table format_table.
#define EINVAL
Invalid argument.
Definition errno.h:60
#define ENOTSUP
Unsupported value.
Definition errno.h:114
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Logger backend API.
Definition log_backend.h:63
void(* panic)(const struct log_backend *const backend)
Definition log_backend.h:68
void(* process)(const struct log_backend *const backend, union log_msg_generic *msg)
Definition log_backend.h:64
void(* notify)(const struct log_backend *const backend, enum log_backend_evt event, union log_backend_evt_arg *arg)
Definition log_backend.h:74
void(* dropped)(const struct log_backend *const backend, uint32_t cnt)
Definition log_backend.h:67
int(* is_ready)(const struct log_backend *const backend)
Definition log_backend.h:70
void(* init)(const struct log_backend *const backend)
Definition log_backend.h:69
int(* format_set)(const struct log_backend *const backend, uint32_t log_type)
Definition log_backend.h:71
Logger backend control block.
Definition log_backend.h:82
uint8_t id
Definition log_backend.h:84
bool active
Definition log_backend.h:85
uint8_t level
Definition log_backend.h:88
void * ctx
Definition log_backend.h:83
Logger backend structure.
Definition log_backend.h:94
const char * name
Definition log_backend.h:97
const struct log_backend_api * api
Definition log_backend.h:95
struct log_backend_control_block * cb
Definition log_backend.h:96
bool autostart
Definition log_backend.h:98
Argument(s) for backend events.
Definition log_backend.h:55
void * raw
Unspecified argument(s).
Definition log_backend.h:57