shell: internal api update: log backend
Add prefix z_ to internal functions and macros handling log backend. Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
parent
91b01ce703
commit
37e8d825bf
4 changed files with 37 additions and 36 deletions
|
@ -731,7 +731,7 @@ extern void z_shell_print_stream(const void *user_ctx, const char *data,
|
|||
static const struct shell _name; \
|
||||
static struct shell_ctx UTIL_CAT(_name, _ctx); \
|
||||
static uint8_t _name##_out_buffer[CONFIG_SHELL_PRINTF_BUFF_SIZE]; \
|
||||
SHELL_LOG_BACKEND_DEFINE(_name, _name##_out_buffer, \
|
||||
Z_SHELL_LOG_BACKEND_DEFINE(_name, _name##_out_buffer, \
|
||||
CONFIG_SHELL_PRINTF_BUFF_SIZE, \
|
||||
_log_queue_size, _log_timeout); \
|
||||
Z_SHELL_HISTORY_DEFINE(_name##_history, CONFIG_SHELL_HISTORY_BUFFER); \
|
||||
|
@ -751,7 +751,7 @@ extern void z_shell_print_stream(const void *user_ctx, const char *data,
|
|||
.shell_flag = _shell_flag, \
|
||||
.fprintf_ctx = &_name##_fprintf, \
|
||||
.stats = SHELL_STATS_PTR(_name), \
|
||||
.log_backend = SHELL_LOG_BACKEND_PTR(_name), \
|
||||
.log_backend = Z_SHELL_LOG_BACKEND_PTR(_name), \
|
||||
LOG_INSTANCE_PTR_INIT(log, shell, _name) \
|
||||
.thread_name = STRINGIFY(_name), \
|
||||
.thread = &_name##_thread, \
|
||||
|
|
|
@ -47,9 +47,9 @@ struct shell_log_backend_msg {
|
|||
};
|
||||
|
||||
/** @brief Prototype of function outputing processed data. */
|
||||
int shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx);
|
||||
int z_shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx);
|
||||
|
||||
/** @def SHELL_LOG_BACKEND_DEFINE
|
||||
/** @def Z_SHELL_LOG_BACKEND_DEFINE
|
||||
* @brief Macro for creating instance of shell log backend.
|
||||
*
|
||||
* @param _name Shell name.
|
||||
|
@ -59,31 +59,31 @@ int shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx);
|
|||
* @param _timeout Timeout in milliseconds for pending on queue full.
|
||||
* Message is dropped on timeout.
|
||||
*/
|
||||
/** @def SHELL_LOG_BACKEND_PTR
|
||||
/** @def Z_SHELL_LOG_BACKEND_PTR
|
||||
* @brief Macro for retrieving pointer to the instance of shell log backend.
|
||||
*
|
||||
* @param _name Shell name.
|
||||
*/
|
||||
#ifdef CONFIG_SHELL_LOG_BACKEND
|
||||
#define SHELL_LOG_BACKEND_DEFINE(_name, _buf, _size, _queue_size, _timeout) \
|
||||
LOG_BACKEND_DEFINE(_name##_backend, log_backend_shell_api, false); \
|
||||
K_MSGQ_DEFINE(_name##_msgq, sizeof(struct shell_log_backend_msg), \
|
||||
_queue_size, sizeof(void *)); \
|
||||
LOG_OUTPUT_DEFINE(_name##_log_output, shell_log_backend_output_func, \
|
||||
_buf, _size); \
|
||||
static struct shell_log_backend_control_block _name##_control_block; \
|
||||
static const struct shell_log_backend _name##_log_backend = { \
|
||||
.backend = &_name##_backend, \
|
||||
.msgq = &_name##_msgq, \
|
||||
.log_output = &_name##_log_output, \
|
||||
.control_block = &_name##_control_block, \
|
||||
.timeout = _timeout \
|
||||
#define Z_SHELL_LOG_BACKEND_DEFINE(_name, _buf, _size, _queue_size, _timeout) \
|
||||
LOG_BACKEND_DEFINE(_name##_backend, log_backend_shell_api, false); \
|
||||
K_MSGQ_DEFINE(_name##_msgq, sizeof(struct shell_log_backend_msg), \
|
||||
_queue_size, sizeof(void *)); \
|
||||
LOG_OUTPUT_DEFINE(_name##_log_output, z_shell_log_backend_output_func, \
|
||||
_buf, _size); \
|
||||
static struct shell_log_backend_control_block _name##_control_block; \
|
||||
static const struct shell_log_backend _name##_log_backend = { \
|
||||
.backend = &_name##_backend, \
|
||||
.msgq = &_name##_msgq, \
|
||||
.log_output = &_name##_log_output, \
|
||||
.control_block = &_name##_control_block, \
|
||||
.timeout = _timeout \
|
||||
}
|
||||
|
||||
#define SHELL_LOG_BACKEND_PTR(_name) (&_name##_log_backend)
|
||||
#define Z_SHELL_LOG_BACKEND_PTR(_name) (&_name##_log_backend)
|
||||
#else /* CONFIG_LOG */
|
||||
#define SHELL_LOG_BACKEND_DEFINE(_name, _buf, _size, _queue_size, _timeout)
|
||||
#define SHELL_LOG_BACKEND_PTR(_name) NULL
|
||||
#define Z_SHELL_LOG_BACKEND_DEFINE(_name, _buf, _size, _queue_size, _timeout)
|
||||
#define Z_SHELL_LOG_BACKEND_PTR(_name) NULL
|
||||
#endif /* CONFIG_LOG */
|
||||
|
||||
/** @brief Enable shell log backend.
|
||||
|
@ -92,14 +92,14 @@ int shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx);
|
|||
* @param ctx Pointer to shell instance.
|
||||
* @param init_log_level Initial log level set to all logging sources.
|
||||
*/
|
||||
void shell_log_backend_enable(const struct shell_log_backend *backend,
|
||||
void *ctx, uint32_t init_log_level);
|
||||
void z_shell_log_backend_enable(const struct shell_log_backend *backend,
|
||||
void *ctx, uint32_t init_log_level);
|
||||
|
||||
/** @brief Disable shell log backend.
|
||||
*
|
||||
* @param backend Shell log backend instance.
|
||||
*/
|
||||
void shell_log_backend_disable(const struct shell_log_backend *backend);
|
||||
void z_shell_log_backend_disable(const struct shell_log_backend *backend);
|
||||
|
||||
/** @brief Trigger processing of one log entry.
|
||||
*
|
||||
|
@ -107,7 +107,7 @@ void shell_log_backend_disable(const struct shell_log_backend *backend);
|
|||
*
|
||||
* @return True if message was processed, false if FIFO was empty
|
||||
*/
|
||||
bool shell_log_backend_process(const struct shell_log_backend *backend);
|
||||
bool z_shell_log_backend_process(const struct shell_log_backend *backend);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue