{
v_iter->total_bytes += by;
v_iter->buf_pos += by;
- v_iter->buf_pos %= bytes;
+ if (v_iter->buf_pos >= bytes)
+ v_iter->buf_pos %= bytes;
}
/*
u8 current_byte;
for (i = 0; i < v_iter->b_rw; i++) {
- current_byte = runtime->dma_area[buf_pos_n(v_iter, channels, i % channels)];
+ ch_num = i % channels;
+ current_byte = runtime->dma_area[buf_pos_n(v_iter, channels, ch_num)];
if (!current_byte)
break;
- ch_num = i % channels;
if (current_byte != patt_bufs[ch_num].buf[(v_iter->total_bytes / channels)
% patt_bufs[ch_num].len]) {
v_iter->is_buf_corrupted = true;
for (i = 0; i < v_iter->b_rw; i++) {
ch_num = i % channels;
- runtime->dma_area[buf_pos_n(v_iter, channels, i % channels)] =
+ runtime->dma_area[buf_pos_n(v_iter, channels, ch_num)] =
patt_bufs[ch_num].buf[(v_iter->total_bytes / channels)
% patt_bufs[ch_num].len];
inc_buf_pos(v_iter, 1, runtime->dma_bytes);