All of lore.kernel.org
 help / color / mirror / Atom feed
* alsa dma transfer
@ 2005-06-29  6:35 Tehn-Yit Chin
  2005-06-29  7:21 ` Lee Revell
  2005-06-29  9:26 ` Takashi Iwai
  0 siblings, 2 replies; 12+ messages in thread
From: Tehn-Yit Chin @ 2005-06-29  6:35 UTC (permalink / raw)
  To: alsa-devel

Hi,

Please bear with me as I am a newbie at writing an ALSA device driver. I
am a bit confused as to how ALSA manages its buffers and memory.
Currently, I am confused as to audio data is being passed into the
device driver so that the driver can start the DMA transfer

I have read Takashi Iwai doc on "Writing an ALSA Driver" and reviewed
some of the drivers already in the source tree and was not able to get a
clear understanding of it.

>From what I can tell, runtime->dma_start is a virtual memory buffer that
has the audio data, and the amount of data to transfer is in
frames_to_bytes(runtime, runtime->period_size). Is this right?

And how do I tell pcm layer that the device does not support recording?

Many thanks,

Tehn Yit Chin 
Software Engineer, Grey Innovation Pty. Ltd.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id\x16492&op=click

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: alsa dma transfer
@ 2005-06-29 12:53 Tehn-Yit Chin
  2005-06-29 13:34 ` Takashi Iwai
  0 siblings, 1 reply; 12+ messages in thread
From: Tehn-Yit Chin @ 2005-06-29 12:53 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]

Cool. I believe that I am doing the right thing.

I am calling snd_pcm_lib_malloc_pages() for the hw_params callback and snd_pcm_lib_free_pages() for the hw_free callback. I also call snd_pcm_lib_preallocate_pages_for_all() during the initialisation of the driver which I think is the buffer pre-allocation that Takashi Iwai is talking about. 

Does the pre-allocated memory need to be freed when we are exiting the driver?

Tehn Yit Chin

-----Original Message-----
From: Takashi Iwai [mailto:tiwai@suse.de]
Sent: Wed 6/29/2005 7:26 PM
To: Tehn-Yit Chin
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: [Alsa-devel] alsa dma transfer
 
At Wed, 29 Jun 2005 16:35:21 +1000,
Tehn-Yit Chin wrote:
> 
> From what I can tell, runtime->dma_start is a virtual memory buffer that
> has the audio data, and the amount of data to transfer is in
> frames_to_bytes(runtime, runtime->period_size). Is this right?

runtime->dma_area is the virtual address and runtime->dma_addr is the
physical (more exactly bus) address.  They are set up either via
snd_pcm_lib_malloc_pages() or manually by yourself in hwparams
callback.  In the former case, you'll need the buffer pre-allocation
beforehand at the creation of PCM instance.

> And how do I tell pcm layer that the device does not support recording?

Pass 0 to capture_count of snd_pcm_new().


Takashi


[-- Attachment #2: Type: text/html, Size: 1963 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-07-27  9:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-29  6:35 alsa dma transfer Tehn-Yit Chin
2005-06-29  7:21 ` Lee Revell
2005-06-29  9:26 ` Takashi Iwai
2005-06-29 12:33   ` Raymond
2005-06-29 13:40     ` Takashi Iwai
2005-07-05 12:26       ` Raymond
2005-07-05 13:12         ` Takashi Iwai
2005-07-05 15:58           ` Raymond
2005-07-08 16:24           ` Raymond
2005-07-27  9:08             ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2005-06-29 12:53 Tehn-Yit Chin
2005-06-29 13:34 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.