mirror of https://github.com/thesofproject/sof.git
Modify API of DMA tracing for forwading trace to DMA buffer.
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>
This commit is contained in:
parent
1c6ecd0023
commit
ec2ab38591
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue