Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/include/ipc/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
#define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002)
#define SOF_IPC_TRACE_DMA_PARAMS_EXT SOF_CMD_TYPE(0x003)
#define SOF_IPC_TRACE_FILTER_UPDATE SOF_CMD_TYPE(0x004) /**< ABI3.17 */
#define SOF_IPC_TRACE_DMA_FREE SOF_CMD_TYPE(0x005) /**< ABI3.20 */

/** @} */

Expand Down
1 change: 1 addition & 0 deletions src/include/sof/trace/dma-trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ int dma_trace_host_buffer(struct dma_trace_data *d,
struct dma_sg_elem_array *elem_array,
uint32_t host_size);
int dma_trace_enable(struct dma_trace_data *d);
void dma_trace_disable(struct dma_trace_data *d);
void dma_trace_flush(void *destination);
void dma_trace_on(void);
void dma_trace_off(void);
Expand Down
13 changes: 13 additions & 0 deletions src/ipc/ipc3/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,17 @@ static int ipc_dma_trace_config(uint32_t header)
{
return 0;
}

static void ipc_dma_trace_free(uint32_t header) {}

#else
static void ipc_dma_trace_free(uint32_t header)
{
struct dma_trace_data *dmat = dma_trace_data_get();

dma_trace_disable(dmat);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we call this as dma_trace_free() to be consistent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it balances with trace_dma_enable during ipc_dma_trace_params() no?

}

static int ipc_dma_trace_config(uint32_t header)
{
#if CONFIG_HOST_PTABLE
Expand Down Expand Up @@ -872,6 +882,9 @@ static int ipc_glb_trace_message(uint32_t header)
case SOF_IPC_TRACE_DMA_PARAMS:
case SOF_IPC_TRACE_DMA_PARAMS_EXT:
return ipc_dma_trace_config(header);
case SOF_IPC_TRACE_DMA_FREE:
ipc_dma_trace_free(header);
return 0;
case SOF_IPC_TRACE_FILTER_UPDATE:
return ipc_trace_filter_update(header);
default:
Expand Down
15 changes: 15 additions & 0 deletions src/trace/dma-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,21 @@ int dma_trace_enable(struct dma_trace_data *d)
return err;
}

void dma_trace_disable(struct dma_trace_data *d)
{
/* cancel trace work */
schedule_task_cancel(&d->dmat_work);

if (d->dc.chan) {
dma_stop(d->dc.chan);
dma_channel_put(d->dc.chan);
d->dc.chan = NULL;
}

/* free trace buffer */
dma_trace_buffer_free(d);
}

/** Sends all pending DMA messages to mailbox (for emergencies) */
void dma_trace_flush(void *t)
{
Expand Down