* ALSA PCM DMA questions
@ 2005-05-19 21:53 Derek Jones
2005-05-20 8:53 ` Giuliano Pochini
0 siblings, 1 reply; 2+ messages in thread
From: Derek Jones @ 2005-05-19 21:53 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 998 bytes --]
Hi,
I am busy developing an ALSA AC97 driver for an ARM9 based SoC. I am pulling my hair out trying to figure out how the DMA buffers are supposed to work in the PCM driver.
To start with, I am only trying to get playback working.
I start the DMA after I get a SNDRV_PCM TRIGGER_START in my trigger routine. The DMA transfer starts from runtime->dma_addr and transfers period_size bytes (snd_pcm_lib_period_bytes(substream)).
After the DMA transfer completes, I call snd_pcm_period_elaped(substream). I'm guessing that this moves a buffer pointer. What I cannot figure out is how to determine where I am in the buffer so that I can start the next DMA from the correct position.
When the entire buffer has been DMA'ed, is the buffer overwritten with new PCM data from userland, or does the DMA buffer work like a circular buffer with userland data being transferred into the buffer at each PCM period.
Any help or pointers would be greatly appreciated.
Regards,
Derek Jones
[-- Attachment #2: Type: text/html, Size: 1429 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: ALSA PCM DMA questions
2005-05-19 21:53 ALSA PCM DMA questions Derek Jones
@ 2005-05-20 8:53 ` Giuliano Pochini
0 siblings, 0 replies; 2+ messages in thread
From: Giuliano Pochini @ 2005-05-20 8:53 UTC (permalink / raw)
To: Derek Jones; +Cc: alsa-devel
On 19-May-2005 Derek Jones wrote:
> After the DMA transfer completes, I call snd_pcm_period_elaped(substream).
> I'm guessing that this moves a buffer pointer. What I cannot figure out
> is how to determine where I am in the buffer so that I can start the next
> DMA from the correct position.
Does your hw require restart the DMA after each block ? This is bad. It's
nearly impossible to do that without a small delay. BTW, the hw should
provide a way to know what it is playing/recording. It it doesn't, you have
to count IRQs. If you have to restart the DMA every time, it's simple: just
store the current block number when you start it for later use.
> When the entire buffer has been DMA'ed, is the buffer overwritten with new
> PCM data from userland
During playback, part of the buffer (one or more periods) is filled with
new data. snd_pcm_period_elapsed() triggers it.
> or does the DMA buffer work like a circular buffer with userland data
> being transferred into the buffer at each PCM period.
Yes.
--
Giuliano.
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-20 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19 21:53 ALSA PCM DMA questions Derek Jones
2005-05-20 8:53 ` Giuliano Pochini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox