• Home
  • Raw
  • Download

Lines Matching refs:pcm

58 static void do_silence(snd_pcm_t *pcm)  in do_silence()  argument
60 snd_pcm_direct_t *dshare = pcm->private_data; in do_silence()
107 static void snd_pcm_dshare_sync_area(snd_pcm_t *pcm) in snd_pcm_dshare_sync_area() argument
109 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_sync_area()
115 size = pcm_frame_diff(dshare->appl_ptr, dshare->last_appl_ptr, pcm->boundary); in snd_pcm_dshare_sync_area()
133 src_areas = snd_pcm_mmap_areas(pcm); in snd_pcm_dshare_sync_area()
135 appl_ptr = dshare->last_appl_ptr % pcm->buffer_size; in snd_pcm_dshare_sync_area()
137 dshare->last_appl_ptr %= pcm->boundary; in snd_pcm_dshare_sync_area()
143 if (appl_ptr + transfer > pcm->buffer_size) in snd_pcm_dshare_sync_area()
144 transfer = pcm->buffer_size - appl_ptr; in snd_pcm_dshare_sync_area()
154 appl_ptr %= pcm->buffer_size; in snd_pcm_dshare_sync_area()
161 static int snd_pcm_dshare_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr) in snd_pcm_dshare_sync_ptr0() argument
163 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_sync_ptr0()
177 dshare->hw_ptr %= pcm->boundary; in snd_pcm_dshare_sync_ptr0()
179 if (pcm->stop_threshold >= pcm->boundary) /* don't care */ in snd_pcm_dshare_sync_ptr0()
181 avail = snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dshare_sync_ptr0()
184 if (avail >= pcm->stop_threshold) { in snd_pcm_dshare_sync_ptr0()
186 do_silence(pcm); in snd_pcm_dshare_sync_ptr0()
187 gettimestamp(&dshare->trigger_tstamp, pcm->tstamp_type); in snd_pcm_dshare_sync_ptr0()
199 static int snd_pcm_dshare_sync_ptr(snd_pcm_t *pcm) in snd_pcm_dshare_sync_ptr() argument
201 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_sync_ptr()
215 if (snd_pcm_direct_client_chk_xrun(dshare, pcm)) in snd_pcm_dshare_sync_ptr()
220 return snd_pcm_dshare_sync_ptr0(pcm, *dshare->spcm->hw.ptr); in snd_pcm_dshare_sync_ptr()
227 static snd_pcm_state_t snd_pcm_dshare_state(snd_pcm_t *pcm);
229 static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status) in snd_pcm_dshare_status() argument
231 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_status()
239 snd_pcm_dshare_sync_ptr0(pcm, status->hw_ptr); in snd_pcm_dshare_status()
240 status->delay += snd_pcm_mmap_playback_delay(pcm); in snd_pcm_dshare_status()
245 status->state = snd_pcm_dshare_state(pcm); in snd_pcm_dshare_status()
246 status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */ in snd_pcm_dshare_status()
247 status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */ in snd_pcm_dshare_status()
249 status->avail = snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dshare_status()
255 static snd_pcm_state_t snd_pcm_dshare_state(snd_pcm_t *pcm) in snd_pcm_dshare_state() argument
257 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_state()
273 snd_pcm_direct_client_chk_xrun(dshare, pcm); in snd_pcm_dshare_state()
279 static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) in snd_pcm_dshare_delay() argument
281 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_delay()
287 err = snd_pcm_dshare_sync_ptr(pcm); in snd_pcm_dshare_delay()
294 *delayp = snd_pcm_mmap_playback_delay(pcm); in snd_pcm_dshare_delay()
305 static int snd_pcm_dshare_hwsync(snd_pcm_t *pcm) in snd_pcm_dshare_hwsync() argument
307 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_hwsync()
312 return snd_pcm_dshare_sync_ptr(pcm); in snd_pcm_dshare_hwsync()
325 static int snd_pcm_dshare_reset(snd_pcm_t *pcm) in snd_pcm_dshare_reset() argument
327 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_reset()
328 dshare->hw_ptr %= pcm->period_size; in snd_pcm_dshare_reset()
331 snd_pcm_direct_reset_slave_ptr(pcm, dshare); in snd_pcm_dshare_reset()
335 static int snd_pcm_dshare_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dshare) in snd_pcm_dshare_start_timer() argument
341 snd_pcm_direct_reset_slave_ptr(pcm, dshare); in snd_pcm_dshare_start_timer()
349 static int snd_pcm_dshare_start(snd_pcm_t *pcm) in snd_pcm_dshare_start() argument
351 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_start()
357 avail = snd_pcm_mmap_playback_hw_avail(pcm); in snd_pcm_dshare_start()
363 err = snd_pcm_dshare_start_timer(pcm, dshare); in snd_pcm_dshare_start()
366 snd_pcm_dshare_sync_area(pcm); in snd_pcm_dshare_start()
368 gettimestamp(&dshare->trigger_tstamp, pcm->tstamp_type); in snd_pcm_dshare_start()
372 static int snd_pcm_dshare_drop(snd_pcm_t *pcm) in snd_pcm_dshare_drop() argument
374 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_drop()
379 do_silence(pcm); in snd_pcm_dshare_drop()
384 static int __snd_pcm_dshare_drain(snd_pcm_t *pcm) in __snd_pcm_dshare_drain() argument
386 snd_pcm_direct_t *dshare = pcm->private_data; in __snd_pcm_dshare_drain()
399 if (pcm->mode & SND_PCM_NONBLOCK) in __snd_pcm_dshare_drain()
402 if (snd_pcm_mmap_playback_hw_avail(pcm) > 0) in __snd_pcm_dshare_drain()
403 snd_pcm_dshare_start(pcm); in __snd_pcm_dshare_drain()
405 snd_pcm_dshare_drop(pcm); in __snd_pcm_dshare_drain()
411 snd_pcm_dshare_drop(pcm); in __snd_pcm_dshare_drain()
415 stop_threshold = pcm->stop_threshold; in __snd_pcm_dshare_drain()
416 if (pcm->stop_threshold > pcm->buffer_size) in __snd_pcm_dshare_drain()
417 pcm->stop_threshold = pcm->buffer_size; in __snd_pcm_dshare_drain()
420 err = snd_pcm_dshare_sync_ptr(pcm); in __snd_pcm_dshare_drain()
422 snd_pcm_dshare_drop(pcm); in __snd_pcm_dshare_drain()
426 snd_pcm_dshare_sync_area(pcm); in __snd_pcm_dshare_drain()
427 snd_pcm_wait_nocheck(pcm, -1); in __snd_pcm_dshare_drain()
438 pcm->stop_threshold = stop_threshold; in __snd_pcm_dshare_drain()
442 static int snd_pcm_dshare_drain(snd_pcm_t *pcm) in snd_pcm_dshare_drain() argument
446 snd_pcm_lock(pcm); in snd_pcm_dshare_drain()
447 err = __snd_pcm_dshare_drain(pcm); in snd_pcm_dshare_drain()
448 snd_pcm_unlock(pcm); in snd_pcm_dshare_drain()
452 static int snd_pcm_dshare_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIBUTE_UNUSED) in snd_pcm_dshare_pause()
457 static snd_pcm_sframes_t snd_pcm_dshare_rewindable(snd_pcm_t *pcm) in snd_pcm_dshare_rewindable() argument
459 return snd_pcm_mmap_playback_hw_rewindable(pcm); in snd_pcm_dshare_rewindable()
462 static snd_pcm_sframes_t snd_pcm_dshare_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) in snd_pcm_dshare_rewind() argument
466 avail = snd_pcm_dshare_rewindable(pcm); in snd_pcm_dshare_rewind()
469 snd_pcm_mmap_appl_backward(pcm, frames); in snd_pcm_dshare_rewind()
473 static snd_pcm_sframes_t snd_pcm_dshare_forwardable(snd_pcm_t *pcm) in snd_pcm_dshare_forwardable() argument
475 return snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dshare_forwardable()
478 static snd_pcm_sframes_t snd_pcm_dshare_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) in snd_pcm_dshare_forward() argument
482 avail = snd_pcm_dshare_forwardable(pcm); in snd_pcm_dshare_forward()
485 snd_pcm_mmap_appl_forward(pcm, frames); in snd_pcm_dshare_forward()
489 static snd_pcm_sframes_t snd_pcm_dshare_readi(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void *buffer ATTRIBU… in snd_pcm_dshare_readi()
494 static snd_pcm_sframes_t snd_pcm_dshare_readn(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void **bufs ATTRIBUT… in snd_pcm_dshare_readn()
499 static int snd_pcm_dshare_close(snd_pcm_t *pcm) in snd_pcm_dshare_close() argument
501 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_close()
506 do_silence(pcm); in snd_pcm_dshare_close()
520 pcm->private_data = NULL; in snd_pcm_dshare_close()
525 static snd_pcm_sframes_t snd_pcm_dshare_mmap_commit(snd_pcm_t *pcm, in snd_pcm_dshare_mmap_commit() argument
529 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_mmap_commit()
542 if (snd_pcm_direct_client_chk_xrun(dshare, pcm)) in snd_pcm_dshare_mmap_commit()
546 snd_pcm_mmap_appl_forward(pcm, size); in snd_pcm_dshare_mmap_commit()
548 err = snd_pcm_dshare_start_timer(pcm, dshare); in snd_pcm_dshare_mmap_commit()
553 if ((err = snd_pcm_dshare_sync_ptr(pcm)) < 0) in snd_pcm_dshare_mmap_commit()
560 snd_pcm_dshare_sync_area(pcm); in snd_pcm_dshare_mmap_commit()
562 if (snd_pcm_mmap_playback_avail(pcm) < pcm->avail_min) in snd_pcm_dshare_mmap_commit()
568 static snd_pcm_sframes_t snd_pcm_dshare_avail_update(snd_pcm_t *pcm) in snd_pcm_dshare_avail_update() argument
570 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_avail_update()
575 if ((err = snd_pcm_dshare_sync_ptr(pcm)) < 0) in snd_pcm_dshare_avail_update()
581 return snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dshare_avail_update()
584 static int snd_pcm_dshare_htimestamp(snd_pcm_t *pcm, in snd_pcm_dshare_htimestamp() argument
588 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_htimestamp()
595 snd_pcm_dshare_sync_ptr(pcm); in snd_pcm_dshare_htimestamp()
596 avail1 = snd_pcm_mmap_playback_avail(pcm); in snd_pcm_dshare_htimestamp()
606 static void snd_pcm_dshare_dump(snd_pcm_t *pcm, snd_output_t *out) in snd_pcm_dshare_dump() argument
608 snd_pcm_direct_t *dshare = pcm->private_data; in snd_pcm_dshare_dump()
611 if (pcm->setup) { in snd_pcm_dshare_dump()
613 snd_pcm_dump_setup(pcm, out); in snd_pcm_dshare_dump()
694 snd_pcm_t *pcm, *spcm = NULL; in snd_pcm_dshare_open() local
706 ret = _snd_pcm_direct_new(&pcm, &dshare, SND_PCM_TYPE_DSHARE, name, opts, params, stream, mode); in snd_pcm_dshare_open()
712 pcm->ops = &snd_pcm_dshare_dummy_ops; in snd_pcm_dshare_open()
713 pcm->fast_ops = &snd_pcm_dshare_fast_dummy_ops; in snd_pcm_dshare_open()
715 pcm->ops = &snd_pcm_dshare_ops; in snd_pcm_dshare_open()
716 pcm->fast_ops = &snd_pcm_dshare_fast_ops; in snd_pcm_dshare_open()
718 pcm->private_data = dshare; in snd_pcm_dshare_open()
826 pcm->poll_fd = dshare->poll_fd; in snd_pcm_dshare_open()
827 pcm->poll_events = POLLIN; /* it's different than other plugins */ in snd_pcm_dshare_open()
828 pcm->tstamp_type = spcm->tstamp_type; in snd_pcm_dshare_open()
829 pcm->mmap_rw = 1; in snd_pcm_dshare_open()
830 snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0); in snd_pcm_dshare_open()
831 snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0); in snd_pcm_dshare_open()
835 *pcmp = pcm; in snd_pcm_dshare_open()
857 snd_pcm_free(pcm); in snd_pcm_dshare_open()