[Sound-open-firmware] [PATCH v2] dma-trace: add build condition for dma trace
Only compile dma-trace.c when BUILD_DMA_TRACE is true.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com Acked-by: Yan Wang yan.wang@linux.intel.com --- configure.ac | 2 ++ src/lib/Makefile.am | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 86d19cb..44ede24 100644 --- a/configure.ac +++ b/configure.ac @@ -132,6 +132,8 @@ AS_IF([test "x$enable_dma_trace" != "xno"], [ AC_DEFINE([CONFIG_DMA_TRACE], [1], [Configure DMA trace]) ])
+AM_CONDITIONAL(BUILD_DMA_TRACE, test "x$enable_dma_trace" != "xno") + # Test after CFLAGS set othewise test of cross compiler fails. AM_PROG_AS AM_PROG_AR diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 5a6dfbf..0a566d0 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -6,10 +6,14 @@ libcore_a_SOURCES = \ work.c \ notifier.c \ trace.c \ - dma-trace.c \ schedule.c \ agent.c
+if BUILD_DMA_TRACE +libcore_a_SOURCES += \ + dma-trace.c +endif + libcore_a_CFLAGS = \ $(ARCH_CFLAGS) \ $(ARCH_INCDIR) \
CONFIG_DMA_TRACE is selected by default. But we should not do dma trace when CONFIG_DMA_TRACE is not selected (--disable-dma-trace is added to configure command line), here add this judgement to fix compiling issue for that dma trace is not selected.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com Acked-by: Yan Wang yan.wang@linux.intel.com --- src/lib/trace.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/src/lib/trace.c b/src/lib/trace.c index bb81d47..859bc0e 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -49,7 +49,9 @@ void _trace_error(uint32_t event) { unsigned long flags; volatile uint64_t *t; +#if defined(CONFIG_DMA_TRACE) uint64_t dt[2]; +#endif uint64_t time;
if (!trace.enable) @@ -57,10 +59,12 @@ void _trace_error(uint32_t event)
time = platform_timer_get(platform_timer);
+#if defined(CONFIG_DMA_TRACE) /* save event to DMA tracing buffer */ dt[0] = time; dt[1] = event; dtrace_event((const char*)dt, sizeof(uint64_t) * 2); +#endif
/* send event by mail box too. */ spin_lock_irq(&trace.lock, flags); @@ -84,7 +88,9 @@ void _trace_error(uint32_t event) void _trace_error_atomic(uint32_t event) { volatile uint64_t *t; +#if defined(CONFIG_DMA_TRACE) uint64_t dt[2]; +#endif uint64_t time;
if (!trace.enable) @@ -92,10 +98,12 @@ void _trace_error_atomic(uint32_t event)
time = platform_timer_get(platform_timer);
+#if defined(CONFIG_DMA_TRACE) /* save event to DMA tracing buffer */ dt[0] = time; dt[1] = event; dtrace_event_atomic((const char*)dt, sizeof(uint64_t) * 2); +#endif
/* write timestamp and event to trace buffer */ t = (volatile uint64_t*)(MAILBOX_TRACE_BASE + trace.pos);
On Fri, 2017-12-22 at 23:10 +0800, Keyon Jie wrote:
CONFIG_DMA_TRACE is selected by default. But we should not do dma trace when CONFIG_DMA_TRACE is not selected (--disable-dma-trace is added to configure command line), here add this judgement to fix compiling issue for that dma trace is not selected.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com Acked-by: Yan Wang yan.wang@linux.intel.com
Both applied.
Thanks
Liam
participants (2)
-
Keyon Jie
-
Liam Girdwood