logger: Simplify UART backend initialization
Move definition to sources of UART backend. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
94bae6a462
commit
8fc5fd55de
3 changed files with 4 additions and 40 deletions
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_UART_H_
|
||||
#define ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_UART_H_
|
||||
|
||||
#include <logging/log_backend.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const struct log_backend_api log_backend_uart_api;
|
||||
|
||||
/**
|
||||
* @brief UART backend definition
|
||||
*
|
||||
* @param _name Name of the instance.
|
||||
*/
|
||||
#define LOG_BACKEND_UART_DEFINE(_name) \
|
||||
LOG_BACKEND_DEFINE(_name, log_backend_uart_api)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void log_backend_uart_init(void);
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_UART_H_ */
|
|
@ -3,7 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <logging/log_backend_uart.h>
|
||||
|
||||
#include <logging/log_backend.h>
|
||||
#include <logging/log_core.h>
|
||||
#include <logging/log_msg.h>
|
||||
#include <logging/log_output.h>
|
||||
|
@ -66,3 +67,5 @@ const struct log_backend_api log_backend_uart_api = {
|
|||
.panic = panic,
|
||||
.init = log_backend_uart_init,
|
||||
};
|
||||
|
||||
LOG_BACKEND_DEFINE(log_backend_uart, log_backend_uart_api);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <logging/log_backend.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
#include <logging/log_output.h>
|
||||
#include <logging/log_backend_uart.h>
|
||||
#include <misc/printk.h>
|
||||
#include <assert.h>
|
||||
#include <atomic.h>
|
||||
|
@ -18,13 +17,6 @@
|
|||
#define CONFIG_LOG_PRINTK_MAX_STRING_LENGTH 1
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LOG_BACKEND_UART
|
||||
LOG_BACKEND_UART_DEFINE(log_backend_uart);
|
||||
const struct log_backend *uart_backend = &log_backend_uart;
|
||||
#else
|
||||
const struct log_backend *uart_backend;
|
||||
#endif
|
||||
|
||||
static struct log_list_t list;
|
||||
static atomic_t initialized;
|
||||
static bool panic_mode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue