Skip to contentSkip to conversation

DMA strangeness?

DISCUSSION Adrian McMenamin 2 participants 6 messages Feb 19, 2006 – Feb 21, 2006

lore
Share & tools
lore
#0 lore raw

I am using oss emulation to test my driver (I cannot get the alsa utilities to work properly on my Dreamcast (SH4/uclibc) system).

When I do something like

cat foobar > /dev/dsp

it seems that the DMA buffer is filled with doubles of every byte of foobar eg if foobar was 0xFF, 0x10 ... etc then the first four bytes of the DMA buffer would be 0xFF 0xFF 0x10 0x10

Is there a reason for this? Obviously I've made a mistake somewhere but I don't know where

(driver code is at http://newgoldddream.dyndns.nfo/repos)

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#1 lore raw

At Sun, 19 Feb 2006 15:12:33 +0000,

Quoted 6 lines · Adrian McMenamin

I am using oss emulation to test my driver (I cannot get the alsa utilities to work properly on my Dreamcast (SH4/uclibc) system).

When I do something like

Quoted 8 lines

cat foobar > /dev/dsp

it seems that the DMA buffer is filled with doubles of every byte of foobar eg if foobar was 0xFF, 0x10 ... etc then the first four bytes of the DMA buffer would be 0xFF 0xFF 0x10 0x10

Is there a reason for this? Obviously I've made a mistake somewhere but I don't know where

Depending on the configuration, the mono signal is expanded to stereo.

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#2 lore raw
Quoted 14 lines · Takashi Iwai

At Sun, 19 Feb 2006 15:12:33 +0000,

Quoted 12 lines · Adrian McMenamin

I am using oss emulation to test my driver (I cannot get the alsa utilities to work properly on my Dreamcast (SH4/uclibc) system).

When I do something like

cat foobar > /dev/dsp

it seems that the DMA buffer is filled with doubles of every byte of foobar eg if foobar was 0xFF, 0x10 ... etc then the first four bytes of the DMA buffer would be 0xFF 0xFF 0x10 0x10

Quoted 6 lines
Quoted 2 lines

Is there a reason for this? Obviously I've made a mistake somewhere but I don't know where

Depending on the configuration, the mono signal is expanded to stereo.

Thanks. I guessed it was probably some sort of stereo sep stuff. How do I control this - where are the sources I can look at?

The way my card works that might not be the best way of doing it - I need to load the left and right channels into two different buffers in the device space - or else find a very different way to arrange the playback.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#3 lore raw

At Tue, 21 Feb 2006 15:43:15 -0000 (GMT),

Quoted 19 lines · Adrian McMenamin
Quoted 17 lines · Takashi Iwai

At Sun, 19 Feb 2006 15:12:33 +0000,

Quoted 14 lines · Adrian McMenamin

I am using oss emulation to test my driver (I cannot get the alsa utilities to work properly on my Dreamcast (SH4/uclibc) system).

When I do something like

cat foobar > /dev/dsp

it seems that the DMA buffer is filled with doubles of every byte of foobar eg if foobar was 0xFF, 0x10 ... etc then the first four bytes of the DMA buffer would be 0xFF 0xFF 0x10 0x10

Is there a reason for this? Obviously I've made a mistake somewhere but I don't know where

Quoted 6 lines
Quoted 3 lines

Depending on the configuration, the mono signal is expanded to stereo.

Thanks. I guessed it was probably some sort of stereo sep stuff. How do I control this - where are the sources I can look at?

The pcm-oss emulator does it. See core/oss/*.c.
Better to look at the code in 1.0.11rc3 than 2.6.16-rc3. There were some clean-ups.

It expands from mono to stereo if the driver sets the pcm with 2 channels interleaved format. If the driver sets 1 channel or non-interleaved, the behavior would be different.

Quoted 3 lines

The way my card works that might not be the best way of doing it - I need to load the left and right channels into two different buffers in the device space - or else find a very different way to arrange the playback.

If you set INTERLEAVED flag in the pcm hardware setting, it seems not matching with your hardware model.

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#4 lore raw
Quoted 4 lines · Takashi Iwai

If you set INTERLEAVED flag in the pcm hardware setting, it seems not matching with your hardware model.

Oddly, I set both. So I can fix that now. Not sure how I can execute two DMA transfers though - ie one to the left buffer and one to the right. Hmmm.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#5 lore raw

At Tue, 21 Feb 2006 17:54:32 -0000 (GMT),

Quoted 11 lines · Adrian McMenamin
Quoted 4 lines · Takashi Iwai

If you set INTERLEAVED flag in the pcm hardware setting, it seems not matching with your hardware model.

Oddly, I set both. So I can fix that now. Not sure how I can execute two DMA transfers though - ie one to the left buffer and one to the right. Hmmm.

There are several possibilities. One solution is to provide two individual mono streams and let alsa-lib bind them. This will require less work in the kernel driver side. The drawback is that this won't work with kernel OSS emulation.

Another solution is to implement it in the driver, of course. Even if the buffer assignment on your device is exotic, you can still manage it by manually tuning the buffer pointers in hw_params callback and set proper values in ioctl(SND_PCM_IOCTL1_CHANNEL_INFO). An example is korg1212 driver.

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642