diff --git a/src/arch/xtensa/include/arch/timer.h b/src/arch/xtensa/include/arch/timer.h index e36df6ba1e01..be9ef0f0fab6 100644 --- a/src/arch/xtensa/include/arch/timer.h +++ b/src/arch/xtensa/include/arch/timer.h @@ -43,6 +43,7 @@ struct timer { uint32_t hitime; /* high end of 64bit timer */ uint32_t hitimeout; uint32_t lowtimeout; + uint64_t delta; }; /* internal API calls */ diff --git a/src/include/uapi/abi.h b/src/include/uapi/abi.h index 2bf11c03a6a4..5a08f4039497 100644 --- a/src/include/uapi/abi.h +++ b/src/include/uapi/abi.h @@ -52,7 +52,7 @@ /** \brief SOF ABI version major, minor and patch numbers */ #define SOF_ABI_MAJOR 3 -#define SOF_ABI_MINOR 6 +#define SOF_ABI_MINOR 7 #define SOF_ABI_PATCH 0 /** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */ diff --git a/src/include/uapi/ipc/header.h b/src/include/uapi/ipc/header.h index 915448c601d4..dce0f22e9884 100644 --- a/src/include/uapi/ipc/header.h +++ b/src/include/uapi/ipc/header.h @@ -169,6 +169,7 @@ #define SOF_IPC_TRACE_DMA_PARAMS SOF_CMD_TYPE(0x001) #define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002) +#define SOF_IPC_TRACE_DMA_PARAMS_EXT SOF_CMD_TYPE(0x003) /** @} */ diff --git a/src/include/uapi/ipc/trace.h b/src/include/uapi/ipc/trace.h index 06c9cef0b2a8..3a8ad8f5a4fc 100644 --- a/src/include/uapi/ipc/trace.h +++ b/src/include/uapi/ipc/trace.h @@ -49,12 +49,22 @@ #define SOF_TRACE_FILENAME_SIZE 32 /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */ +/* Deprecated - use sof_ipc_dma_trace_params_ext */ struct sof_ipc_dma_trace_params { struct sof_ipc_cmd_hdr hdr; struct sof_ipc_host_buffer buffer; uint32_t stream_tag; } __attribute__((packed)); +/* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS_EXT */ +struct sof_ipc_dma_trace_params_ext { + struct sof_ipc_cmd_hdr hdr; + struct sof_ipc_host_buffer buffer; + uint32_t stream_tag; + uint64_t timestamp; + uint32_t reserved[8]; +} __attribute__((packed)); + /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */ struct sof_ipc_dma_trace_posn { struct sof_ipc_reply rhdr; diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 21592893b867..ea6786139d09 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -719,12 +719,18 @@ static int ipc_dma_trace_config(uint32_t header) struct dma_sg_elem_array elem_array; uint32_t ring_size; #endif - struct sof_ipc_dma_trace_params params; + struct sof_ipc_dma_trace_params_ext params; int err; /* copy message with ABI safe method */ IPC_COPY_CMD(params, _ipc->comp_data); + if (iCS(header) == SOF_IPC_TRACE_DMA_PARAMS_EXT) + platform_timer->delta = params.timestamp - + platform_timer_get(platform_timer); + else + platform_timer->delta = 0; + #ifdef CONFIG_SUECREEK return 0; #endif @@ -806,6 +812,7 @@ static int ipc_glb_debug_message(uint32_t header) switch (cmd) { case SOF_IPC_TRACE_DMA_PARAMS: + case SOF_IPC_TRACE_DMA_PARAMS_EXT: return ipc_dma_trace_config(header); default: trace_ipc_error("ipc: unknown debug cmd 0x%x", cmd); diff --git a/src/lib/trace.c b/src/lib/trace.c index c49cddb5e655..1b367dc61ae5 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -71,7 +71,7 @@ static void put_header(uint32_t *dst, uint32_t id_0, uint32_t id_1, header.id_0 = id_0 & TRACE_ID_MASK; header.id_1 = id_1 & TRACE_ID_MASK; header.core_id = cpu_get_id(); - header.timestamp = timestamp; + header.timestamp = timestamp + platform_timer->delta; header.log_entry_address = entry; memcpy(dst, &header, sizeof(header));