[alsa-devel] Allocating DMA buffer for non-PCM

Clemens Ladisch clemens at ladisch.de
Thu Feb 14 19:01:44 CET 2013


Adrian Knoth wrote:
> On Thu, Feb 14, 2013 at 06:46:30PM +0100, Clemens Ladisch wrote:
>>> Would you say that the following is the proper way to allocate a DMA
>>> buffer used to hold level data?
>>>
>>> 	err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG,
>>> 			snd_dma_pci_data(hdspm->pci),
>>> 			MADIFX_LEVEL_BUFFER_SIZE, &hdspm->dmaLevelBuffer);
>>>
>>>     hdspm->level_buffer = snd_sgbuf_get_ptr(&(hdspm->dmaLevelBuffer), 0);
>>
>> I don't see the code asking for the address of the second page, so I
>> guess there isn't one.
>
> Exactly.

So MADIFX_LEVEL_BUFFER_SIZE is guaranteed to not exceed the page size
on all architectures?

> Just to be sure: Takashi has recommended to use
> (u32*)dmaLevelBuffer.area. Even in the case of SG buffers, is this
> virtual address continuous and safe for memset?

Yes, the SG buffer's pages are vmap()ed there.


Regards,
Clemens


More information about the Alsa-devel mailing list