dma-trace: Move log time delta from timer to dma_trace_buf struct.

Function platform_timer_set_delta was replaced with generic
clock_ns_to_ticks. Moved log time delta value from timer structure to the
dma_trace_buf.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
This commit is contained in:
Adrian Warecki 2022-03-11 13:23:55 +01:00 committed by Liam Girdwood
parent 3cbab7ad5b
commit e0e8980eb1
6 changed files with 11 additions and 26 deletions

View File

@ -64,8 +64,6 @@ uint64_t clock_ns_to_ticks(int clock, uint64_t ns);
uint64_t clock_ticks_per_sample(int clock, uint32_t sample_rate);
void platform_timer_set_delta(struct timer *timer, uint64_t ns);
static inline struct clock_info *clocks_get(void)
{
return sof_get()->clocks;

View File

@ -42,11 +42,12 @@ struct dma_trace_data {
uint32_t copy_in_progress;
uint32_t stream_tag;
uint32_t active_stream_tag;
uint32_t dma_copy_align; /**< Minimal chunk of data possible to be
* copied by dma connected to host
*/
uint32_t dropped_entries; /* amount of dropped entries */
struct k_spinlock lock; /* dma trace lock */
uint32_t dma_copy_align; /* Minimal chunk of data possible to be
* copied by dma connected to host
*/
uint32_t dropped_entries; /* amount of dropped entries */
struct k_spinlock lock; /* dma trace lock */
uint64_t time_delta; /* difference between the host time */
};
int dma_trace_init_early(struct sof *sof);

View File

@ -820,9 +820,10 @@ static int ipc_dma_trace_config(uint32_t header)
* "SOF_IPC_TRACE_DMA_PARAMS_EXT" in your particular
* kernel version.
*/
platform_timer_set_delta(timer, params.timestamp_ns);
dmat->time_delta = clock_ns_to_ticks(PLATFORM_DEFAULT_CLOCK, params.timestamp_ns) -
platform_timer_get(timer);
else
timer->delta = 0;
dmat->time_delta = 0;
#if CONFIG_HOST_PTABLE
err = ipc_process_host_buffer(ipc, &params.buffer,

View File

@ -138,15 +138,3 @@ uint64_t clock_ticks_per_sample(int clock, uint32_t sample_rate)
return ticks_per_sample;
}
void platform_timer_set_delta(struct timer *timer, uint64_t ns)
{
struct clock_info *clk_info = clocks_get() + PLATFORM_DEFAULT_CLOCK;
uint32_t ticks_per_msec =
clk_info->freqs[clk_info->current_freq_idx].ticks_per_msec;
uint64_t ticks;
ticks = ticks_per_msec * ns / 1000000;
timer->delta = ticks - platform_timer_get(timer);
}

View File

@ -16,5 +16,3 @@ uint64_t clock_ns_to_ticks(int clock, uint64_t ns)
{
return 0;
}
void platform_timer_set_delta(struct timer *timer, uint64_t ns) {}

View File

@ -74,9 +74,9 @@ static void put_header(void *dst, const struct sof_uuid_entry *uid,
uint32_t id_1, uint32_t id_2,
uint32_t entry, uint64_t timestamp)
{
struct timer *timer = timer_get();
struct dma_trace_data *trace_data = dma_trace_data_get();
/* Support very early tracing */
uint64_t delta = timer ? timer->delta : 0;
uint64_t delta = dma_trace_initialized(trace_data) ? trace_data->time_delta : 0;
struct log_entry_header header;
int ret;
@ -89,7 +89,6 @@ static void put_header(void *dst, const struct sof_uuid_entry *uid,
ret = memcpy_s(dst, sizeof(header), &header, sizeof(header));
assert(!ret);
}
#ifndef __ZEPHYR__