Getting physical address of the DMA buffer

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

 



Hi
I have allocated the DMA buffer using snd_pcm_lib_malloc_pages() andit was preallocated as:
snd_pcm_lib_preallocate_pages_for_all(pcm,                                              SNDRV_DMA_TYPE_CONTINUOUS,                                              snd_dma_continuous_data                                              (GFP_KERNEL),                                              128 * 1024, 128 * 1024);
and then,
snd_pcm_lib_malloc_pages(substream,                                        params_buffer_bytes(hw_params));
None of these calls fail.
The physical address of the allocated buffer is shown as 0 in my casesince according to 'Writing an ALSA driver' the physical address ofthe DMA buffer willnot be accessble from the main CPU. Is that why the physical addressis shown as 0?
Also, in my pointer function, I need the DMA buffers physical addressto calculate theposition 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 paragraphshere to clear myunderstanding 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). Youcan call memcpyfrom/to this pointer. Meanwhile, dma_addr holds the physical addressof the buffer. This field is specified only when the buffer is a linearbuffer.
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? Asruntime->dma_area or runtime->dma_addr which is 0?
-pharaoh._______________________________________________Alsa-devel mailing listAlsa-devel@xxxxxxxxxxxxxxxxxxxx://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