logging: log_backend_swo: Add support for logging v2
Added support for logging v2 backend API for SWO backend. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
b2487e3c88
commit
0b79661cff
2 changed files with 12 additions and 4 deletions
|
@ -56,7 +56,6 @@ endif # LOG_BACKEND_UART
|
|||
config LOG_BACKEND_SWO
|
||||
bool "Enable Serial Wire Output (SWO) backend"
|
||||
depends on HAS_SWO
|
||||
depends on !LOG2
|
||||
help
|
||||
When enabled, backend will use SWO for logging.
|
||||
|
||||
|
|
|
@ -82,6 +82,14 @@ 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_process(const struct log_backend *const backend,
|
||||
union log_msg2_generic *msg)
|
||||
{
|
||||
uint32_t flags = log_backend_std_get_flags();
|
||||
|
||||
log_output_msg2_process(&log_output_swo, &msg->log, flags);
|
||||
}
|
||||
|
||||
static void log_backend_swo_init(struct log_backend const *const backend)
|
||||
{
|
||||
/* Enable DWT and ITM units */
|
||||
|
@ -144,10 +152,11 @@ static void log_backend_swo_sync_hexdump(
|
|||
}
|
||||
|
||||
const struct log_backend_api log_backend_swo_api = {
|
||||
.put = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ? NULL : log_backend_swo_put,
|
||||
.put_sync_string = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ?
|
||||
.process = IS_ENABLED(CONFIG_LOG2) ? log_backend_swo_process : NULL,
|
||||
.put = IS_ENABLED(CONFIG_LOG_MODE_DEFERRED) ? log_backend_swo_put : NULL,
|
||||
.put_sync_string = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ?
|
||||
log_backend_swo_sync_string : NULL,
|
||||
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ?
|
||||
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ?
|
||||
log_backend_swo_sync_hexdump : NULL,
|
||||
.panic = log_backend_swo_panic,
|
||||
.init = log_backend_swo_init,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue