Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions src/include/sof/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,7 @@ void mtrace_event(const char *complete_packet, uint32_t length);
}

#ifdef CONFIG_TRACEM /* Send everything to shared memory too */
# ifdef __ZEPHYR__
/* We don't use Zephyr's dictionary yet so there's not enough space for
* DEBUG messages
*/
# define MTRACE_DUPLICATION_LEVEL LOG_LEVEL_INFO
# else
# define MTRACE_DUPLICATION_LEVEL LOG_LEVEL_DEBUG
# endif
# define MTRACE_DUPLICATION_LEVEL LOG_LEVEL_DEBUG
#else /* copy only ERRORS */
# define MTRACE_DUPLICATION_LEVEL LOG_LEVEL_ERROR
#endif /* CONFIG_TRACEM */
Expand Down Expand Up @@ -275,23 +268,7 @@ do { \
); \
_log_sofdict(log_func, atomic, &log_entry, ctx, lvl, id_1, id_2, \
META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__), ##__VA_ARGS__); \
_log_nodict(atomic, META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__), \
lvl, format, ##__VA_ARGS__); \
} while (0)

#ifdef __ZEPHYR__
/* Just like XTOS, only the most urgent messages go to limited
* shared memory.
*/
#define _log_nodict(atomic, arg_count, lvl, format, ...) \
do { \
if ((lvl) <= MTRACE_DUPLICATION_LEVEL) \
printk("%llu " format "\n", platform_timer_get(NULL), \
##__VA_ARGS__); \
} while (0)
#else
#define _log_nodict(atomic, n_args, lvl, format, ...)
#endif

#endif /* CONFIG_LIBRARY */

Expand Down
5 changes: 0 additions & 5 deletions src/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ static void put_header(void *dst, const struct sof_uuid_entry *uid,

}

#ifndef __ZEPHYR__
/** Ring buffer for the mailbox trace */
void mtrace_event(const char *data, uint32_t length)
{
Expand All @@ -111,7 +110,6 @@ void mtrace_event(const char *data, uint32_t length)
dcache_writeback_region(t + trace->pos, length);
trace->pos += length;
}
#endif /* __ZEPHYR__ */

#if CONFIG_TRACE_FILTERING_VERBOSITY
/**
Expand Down Expand Up @@ -550,14 +548,11 @@ void _log_sofdict(log_func_t sofdict_logf, bool atomic, const void *log_entry,
{
va_list ap;

#ifndef __ZEPHYR__ /* for Zephyr see _log_nodict() in trace.h */
if (lvl <= MTRACE_DUPLICATION_LEVEL) {
va_start(ap, arg_count);
mtrace_dict_entry_vl(atomic, (uint32_t)log_entry, arg_count, ap);
va_end(ap);
}
#endif

va_start(ap, arg_count);
sofdict_logf(atomic, log_entry, ctx, lvl, id_1, id_2, arg_count, ap);
va_end(ap);
Expand Down
20 changes: 15 additions & 5 deletions zephyr/include/sof/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ struct timer;
uint64_t platform_timer_get(struct timer *timer);

/*
* Override SOF mtrace_printf() macro for now to support Zephyr's shared
* memory logger. Note the DMA trace can be copied to the shared memory
* too thanks to CONFIG_TRACEM.
* Override SOF dictionary macros for now and let Zephyr take care of
* the physical log IO.
*/
#undef _log_message
#undef mtrace_printf

#if USE_PRINTK
Expand All @@ -38,8 +38,18 @@ uint64_t platform_timer_get(struct timer *timer);
printk("%llu: " format "\n", platform_timer_get(NULL), \
##__VA_ARGS__); \
} while (0)
#else
#error "TODO: Z_LOG()"
#define _log_message(log_func, atomic, level, comp_class, ctx, id1, id2, format, ...) \
do { \
if ((level) <= SOF_ZEPHYR_TRACE_LEVEL) \
printk("%llu: " format "\n", platform_timer_get(NULL), \
##__VA_ARGS__); \
} while (0)
#else /* not tested */
#define _log_message(log_func, atomic, level, comp_class, ctx, id1, id2, format, ...) \
do { \
Z_LOG(level, "%u: " format, (uint32_t)platform_timer_get(NULL), \
##__VA_ARGS__); \
} while (0)
#endif

#endif /* __INCLUDE_TRACE__ */