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 completely.
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 [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -2048, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -2048, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -2048, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -512, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -2048, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1536, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge? ALSA sound/core/pcm_lib.c:240: Unexpected hw_pointer value [1] (stream = 0, delta: -1024, max jitter = 11025): wrong interrupt acknowledge?
Regards, Tadashi