[Sound-open-firmware] [PATCH v2 4/4] Fix DMA host offset calculation and wrapper condition checking.
From: Yan Wang yan.wang@linux.intel.com
1. "size" should not be considered twice. 2. Change host_offset to uint32_t type. 3. size = min(hsize, lsize), so it is unncessary to check ">" for wrap local and host buffer.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- src/include/reef/dma-trace.h | 2 +- src/lib/dma-trace.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/include/reef/dma-trace.h b/src/include/reef/dma-trace.h index 12d0956..641a4dc 100644 --- a/src/include/reef/dma-trace.h +++ b/src/include/reef/dma-trace.h @@ -56,7 +56,7 @@ struct dma_trace_data { struct dma_sg_config config; struct dma_trace_buf dmatb; struct dma_copy dc; - int32_t host_offset; + uint32_t host_offset; uint32_t host_size; struct work dmat_work; uint32_t enabled; diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 5885037..763e955 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -90,12 +90,12 @@ static uint64_t trace_work(void *data, uint64_t delay)
/* update host pointer and check for wrap */ d->host_offset += size; - if (d->host_offset + size >= d->host_size) + if (d->host_offset == d->host_size) d->host_offset = 0;
/* update local pointer and check for wrap */ buffer->r_ptr += size; - if (buffer->r_ptr >= buffer->end_addr) + if (buffer->r_ptr == buffer->end_addr) buffer->r_ptr = buffer->addr;
out:
On Fri, 2017-11-10 at 14:09 +0800, yan.wang@linux.intel.com wrote:
From: Yan Wang yan.wang@linux.intel.com
- "size" should not be considered twice.
- Change host_offset to uint32_t type.
- size = min(hsize, lsize), so it is unncessary to check ">"
for wrap local and host buffer.
Signed-off-by: Yan Wang yan.wang@linux.intel.com
Applied.
Thanks
Liam
participants (2)
-
Liam Girdwood
-
yan.wang@linux.intel.com