Skip to contentSkip to conversation

What is the format of dma_area?

DISCUSSION Bill Gatliff 2 participants 3 messages Oct 7, 2005

lore
Share & tools
lore
#0 lore raw

Guys:

I'm trying to write a PCM driver that uses an AC97 codec, on an ARM host, but no DMA. (Please pardon some of my terminology, I'm a bit of an ALSA noob).

My trigger() looks something like this:

int *buffer;
int bytes;
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
bytes = frames_to_bytes(substream->runtime,
substream->runtime->period_size);
buffer = substream->runtime->dma_area;
...

Then, I copy *buffer++ out to the codec one 32-bit chunk (truncated to 20 bits) at a time.

One thing I don't understand is how dma_area is formatted. Is it a stream of integers, like this?

int dma_area[channels][samples];

... or like this?

int dma_area[samples][channels];

... or what? I'm having trouble figuring out where the left- and right-channel data is in the dma buffer.

Thanks!

b.g.

Signature · 9 lines
Bill Gatliff
[email protected]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
#1 lore raw

At Thu, 06 Oct 2005 22:15:49 -0500,

Quoted 20 lines · Bill Gatliff

Guys:

I'm trying to write a PCM driver that uses an AC97 codec, on an ARM host, but no DMA. (Please pardon some of my terminology, I'm a bit of an ALSA noob).

My trigger() looks something like this:

int *buffer;
int bytes;
...
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:

    bytes = frames_to_bytes(substream->runtime, 
substream->runtime->period_size);
    buffer = substream->runtime->dma_area;

...

Quoted 7 lines

Then, I copy *buffer++ out to the codec one 32-bit chunk (truncated to 20 bits) at a time.

One thing I don't understand is how dma_area is formatted. Is it a stream of integers, like this?

int dma_area[channels][samples];

It's called "non-interleaved" format in general.

Quoted 3 lines

... or like this?

int dma_area[samples][channels];

It's "interleaved" format.

It's up to you and hardware. Set the appropriate bit flag in pcm hardware info field.

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl

#2 lore raw

Takashi:

Quoted 3 lines · Takashi Iwai

It's up to you and hardware. Set the appropriate bit flag in pcm hardware info field.

Thanks! Both for the information and for the quick reply!!

b.g.

Signature · 9 lines
Bill Gatliff
[email protected]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl