13#ifndef ZEPHYR_INCLUDE_SHELL_LOG_BACKEND_H_
14#define ZEPHYR_INCLUDE_SHELL_LOG_BACKEND_H_
58int z_shell_log_backend_output_func(
uint8_t *
data,
size_t length,
void *ctx);
75#ifdef CONFIG_SHELL_LOG_BACKEND
76#define Z_SHELL_LOG_BACKEND_DEFINE(_name, _buf, _size, _queue_size, _timeout) \
77 LOG_BACKEND_DEFINE(_name##_backend, log_backend_shell_api, false); \
78 LOG_OUTPUT_DEFINE(_name##_log_output, z_shell_log_backend_output_func,\
80 static struct shell_log_backend_control_block _name##_control_block; \
81 static uint32_t __aligned(Z_LOG_MSG_ALIGNMENT) \
82 _name##_buf[_queue_size / sizeof(uint32_t)]; \
83 const struct mpsc_pbuf_buffer_config _name##_mpsc_buffer_config = { \
85 .size = ARRAY_SIZE(_name##_buf), \
86 .notify_drop = NULL, \
87 .get_wlen = log_msg_generic_get_wlen, \
88 .flags = MPSC_PBUF_MODE_OVERWRITE, \
90 struct mpsc_pbuf_buffer _name##_mpsc_buffer; \
91 static const struct shell_log_backend _name##_log_backend = { \
92 .backend = &_name##_backend, \
93 .log_output = &_name##_log_output, \
94 .control_block = &_name##_control_block, \
95 .timeout = _timeout, \
96 .mpsc_buffer_config = &_name##_mpsc_buffer_config, \
97 .mpsc_buffer = &_name##_mpsc_buffer, \
100#define Z_SHELL_LOG_BACKEND_PTR(_name) (&_name##_log_backend)
102#define Z_SHELL_LOG_BACKEND_DEFINE(_name, _buf, _size, _queue_size, _timeout)
103#define Z_SHELL_LOG_BACKEND_PTR(_name) NULL
113 void *ctx,
uint32_t init_log_level);
long atomic_t
Definition atomic_types.h:15
const struct log_backend_api log_backend_shell_api
shell_log_backend_state
Shell log backend states.
Definition shell_log_backend.h:28
@ SHELL_LOG_BACKEND_UNINIT
Definition shell_log_backend.h:29
@ SHELL_LOG_BACKEND_PANIC
Definition shell_log_backend.h:32
@ SHELL_LOG_BACKEND_DISABLED
Definition shell_log_backend.h:31
@ SHELL_LOG_BACKEND_ENABLED
Definition shell_log_backend.h:30
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Logger backend API.
Definition log_backend.h:63
Logger backend structure.
Definition log_backend.h:95
uint8_t data[]
Definition log_msg.h:103
MPSC packet buffer configuration.
Definition mpsc_pbuf.h:131
MPSC packet buffer structure.
Definition mpsc_pbuf.h:90
Shell log backend control block (RW data).
Definition shell_log_backend.h:36
enum shell_log_backend_state state
Definition shell_log_backend.h:38
atomic_t dropped_cnt
Definition shell_log_backend.h:37
Shell log backend message structure.
Definition shell_log_backend.h:52
struct log_msg * msg
Definition shell_log_backend.h:53
uint32_t timestamp
Definition shell_log_backend.h:54
Shell log backend instance structure (RO data).
Definition shell_log_backend.h:42
uint32_t timeout
Definition shell_log_backend.h:46
struct mpsc_pbuf_buffer * mpsc_buffer
Definition shell_log_backend.h:48
const struct log_backend * backend
Definition shell_log_backend.h:43
const struct mpsc_pbuf_buffer_config * mpsc_buffer_config
Definition shell_log_backend.h:47
const struct log_output * log_output
Definition shell_log_backend.h:44
struct shell_log_backend_control_block * control_block
Definition shell_log_backend.h:45