Skip to contentSkip to conversation

embedded sound architecture question]

Fwd: Lorenz Kolb 3 participants 4 messages May 14, 2007 – May 16, 2007

lore
Share & tools
lore
#0 lore raw

Hi leonid,

To be precise, I am the guy in question, who has to do the hardware-part and You guessed it: The board is an ML403.
So what are the problems:
- DMA (whenever an DMA transfer is issued the CPU is put to soem sort of "freeze", as the bus is occupied, whenever the CPU writes to memory it is also busy: that solution is not really good, occupying the CPU some sort of twice)
+ possible solution: some sort of multiport memory controller (or our idea:
own memory directly attached to the ac'97 controller) using BRAM.

Quoted 3 lines

If I were you, I would chose one of sound cards which have ALSA drivers implemented (the list can be found on ALSA site) and mimicked their behavior in your VHDL.

Actually a bunch of theses drivers rely on PCI or ISA.
The few left do all require DMA, what is only an option, if it is some sort of faked DMA, so the CPU writes directly into the controller's memory as we intend to stay as independent as possible from Xilinx' IP Cores. The question was: is that a good (and practicable) idea?

Greetings,

Lorenz Kolb

#1 lore raw

Hi,

Quoted 11 lines
Quoted 4 lines

If I were you, I would chose one of sound cards which have ALSA drivers implemented (the list can be found on ALSA site) and mimicked their behavior in your VHDL.

Actually a bunch of theses drivers rely on PCI or ISA.
The few left do all require DMA, what is only an option, if it is some sort of faked DMA, so the CPU writes directly into the controller's memory as we intend to stay as independent as possible from Xilinx' IP Cores. The question was: is that a good (and practicable) idea?

If you can spare the BRAM, that sounds good to me.

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.

What you need is :
- Be able to ask the hardware where is is "read pointer".
- Be able to ask the hardware to generate an interrupt every 'n' samples.

And that should do it.

You also need to make the controller build the AC97 frames itself (e.g. for the control slots, a separate set of registers), and also preferrably
supporting multiple sample format so the CPU needs to do a minimum of conversion.

Sylvain

#2 lore raw

Hi Sylvain,

thank you very much for your mail,

Quoted 4 lines · Sylvain Munaut

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?

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?

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?

Joachim

#3 lore raw
Quoted 6 lines · Joachim Förster

Hi Sylvain,

thank you very much for your mail,

On Tue, 2007-05-15 at 09:09 +0200, Sylvain Munaut wrote:

Quoted 8 lines
Quoted 5 lines

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.

Quoted 6 lines

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 ...

Quoted 5 lines

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