[alsa-devel] Trouble understanding ALSA's DMA buffers

Takashi Iwai tiwai at suse.de
Tue Jun 12 18:45:26 CEST 2007


At Tue, 12 Jun 2007 11:36:33 -0500,
Timur Tabi wrote:
> 
> Takashi Iwai wrote:
> 
> > Yes.  And the "ping-poing" is the case that you have two periods in a
> > ring buffer.
> 
> Ok, I understand the 'periods' concept now, thanks.
> 
> So when/where does ALSA copy data to the DMA buffer?  Isn't there supposed to be some kind 
> of callback where ALSA calls the driver and says, "here's some data, please copy it to 
> your DMA buffer?"
> 
> Or does ALSA do all the copying itself whenever the driver calls snd_pcm_period_elapsed()?

It depends on the implementation, but usually the latter case.
The whole data-transfer task is done by ALSA PCM middle layer, and
each driver has to take care of the DMA setup -- as long as your
hardware can have a buffer on RAM.  If you need to copy the data to
hardware buffer manually in some way, the things become
complicated...


Takashi


More information about the Alsa-devel mailing list