[alsa-devel] snd_pcm_hardware_t.info question

Ciaccia ciacciax at yahoo.com
Tue Apr 17 10:03:24 CEST 2007


Hi all,
I am trying to fix (improve?) a driver for an embedded
ARM device I bought months ago, and for some reasons
some ALSA applications work fine while other ones
don't... 

Looking at the driver I got, I noticed that the info
field in the snd_pcm_hardware_t struct just defines:

SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE

while the info in the tutorial "writing an alsa
driver" defines: 

SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER | 
SNDRV_PCM_INFO_MMAP_VALID

Furthermore, the driver defines a copy callback
(actually 2, one for playback and one for capture),
where it copies the data from the use space to the dma
buffer. Since the dma buffer was preallocated with
snd_pcm_lib_preallocate_pages_for_all and is
accessible from the "outside", I wonder why the
original author did this...

I have some questions for you gurus:

- what is the difference between SNDRV_PCM_INFO_MMAP
and SNDRV_PCM_INFO_MMAP_VALID? What is
SNDRV_PCM_INFO_BLOCK_TRANSFER?

- The code calls snd_pcm_lib_preallocate_pages_for_all
function as following:

/* allocate the pcm(DMA) memory */
ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_DEV,0, 4*128*1024, 4*128*1024);

is the DMA_TYPE right for an ARM device? Is NULL a
correct value for data in this case?

- In case I get rid of the copy callback, how do I
specify the format of the stream? How does Where can I
find an example for that?

Thanks a lot
Andrea

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Alsa-devel mailing list