Lines Matching refs:buf_idx
177 unsigned buf_idx = shm->area->read_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_get_readable_frames() local
184 shm->area->read_offset[buf_idx]); in cras_shm_get_readable_frames()
187 shm->area->write_offset[buf_idx]); in cras_shm_get_readable_frames()
192 buf_idx = (buf_idx + 1) & CRAS_SHM_BUFFERS_MASK; in cras_shm_get_readable_frames()
194 shm, shm->area->write_offset[buf_idx]); in cras_shm_get_readable_frames()
202 return cras_shm_buff_for_idx(shm, buf_idx) + final_offset; in cras_shm_get_readable_frames()
239 size_t buf_idx = shm->area->read_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_get_frames_in_curr_buffer() local
243 read_offset = MIN(shm->area->read_offset[buf_idx], used_size); in cras_shm_get_frames_in_curr_buffer()
244 write_offset = MIN(shm->area->write_offset[buf_idx], used_size); in cras_shm_get_frames_in_curr_buffer()
255 size_t buf_idx = shm->area->write_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_is_buffer_available() local
257 return (shm->area->write_offset[buf_idx] == 0); in cras_shm_is_buffer_available()
298 size_t buf_idx = shm->area->write_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_written() local
303 shm->area->write_offset[buf_idx] += frames * shm->config.frame_bytes; in cras_shm_buffer_written()
304 shm->area->read_offset[buf_idx] = 0; in cras_shm_buffer_written()
311 size_t buf_idx = shm->area->write_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_frames_written() local
313 return shm->area->write_offset[buf_idx] / shm->config.frame_bytes; in cras_shm_frames_written()
319 size_t buf_idx = shm->area->write_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_write_complete() local
321 shm->area->write_in_progress[buf_idx] = 0; in cras_shm_buffer_write_complete()
324 buf_idx = (buf_idx + 1) & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_write_complete()
325 shm->area->write_buf_idx = buf_idx; in cras_shm_buffer_write_complete()
332 size_t buf_idx = shm->area->write_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_written_start() local
334 shm->area->write_offset[buf_idx] = frames * shm->config.frame_bytes; in cras_shm_buffer_written_start()
335 shm->area->read_offset[buf_idx] = 0; in cras_shm_buffer_written_start()
344 size_t buf_idx = shm->area->read_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_read() local
352 area->read_offset[buf_idx] += frames * config->frame_bytes; in cras_shm_buffer_read()
353 if (area->read_offset[buf_idx] >= area->write_offset[buf_idx]) { in cras_shm_buffer_read()
354 remainder = area->read_offset[buf_idx] - in cras_shm_buffer_read()
355 area->write_offset[buf_idx]; in cras_shm_buffer_read()
356 area->read_offset[buf_idx] = 0; in cras_shm_buffer_read()
357 area->write_offset[buf_idx] = 0; in cras_shm_buffer_read()
359 buf_idx = (buf_idx + 1) & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_read()
360 if (remainder < area->write_offset[buf_idx]) { in cras_shm_buffer_read()
361 area->read_offset[buf_idx] = remainder; in cras_shm_buffer_read()
364 area->write_offset[buf_idx] = 0; in cras_shm_buffer_read()
365 buf_idx = (buf_idx + 1) & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_read()
367 area->read_buf_idx = buf_idx; in cras_shm_buffer_read()
376 size_t buf_idx = shm->area->read_buf_idx & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_read_current() local
380 area->read_offset[buf_idx] += frames * config->frame_bytes; in cras_shm_buffer_read_current()
381 if (area->read_offset[buf_idx] >= area->write_offset[buf_idx]) { in cras_shm_buffer_read_current()
382 area->read_offset[buf_idx] = 0; in cras_shm_buffer_read_current()
383 area->write_offset[buf_idx] = 0; in cras_shm_buffer_read_current()
384 buf_idx = (buf_idx + 1) & CRAS_SHM_BUFFERS_MASK; in cras_shm_buffer_read_current()
385 area->read_buf_idx = buf_idx; in cras_shm_buffer_read_current()