[alsa-devel] Getting physical address of the DMA buffer

Pharaoh . pharaoh137 at gmail.com
Tue Jun 26 20:04:42 CEST 2007


I have allocated the DMA buffer using snd_pcm_lib_malloc_pages() and
it was preallocated as:

                                              128 * 1024, 128 * 1024);

and then,


None of these calls fail.

The physical address of the allocated buffer is shown as 0 in my case
since according to 'Writing an ALSA driver' the physical address of
the DMA buffer will
not be accessble from the main CPU. Is that why the physical address
is shown as 0?

Also, in my pointer function, I need the DMA buffers physical address
to calculate the
position in buffer etc. How can do that since runtime->dma_addr is 0 for me?

Apologies for longish mail but I have to paste the actual paragraphs
here to clear my
understanding in less number of emails by avoiding further emails.

In chapter 5, in DMA buffer information, it is said that,

1. The dma_area holds the buffer pointer (the logical address). You
can call memcpy
from/to this pointer. Meanwhile, dma_addr holds the physical address
of the buffer. This field is specified only when the buffer is a linear

and in descrition of prepare callback it says,

2. The physical address of the allocated buffer is set to runtime->dma_area.

Statements 1 and 2 contradict each other or I am mis reading them?

How should I get the physical address in pointer callbacks? As
runtime->dma_area or runtime->dma_addr which is 0?


More information about the Alsa-devel mailing list