[alsa-devel] driver development questions
tiwai at suse.de
Wed Mar 12 17:57:05 CET 2008
At Wed, 12 Mar 2008 19:53:05 +0900,
gmail zaq79324 wrote:
> Hi everyone,
> I'm currently developing an ALSA driver from scratch. It
> is almost done, but memory buffer management problem
> remains. I have tried in various way of debugging. But
> currently I'm almost giving it up.
> My target hardware has a small data buffer(2K+2K ring
> buffer). The driver fills the first half buffer(2K) and
> writes hardware port. After this the interrupt occurs to
> urge writting the second half buffer and hardware port.
> The second buffer is filled in the same way. The buffer
> filling scheme will repeat continuously until the end of
> the sound.
> Through my driver, aplay command can generate the sound
> within few seconds, but it stops before finishing
> It seems to have the problem of buffer management. So I
> set xrun_debug option like as follows.
> echo 1 > /proc/asound/SM502I2S/pcm0p/xrun_debug
> And I got the following output. Does anyone know what the
> problem is and how to fix it?
> # ./bin/aplay --channels=1 --period-size=2048 sample.wav
> Playing WAVE 'sample.wav' : Signed 16 bit Little Endian,
> Rate 44100 Hz, Stereo
> aplay: pcm_write:1266: write error: Input/output error
> ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value
> (stream = 0, delta: -1536, max jitter = 11025): wrong
> interrupt acknowledge?
This indicates that the driver returns an invalid value from the
pointer callback. At which timing is the interrupt issued?
In the current ALSA model, the irq is expected at the timing when the
period is actually processed - i.e. played back actually. It's not
the time that the data is fed to the hardware.
More information about the Alsa-devel