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:
Krzysztof Chruscinski 2021-01-29 17:25:55 +01:00 committed by Anas Nashif
parent 85b6a28f7d
commit 7e125fe7e4
10 changed files with 11 additions and 10 deletions

View file

@ -40,7 +40,7 @@ struct log_backend_api {
void (*dropped)(const struct log_backend *const backend, uint32_t cnt);
void (*panic)(const struct log_backend *const backend);
void (*init)(void);
void (*init)(const struct log_backend *const backend);
};
/**

View file

@ -36,7 +36,7 @@ void main(void)
if (!log_backend_is_active(backend)) {
if (backend->api->init != NULL) {
backend->api->init();
backend->api->init(backend);
}
log_backend_activate(backend, NULL);

View file

@ -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);
}

View file

@ -194,8 +194,9 @@ static void send_output(const struct log_backend *const backend,
log_msg_put(msg);
}
static void init_net(void)
static void init_net(struct log_backend const *const backend)
{
ARG_UNUSED(backend);
int ret;
net_sin(&server_addr)->sin_port = htons(514);

View file

@ -250,7 +250,7 @@ static void log_backend_rtt_cfg(void)
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) {
log_backend_rtt_cfg();

View file

@ -62,7 +62,7 @@ static void sync_hexdump(const struct log_backend *const backend,
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));
}

View file

@ -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);
}
static void log_backend_swo_init(void)
static void log_backend_swo_init(struct log_backend const *const backend)
{
/* Enable DWT and ITM units */
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;

View file

@ -39,7 +39,7 @@ static void put(const struct log_backend *const backend,
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);
__ASSERT_NO_MSG((void *)uart_dev);

View file

@ -544,7 +544,7 @@ void log_init(void)
if (backend->autostart) {
if (backend->api->init != NULL) {
backend->api->init();
backend->api->init(backend);
}
log_backend_enable(backend, NULL, CONFIG_LOG_MAX_LEVEL);

View file

@ -473,7 +473,7 @@ int net_config_init_app(const struct device *dev, const char *app_info)
if (!log_backend_is_active(backend)) {
if (backend->api->init != NULL) {
backend->api->init();
backend->api->init(backend);
}
log_backend_activate(backend, NULL);