Subject: Re: [Fwd: [alsa-devel] embedded sound architecture question]

From: Sylvain Munaut <[email-masked]>
Date: Wed, 16 May 2007 09:11:24 +0200

Joachim Förster wrote:
> Hi Sylvain,
>
> thank you very much for your mail,
>
> On Tue, 2007-05-15 at 09:09 +0200, Sylvain Munaut wrote:
>   
>> I'm not an alsa expert but I'm working on a driver right now. And alsa
>> provide you a hook so you can allocate your memory buffer your self.
>> So as long as your control maps it's memory somewhere in the
>> cpu address space you should be fine.
>>     
>
> By "hook", do you mean the prepare()/hw_params() callbacks?
>   
hw_params and hw_free yes.

I personally use snd_pcm_lib_malloc_pages to allocate the buffer, but
you'll have to write your own, and in the same call back configure the
period rate for you hw to generate interrupt.

> I noticed that there is an (undocumented?) mmap() callback, too, so I
> think, I have to implement that one and call something like
> io_remap_pfn_range() to "connect" the device's memory to the VMA
> (virtual memory area) which is provided as an argument to the mmap()
> callback, right?
>   
Sorry, no idea ... but it's likely that you need to handle the mapping
of this
zone in userspace by yourself ...
> In our case, we are not going to allocate any memory like a typical ALSA
> driver does (with DMA) (in prepare()/hw_params() callback), because the
> device's IO memory will "be there" - we just have to "announce"/map it
> into kernel space, right? Or is this interpretation wrong?
>   
No I think that should work.

You need a quite a few BRAMs though ... buffers are often 128k at the
minimum, so that's 64 brams ....

Sylvain