logging: Add backend parameter to the init function
Added backend parameter to the backend init interface function. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
85b6a28f7d
commit
7e125fe7e4
10 changed files with 11 additions and 10 deletions
|
@ -40,7 +40,7 @@ struct log_backend_api {
|
||||||
|
|
||||||
void (*dropped)(const struct log_backend *const backend, uint32_t cnt);
|
void (*dropped)(const struct log_backend *const backend, uint32_t cnt);
|
||||||
void (*panic)(const struct log_backend *const backend);
|
void (*panic)(const struct log_backend *const backend);
|
||||||
void (*init)(void);
|
void (*init)(const struct log_backend *const backend);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,7 +36,7 @@ void main(void)
|
||||||
|
|
||||||
if (!log_backend_is_active(backend)) {
|
if (!log_backend_is_active(backend)) {
|
||||||
if (backend->api->init != NULL) {
|
if (backend->api->init != NULL) {
|
||||||
backend->api->init();
|
backend->api->init(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_backend_activate(backend, NULL);
|
log_backend_activate(backend, NULL);
|
||||||
|
|
|
@ -305,7 +305,7 @@ static void monitor_log_panic(const struct log_backend *const backend)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monitor_log_init(void)
|
static void monitor_log_init(const struct log_backend *const backend)
|
||||||
{
|
{
|
||||||
log_set_timestamp_func(monitor_ts_get, MONITOR_TS_FREQ);
|
log_set_timestamp_func(monitor_ts_get, MONITOR_TS_FREQ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,8 +194,9 @@ static void send_output(const struct log_backend *const backend,
|
||||||
log_msg_put(msg);
|
log_msg_put(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_net(void)
|
static void init_net(struct log_backend const *const backend)
|
||||||
{
|
{
|
||||||
|
ARG_UNUSED(backend);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
net_sin(&server_addr)->sin_port = htons(514);
|
net_sin(&server_addr)->sin_port = htons(514);
|
||||||
|
|
|
@ -250,7 +250,7 @@ static void log_backend_rtt_cfg(void)
|
||||||
SEGGER_RTT_MODE_NO_BLOCK_SKIP);
|
SEGGER_RTT_MODE_NO_BLOCK_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_backend_rtt_init(void)
|
static void log_backend_rtt_init(struct log_backend const *const backend)
|
||||||
{
|
{
|
||||||
if (CONFIG_LOG_BACKEND_RTT_BUFFER > 0) {
|
if (CONFIG_LOG_BACKEND_RTT_BUFFER > 0) {
|
||||||
log_backend_rtt_cfg();
|
log_backend_rtt_cfg();
|
||||||
|
|
|
@ -62,7 +62,7 @@ static void sync_hexdump(const struct log_backend *const backend,
|
||||||
timestamp, metadata, data, length);
|
timestamp, metadata, data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_backend_spinel_init(void)
|
static void log_backend_spinel_init(struct log_backend const *const backend)
|
||||||
{
|
{
|
||||||
memset(char_buf, '\0', sizeof(char_buf));
|
memset(char_buf, '\0', sizeof(char_buf));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ static void log_backend_swo_put(const struct log_backend *const backend,
|
||||||
log_backend_std_put(&log_output_swo, flag, msg);
|
log_backend_std_put(&log_output_swo, flag, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_backend_swo_init(void)
|
static void log_backend_swo_init(struct log_backend const *const backend)
|
||||||
{
|
{
|
||||||
/* Enable DWT and ITM units */
|
/* Enable DWT and ITM units */
|
||||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||||
|
|
|
@ -39,7 +39,7 @@ static void put(const struct log_backend *const backend,
|
||||||
log_backend_std_put(&log_output_uart, flag, msg);
|
log_backend_std_put(&log_output_uart, flag, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_backend_uart_init(void)
|
static void log_backend_uart_init(struct log_backend const *const backend)
|
||||||
{
|
{
|
||||||
uart_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
|
uart_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
|
||||||
__ASSERT_NO_MSG((void *)uart_dev);
|
__ASSERT_NO_MSG((void *)uart_dev);
|
||||||
|
|
|
@ -544,7 +544,7 @@ void log_init(void)
|
||||||
|
|
||||||
if (backend->autostart) {
|
if (backend->autostart) {
|
||||||
if (backend->api->init != NULL) {
|
if (backend->api->init != NULL) {
|
||||||
backend->api->init();
|
backend->api->init(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_backend_enable(backend, NULL, CONFIG_LOG_MAX_LEVEL);
|
log_backend_enable(backend, NULL, CONFIG_LOG_MAX_LEVEL);
|
||||||
|
|
|
@ -473,7 +473,7 @@ int net_config_init_app(const struct device *dev, const char *app_info)
|
||||||
|
|
||||||
if (!log_backend_is_active(backend)) {
|
if (!log_backend_is_active(backend)) {
|
||||||
if (backend->api->init != NULL) {
|
if (backend->api->init != NULL) {
|
||||||
backend->api->init();
|
backend->api->init(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_backend_activate(backend, NULL);
|
log_backend_activate(backend, NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue