[alsa-devel] DMA buffer gets played only once

Markus Franke markus.franke at s2002.tu-chemnitz.de
Thu Sep 6 06:36:22 CEST 2007


Hi,

Takashi Iwai wrote:
>> At least this is the behaviour I experienced.
> 
> It's your mis-interpretation of START/STOP concenpt in the ALSA
> framework.  The trigger START and STOP mean the start/stop of the
> whole streaming operation.  It's basically called from the outside,
> i.e. the application starts/stops the stream.  If you need to keep
> some DMA start/stop operations internally, do it in the driver
> lowlevel side internally.

thanks for reply but as already stated this is the behaviour I 
_experienced_. I don't know why also continuously calls trigger START, 
play one period, trigger STOP. Here is some pseudo code:

---snip---
pcm_trigger()
{
	case SNDRV_PCM_TRIGGER_START:
                 /* start the DMA Transfer */
                 ret = startTransfer(dma_devaddr, params->ch_num, 
num_blocks, vi1888_pcm_dma_userCallback, substream);
                 break;
...
}




vi1888_pcm_dma_userCallback() // gets called upon completion of DMA 
transfer
{
         prtd->period_ptr += prtd->period_size;
         if (prtd->period_ptr >= prtd->dma_buffer_end) {
                 prtd->period_ptr = prtd->dma_buffer;
         }

	/* reconfigure channel according to new period pointer */

         /* start the next DMA Transfer */
         ret = startTransfer(dma_devaddr, params->ch_num, num_blocks, 
vi1888_pcm_dma_userCallback, substream();

         /* notify Alsa for the elapsed periods */
         snd_pcm_period_elapsed(substream);
}

---snap---

After each call to snd_pcm_period_elapsed() Alsa calls 
pcm_trigger(TRIGGER_STOP).

Please tell me what I am doing wrong in these callbacks?


Thanks in advance,
Markus


More information about the Alsa-devel mailing list