Skip to contentSkip to conversation

How to update Buffer Pointer

DISCUSSION Prince John 2 participants 2 messages Jul 26, 2003

lore
Share & tools
lore
#0 lore raw

Hi,
I have a few queries on buffer pointer updation during playback operation with DMA transfer. I have gone through the documents, but some are not very clear. I have 64KB DMA buffer and 16KB period size. I'm using runtime->dma_addr as the DMA source (physical address). Is this right? This address never getting changed during run time. I get interrupt in 16K periods. Should I add the 16KB offset to the runtime->dma_addr for next block of data transmission? And should it be wrapped around to runtime->dma_addr after 64KB transfer? I tried some of these, but the sound gererated is not proper.
The runtime->status->hw_ptr also seen as a constant during run time. The pointer call backs are returned with the number of frames transmitted (offset from the buffer start address).

Could you please give your suggestions ?

Thanks,
Prince

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

#1 lore raw
Quoted 10 lines · Prince John

Hi,
I have a few queries on buffer pointer updation during playback operation with DMA transfer. I have gone through the documents, but some are not very clear. I have 64KB DMA buffer and 16KB period size. I'm using runtime->dma_addr as the DMA source (physical address). Is this right? This address never getting changed during run time. I get interrupt in 16K periods. Should I add the 16KB offset to the runtime->dma_addr for next block of data transmission?

No, don't do this. Simply return the right buffer position via the pointer callback.

Quoted 9 lines

And should it be wrapped around to runtime->dma_addr after 64KB transfer? I tried some of these, but the sound gererated is not proper.
The runtime->status->hw_ptr also seen as a constant during run time. The pointer call backs are returned with the number of frames transmitted (offset from the buffer start address).

Could you please give your suggestions ?

I guess that you forgot to call snd_pcm_period_elapsed() in your interrupt handler to notify the midlevel code that the transfer of a period is done.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01