From: Yan Wang yan.wang@linux.intel.com
1. Change trace data coping API for current trace event data including 64-bit timestamp. 2. Remove trace event of DMA tracing for avoiding dead lock. 3. If DMA tracing is ready, send event data when the data size is half full or the DMA tracing buffer arrive at the end. Otherwise, overwrite the data directly.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- src/audio/dma-trace.c | 22 ++++++++-------------- src/include/reef/audio/dma-trace.h | 3 ++- src/ipc/ipc.c | 1 + 3 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/src/audio/dma-trace.c b/src/audio/dma-trace.c index d725fcf..123853c 100644 --- a/src/audio/dma-trace.c +++ b/src/audio/dma-trace.c @@ -93,8 +93,6 @@ static void trace_send(struct dma_trace_data *d)
d->host_offset += size; buffer->r_ptr += size; - - trace_buffer("dts"); }
static uint64_t trace_work(void *data, uint64_t delay) @@ -150,24 +148,20 @@ int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, void dma_trace_config_ready(struct dma_trace_data *d) { work_schedule_default(&d->dmat_work, DMA_TRACE_US); + d->ready = 1; }
-void dtrace_event(char *e) +void dtrace_event(const char *e, uint32_t length) { struct dma_trace_buf *buffer = NULL; - int length = rstrlen(e); int margin = 0;
- if (trace_data == NULL || length < 1) { - trace_buffer_error("ele"); + if (trace_data == NULL || length < 1) return; - }
buffer = &trace_data->dmatb; - if (buffer == NULL) { - trace_buffer_error("ele"); + if (buffer == NULL) return; - }
margin = buffer->end_addr - buffer->w_ptr;
@@ -178,17 +172,17 @@ void dtrace_event(char *e) memcpy(buffer->w_ptr, e, margin); buffer->w_ptr += margin;
- trace_send(trace_data); + if(trace_data->ready) + trace_send(trace_data); + buffer->w_ptr = buffer->r_ptr = buffer->addr; bzero(buffer->addr, buffer->size);
memcpy(buffer->w_ptr, e + margin, length - margin); buffer->w_ptr += length -margin; - - trace_buffer("ebs"); }
length = buffer->w_ptr - buffer->r_ptr; - if (length >= (DMA_TRACE_LOCAL_SIZE / 2)) + if (trace_data->ready && length >= (DMA_TRACE_LOCAL_SIZE / 2)) trace_send(trace_data); } diff --git a/src/include/reef/audio/dma-trace.h b/src/include/reef/audio/dma-trace.h index 9ee88a0..438fd2f 100644 --- a/src/include/reef/audio/dma-trace.h +++ b/src/include/reef/audio/dma-trace.h @@ -57,6 +57,7 @@ struct dma_trace_data { int32_t host_offset; uint32_t host_size; struct work dmat_work; + uint32_t ready; };
int dma_trace_init(struct dma_trace_data *d); @@ -64,6 +65,6 @@ int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, uint32_t host_size); void dma_trace_config_ready(struct dma_trace_data *d);
-void dtrace_event(char *e); +void dtrace_event(const char *e, uint32_t size);
#endif diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c index 6c40d10..05de838 100644 --- a/src/ipc/ipc.c +++ b/src/ipc/ipc.c @@ -350,6 +350,7 @@ int ipc_init(struct reef *reef) /* init ipc data */ reef->ipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*reef->ipc)); reef->ipc->comp_data = rzalloc(RZONE_SYS, RFLAGS_NONE, SOF_IPC_MSG_MAX_SIZE); + reef->ipc->dmat.ready = 0;
list_init(&reef->ipc->comp_list);