Subject: Re: NetBSD /dev/audio
To: VaX#n8 <vax@ccwf.cc.utexas.edu>
From: John Hawkinson <jhawk@panix.com>
List: current-users
Date: 12/10/1994 11:16:12
> From: VaX#n8 <vax@ccwf.cc.utexas.edu>

> To: G.Michaelson@cc.uq.oz.au (George Michaelson)
> Cc: hpeyerl@novatel.ca, kstailey@leidecker.gsfc.nasa.gov,
>         current-users@netbsd.org

> > Please also consider the Multicast! there's deployed code out there that
> > expects certain behaviour of /dev/audio different to people playing .WAV

> Can you rephrase that?

There are multicast audio applications out there that expect /dev/audio
to be a full-duplex audio device. In specific, vat (the LBL Visual Audio
Tool), which is used to listen to conferences & such broadcast over
the MBONE (muticast backbone), tries to read and write from /dev/audio
at the same time (or so it seems; it doesn't come with source, just
a binary dist). This causes some problems.

I looked at this briefly last week, and mycroft happened to be around; we
determined that there were some timing interactions between vat and the
sb driver -- the attached patch allowed to vat to work partially.

--
John Hawkinson
jhawk@panix.com

*** 1.1	1994/12/06 22:13:45
--- sb.c	1994/12/06 22:14:11
***************
*** 275,283 ****
  	register int i;
  
  	for (i = 100; --i >= 0; ) {
! 		if ((inb(iobase + SBP_DSP_WSTAT) & SB_DSP_BUSY) != 0)
  			continue;
  		outb(iobase + SBP_DSP_WRITE, v);
  		return 0;
  	}
  	++sberr.wdsp;
--- 275,286 ----
  	register int i;
  
  	for (i = 100; --i >= 0; ) {
! 		u_char x = inb(iobase + SBP_DSP_WSTAT);
! 		delay(20);
! 		if ((x & SB_DSP_BUSY) != 0)
  			continue;
  		outb(iobase + SBP_DSP_WRITE, v);
+ 		delay(20);
  		return 0;
  	}
  	++sberr.wdsp;
***************
*** 293,301 ****
  	register int i;
  
  	for (i = 100; --i >= 0; ) {
! 		if ((inb(iobase + SBP_DSP_RSTAT) & SB_DSP_READY) == 0)
  			continue;
! 		return inb(iobase + SBP_DSP_READ);
  	}
  	++sberr.rdsp;
  	return -1;
--- 296,308 ----
  	register int i;
  
  	for (i = 100; --i >= 0; ) {
! 		u_char x = inb(iobase + SBP_DSP_RSTAT);
! 		delay(20);
! 		if ((x & SB_DSP_READY) == 0)
  			continue;
! 		x = inb(iobase + SBP_DSP_READ);
! 		delay(20);
! 		return x;
  	}
  	++sberr.rdsp;
  	return -1;
***************
*** 318,325 ****
  	 * Gee, what a brilliant hardware design.
  	 */
  	outb(iobase + SBP_DSP_RESET, 1);
! 	delay(3);
  	outb(iobase + SBP_DSP_RESET, 0);
  	if (rdsp(iobase) != SB_MAGIC)
  		return -1;
  	return 0;
--- 325,333 ----
  	 * Gee, what a brilliant hardware design.
  	 */
  	outb(iobase + SBP_DSP_RESET, 1);
! 	delay(20);
  	outb(iobase + SBP_DSP_RESET, 0);
+ 	delay(20);
  	if (rdsp(iobase) != SB_MAGIC)
  		return -1;
  	return 0;
***************
*** 600,605 ****
--- 608,614 ----
  	sc->sc_locked = 0;
  	/* clear interrupt */
  	inb(sc->sc_iobase + SBP_DSP_RSTAT);
+ 	delay(20);
  	if (sc->sc_mintr != 0) {
  		int c = rdsp(sc->sc_iobase);
  		(*sc->sc_mintr)(sc->sc_arg, c);