[alsa-devel] DMA Physical Address through "snd_pcm_lib_malloc_pages"

Adish Kuvelker adkuvi at gmail.com
Thu Jun 24 00:20:17 CEST 2010


Hello,

I am trying to allocate memory for DMA buffer through
"snd_pcm_lib_malloc_pages" in hw_params callout function, with prior
use of "snd_pcm_lib_preallocate_pages_for_all". The chapter on PCM
Interface in "writing an ALSA driver" states that if the standard
function "snd_pcm_lib_malloc_pages" is use for allocating the DMA
buffers then the DMA fields of dma_addr, dma_area, dma_bytes are set
by the ALSA middle layer.

However my code walk through didn't point me to the area where this
physical memory setting is done. My DMA channel is not serving a PCI
device. I would be very grateful if any of you guys can point me to
the code where this settings get done by calling
"snd_pcm_lib_malloc_pages". Going through the code for a few devices
registered under "pci" I found that the call to
"snd_pcm_lib_malloc_pages" is followed by call to
"snd_pcm_sgbuf_get_addr" to get the physical address. Also a call to
"__pa" is done in the "parisc/harmony.c".

Do I have to set the dma parameters in the runtime structure even
after allocating memory using "snd_pcm_lib_malloc_pages"?

Regards;
Aadish


More information about the Alsa-devel mailing list