Audio DMA buffer layout and setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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?  Or something else?

Furthermore, since the hardware doesn't provide a 'current' DMA pointer
containing the DMA address being transmitted at the moment (I only have
interrupts generated after each double buffer has been transmitted),
what should the pcm_pointer() callback return?  

(I guess it should return 0 when called before IRQ0 and sizeof(double
 buffer 0) between IRQ0 and IRQ1?)

Best regards,
Markus Korber
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux