Forward trace event to DMA buffer.

1. Ignore DMA trace event when forwarding for avoiding dead lock
because DMA tracing uses DMA API to copy trace event.
2. Add _trace_error() API to send error event by mail box at the same
time too when copying error event by DMA.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
This commit is contained in:
Yan Wang 2017-10-12 16:35:36 +08:00 committed by Liam Girdwood
parent ec2ab38591
commit 58e952db33
2 changed files with 30 additions and 2 deletions

View File

@ -94,6 +94,7 @@
#define TRACEE 1
void _trace_event(uint32_t event);
void _trace_error(uint32_t event);
void trace_off(void);
void trace_init(struct reef * reef);
@ -117,7 +118,8 @@ void trace_init(struct reef * reef);
/* error tracing */
#if TRACEE
#define trace_error(__c, __e) trace_event(__c, __e)
#define trace_error(__c, __e) \
_trace_error(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2])
#else
#define trace_error(__c, __e)
#endif

View File

@ -34,6 +34,7 @@
#include <arch/cache.h>
#include <platform/timer.h>
#include <reef/lock.h>
#include <reef/audio/dma-trace.h>
#include <stdint.h>
struct trace {
@ -44,7 +45,7 @@ struct trace {
static struct trace trace;
void _trace_event(uint32_t event)
void _trace_error(uint32_t event)
{
unsigned long flags;
volatile uint32_t *t;
@ -52,6 +53,10 @@ void _trace_event(uint32_t event)
if (!trace.enable)
return;
/* save event to DMA tracing buffer */
_trace_event(event);
/* send event by mail box too. */
spin_lock_irq(&trace.lock, flags);
/* write timestamp and event to trace buffer */
@ -70,6 +75,27 @@ void _trace_event(uint32_t event)
spin_unlock_irq(&trace.lock, flags);
}
void _trace_event(uint32_t event)
{
unsigned long flags;
volatile uint64_t dt[2];
volatile uint32_t et = (event & 0xff000000);
if (!trace.enable)
return;
if (et == TRACE_CLASS_DMA)
return;
spin_lock_irq(&trace.lock, flags);
dt[0] = platform_timer_get(platform_timer);
dt[1] = event;
dtrace_event((const char*)dt, sizeof(uint64_t) * 2);
spin_unlock_irq(&trace.lock, flags);
}
void trace_off(void)
{
trace.enable = 0;