Subject: Looping audio problem in -current
To: None <port-i386@NetBSD.ORG>
From: Nathan J. Williams <nathanw@mit.edu>
List: port-i386
Date: 07/28/1997 19:07:37
	Greetings. With the recent changes to the audio driver, the
sound system on my laptop (NEC Versa 2405) went from "utterly useless"
to "interestingly broken". The symptoms are that if I play a sound (by
"cat file.au > /dev/audio") it plays up to the first 8 seconds of the
sound and repeats those 8 seconds three more times. If I play
something shorter than 8 seconds, the remaining time is filled with
whatever was last played in that part of the interval.

My kernel is this morning's -current, built with:
sb0	at isa? port 0x220 irq 7 drq 1	# SoundBlaster
options AUDIO_DEBUG

and sb0 is detected at boot as:
sb0 at isa0 port 0x220-0x237 irq 7 drq 1 drq16 1: dsp v3.01


As an experiment, I tried setting audiodebug and sbdspdebug to 3. The
resulting spewage from a single play attempt looks like:

Jul 28 18:55:35 gecko /netbsd: audio_open: dev=0x2a80 flags=0x402 sc=0xf86ef900 hdl=0xf86efa00
Jul 28 18:55:35 gecko /netbsd: sbdsp_open: sc=0xf86efa00
Jul 28 18:55:35 gecko /netbsd: sbdsp_open: opened
Jul 28 18:55:35 gecko /netbsd: set_params: model=3, mode=1, rate=8000, prec=8, chan=1, enc=1 -> tc=83, cmd=1c, bmode=ffffffff, cmdchan=00, swcode=0xf81096e8
Jul 28 18:55:35 gecko /netbsd: audio_calc_blksize: play blksize=160
Jul 28 18:55:35 gecko /netbsd: audio_initbufs: mode=5
Jul 28 18:55:35 gecko /netbsd: audio_init_ringbuffer: blksize=160
Jul 28 18:55:35 gecko /netbsd: audio_init_ringbuffer: blksize=160
Jul 28 18:55:35 gecko /netbsd: sbdsp: dma start loop output addr=0xf8714000 cc=65440 chan=1
Jul 28 18:55:35 gecko /netbsd: audio_open: rr.buf=0xf8724000-0xf8733fa0 pr.buf=0xf8714000-0xf8723fa0
Jul 28 18:55:35 gecko /netbsd: audio_ioctl(44,'t',19)
Jul 28 18:55:35 gecko /netbsd: audio_ioctl: unknown ioctl
Jul 28 18:55:35 gecko /netbsd: audio_ioctl(44,'t',19) result 22
Jul 28 18:55:35 gecko /netbsd: audio_ioctl(44,'t',19)
Jul 28 18:55:35 gecko /netbsd: audio_ioctl: unknown ioctl
Jul 28 18:55:35 gecko /netbsd: audio_ioctl(44,'t',19) result 22
Jul 28 18:55:35 gecko /netbsd: audio_write: count=759 used=0(hi=65440)
Jul 28 18:55:35 gecko /netbsd: audio_write: uiomove cc=759 inp=0xf8714000, left=759
Jul 28 18:55:35 gecko /netbsd: audiostartp: start=0xf8714000 used=759(hi=65440) mmapped=0
Jul 28 18:55:35 gecko /netbsd: sbdsp_dma_output: cc=160 0xf8108614 (0xf86ef900)
Jul 28 18:55:35 gecko /netbsd: sbdsp_set_timeconst: sc=0xf86efa00 tc=131
Jul 28 18:55:35 gecko /netbsd: sbdsp_dma_output: set blocksize=159
Jul 28 18:55:35 gecko /netbsd: audio_close: unit=0
Jul 28 18:55:35 gecko /netbsd: audio_drain: used=759
Jul 28 18:56:05 gecko /netbsd: audio_sleep: 35
Jul 28 18:56:05 gecko /netbsd: sbdsp_close: sc=0xf86efa00
Jul 28 18:56:05 gecko /netbsd: sbdsp_haltdma: sc=0xf86efa00
Jul 28 18:56:05 gecko /netbsd: sbdsp_close: closed
Jul 28 18:56:05 gecko /netbsd: audio_close: done

	The playing all happens in the ~30 seconds after the message
from audio_drain.

	My guess from an uneducated glance at audio.c and sbdsp.c is
that the dma completion interrupt has gone awry, as there is no log
message from sbdsp_intr. Either my laptop's sb-clone is not generating
it properly, or something is mucking up recieving it.

	Any ideas on what is really wrong or how I can pinpoint the
problem?

	- Nathan