dma: Use generic function to update read/write pointers in stream

Usage of function from audio_stream component updates avail/free
fields. Moreover using generic function helps in maintaining code.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-07-10 10:35:00 +02:00 committed by Marcin Maka
parent 87574da19e
commit 131f0d4f17
1 changed files with 10 additions and 6 deletions

View File

@ -206,9 +206,11 @@ void dma_buffer_copy_from(struct comp_buffer *source, struct comp_buffer *sink,
buffer_writeback(sink, sink_bytes); buffer_writeback(sink, sink_bytes);
istream->r_ptr = (char *)istream->r_ptr + source_bytes; /*
istream->r_ptr = audio_stream_wrap(istream, istream->r_ptr); * consume istream using audio_stream API because this buffer doesn't
* appear in topology so notifier event is not needed
*/
audio_stream_consume(istream, source_bytes);
comp_update_buffer_produce(sink, sink_bytes); comp_update_buffer_produce(sink, sink_bytes);
} }
@ -229,8 +231,10 @@ void dma_buffer_copy_to(struct comp_buffer *source, struct comp_buffer *sink,
/* sink buffer contains data meant to copied to DMA */ /* sink buffer contains data meant to copied to DMA */
audio_stream_writeback(ostream, sink_bytes); audio_stream_writeback(ostream, sink_bytes);
ostream->w_ptr = (char *)ostream->w_ptr + sink_bytes; /*
ostream->w_ptr = audio_stream_wrap(ostream, ostream->w_ptr); * produce ostream using audio_stream API because this buffer doesn't
* appear in topology so notifier event is not needed
*/
audio_stream_produce(ostream, sink_bytes);
comp_update_buffer_consume(source, source_bytes); comp_update_buffer_consume(source, source_bytes);
} }