[alsa-devel] Audio DMA buffer layout

Markus Korber korbse at gmx.at
Tue May 8 13:47:47 CEST 2007


I'm working with a custom sound chip with its own DMA hardware.  The
figure shows how the I2S DMA expects data to be prepared:

     IRQ1 +----------------+
          | page_3 (right) |\
          +----------------+ > double buffer 1
          | page_2 (left)  |/
     IRQ0 +----------------+
          | page_1 (right) |\
          +----------------+ > double buffer 0
          | page_0 (left)  |/

The hardware has 2 double buffers, each containing left and right sample
regions, i.e. it alternately transmits samples from page_0 and page_1,
i.e. double buffer 0, then generates an interrupt and starts
transmitting page_2 and page_3.  After that another interrupt is
generated and the process begins again with double buffer 0.

So my question is, how to tell ALSA about this memory layout?  Is it
possible to operate in MMAP mode with SNDRV_PCM_INFO_NONINTERLEAVED?
But then, how to tell the application that it should either fill double
buffer 0 or 1?  Or should I use RW mode and copy samples manually to
another buffer?  Or something else?  SG-DMA?  page()-callback?

Best regards,
Markus Korber

More information about the Alsa-devel mailing list