Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Feb 1998 13:42:00 -0700
From:      Nate Williams <nate@mt.sri.com>
To:        Studded <Studded@dal.net>
Cc:        Nate Williams <nate@mt.sri.com>, Luigi Rizzo <luigi@labinfo.iet.unipi.it>, freebsd-stable@FreeBSD.ORG, freebsd-multimedia@FreeBSD.ORG
Subject:   Re: Problems with new sound code?
Message-ID:  <199802122042.NAA05488@mt.sri.com>
In-Reply-To: <34E35A5A.D76BB4E6@dal.net>
References:  <Pine.BSF.3.96.980212105507.2070A-100000@dt050ndd.san.rr.com> <199802121749.SAA19798@labinfo.iet.unipi.it> <199802121949.MAA05172@mt.sri.com> <34E35A5A.D76BB4E6@dal.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[
Luigi's sound-driver in -stable won't work, and couldn't have worked
since it contained the poll changes from -current.
]

> I nominate Jordan for a pointy hat for not test-compiling the commit. :)

Seconded.  All in favor?

In any case, appended on the end you'll find a diff that should be
applied to -stable that at least makes the darn things compile.  I'll
commit it as soon as I can test it to make sure it actually *works*. :)


Nate
-------------
Index: ad1848.c
===================================================================
RCS file: /data/FreeBSD/CVS/src/sys/i386/isa/snd/ad1848.c,v
retrieving revision 1.5
diff -u -r1.5 ad1848.c
--- ad1848.c	1997/11/23 07:03:09	1.5
+++ ad1848.c	1998/02/12 20:39:43
@@ -94,7 +94,7 @@
     NULL /* mss_read */,
     NULL /* mss_write */,
     mss_ioctl,
-    sndpoll /* mss_poll */,
+    sndselect /* mss_select */,
 
     mss_intr,
     mss_callback ,
Index: sb_dsp.c
===================================================================
RCS file: /data/FreeBSD/CVS/src/sys/i386/isa/snd/sb_dsp.c,v
retrieving revision 1.5
diff -u -r1.5 sb_dsp.c
--- sb_dsp.c	1997/11/23 07:03:14	1.5
+++ sb_dsp.c	1998/02/12 20:39:43
@@ -92,7 +92,7 @@
     NULL /* use generic sndread */,
     NULL /* use generic sndwrite */,
     sb_dsp_ioctl,
-    sndpoll,
+    sndselect,
 
     sbintr,
     sb_callback,
Index: sound.c
===================================================================
RCS file: /data/FreeBSD/CVS/src/sys/i386/isa/snd/sound.c,v
retrieving revision 1.8
diff -u -r1.8 sound.c
--- sound.c	1998/01/31 02:50:37	1.8
+++ sound.c	1998/02/12 20:39:43
@@ -50,13 +50,7 @@
  *
  */
 
-#include "opt_devfs.h"
-
 #include <i386/isa/snd/sound.h>
-#ifdef	DEVFS
-#include <sys/devfsext.h>
-#endif	/* DEVFS */
-
 
 #if NPCM > 0	/* from "snd.h" */
 
@@ -76,7 +70,7 @@
 static struct cdevsw snd_cdevsw = {
 	sndopen, sndclose, sndread, sndwrite,
 	sndioctl, nxstop, nxreset, nxdevtotty,
-	sndpoll, sndmmap, nxstrategy, "snd",
+	sndselect, sndmmap, nxstrategy, "snd",
 	NULL, -1,
 };
 
@@ -998,10 +992,10 @@
 }
 
 /*
- * function to poll what is currently available.  Used to be select.
+ * select
  */
 int
-sndpoll(dev_t i_dev, int events, struct proc *p)
+sndselect(dev_t i_dev, int rw, struct proc *p)
 {
     int dev, unit, c = 1 /* default: success */ ;
     snddev_info *d ;
@@ -1009,15 +1003,15 @@
 
     dev = minor(i_dev);
     d = get_snddev_info(dev, &unit);
-    DEB(printf("sndpoll dev 0x%04x events 0x%08x\n",i_dev, events));
+    DEB(printf("sndselect dev 0x%04x rw 0x%08x\n",i_dev, rw));
     if (d == NULL ) {
-	printf("poll: unit %d not configured\n", unit );
-        return ( (events & (POLLIN|POLLOUT|POLLRDNORM|POLLWRNORM)) | POLLHUP);
+	printf("sndselect: unit %d not configured\n", unit );
+        return (ENXIO);
     }
-    if (d->poll == NULL)
-        return ( (events & (POLLIN|POLLOUT|POLLRDNORM|POLLWRNORM)) | POLLHUP);
-    else if (d->poll != sndpoll )
-	return d->poll(i_dev, events, p);
+    if (d->select == NULL)
+        return 1; /* always success ? */
+    else if (d->select != sndselect )
+	return d->select(i_dev, rw, p);
     else {
 	/* handle it here with the generic code */
 
@@ -1031,7 +1025,7 @@
 	 * In all other cases, select will return when 1 byte is ready.
 	 */
 	lim = 1;
-	if (events & (POLLOUT | POLLWRNORM) ) {
+	if (rw == FWRITE) {
 	    if ( d->flags & SND_F_HAS_SIZE )
 		lim = d->play_blocksize ;
 	    /* XXX fix the test here for half duplex devices */
@@ -1042,12 +1036,10 @@
 		c = d->dbuf_out.fl ;
 		if (c < lim) /* no space available */
 		    selrecord(p, & (d->wsel));
-		else
-		    revents |= events & (POLLOUT | POLLWRNORM);
 		splx(flags);
 	    }
-        }
-        if (events & (POLLIN | POLLRDNORM)) {
+	    return c < lim ? 0 : 1;
+        } else if (rw == FREAD) {
 	    if ( d->flags & SND_F_HAS_SIZE )
 		lim = d->rec_blocksize ;
 	    /* XXX fix the test here */
@@ -1060,15 +1052,15 @@
 		c = d->dbuf_in.rl ;
 		if (c < lim) /* no data available */
 		    selrecord(p, & (d->rsel));
-		else
-		    revents |= events & (POLLIN | POLLRDNORM);
 		splx(flags);
 	    }
-	    DEB(printf("sndpoll on read: %d >= %d flags 0x%08x\n",
+	    DEB(printf("sndselect on read: %d >= %d flags 0x%08x\n",
 		c, lim, d->flags));
 	    return c < lim ? 0 : 1 ;
+	} else {
+	    DDB(printf("select on exceptions, unimplemented\n"));
+	    return 1;
 	}
-	return revents;
     }
     return ENXIO ; /* notreached */
 }
Index: sound.h
===================================================================
RCS file: /data/FreeBSD/CVS/src/sys/i386/isa/snd/sound.h,v
retrieving revision 1.5
diff -u -r1.5 sound.h
--- sound.h	1997/11/23 07:03:19	1.5
+++ sound.h	1998/02/12 20:39:43
@@ -62,7 +62,6 @@
 #include <sys/errno.h>
 #include <sys/malloc.h>
 #include <sys/buf.h>
-#include <sys/poll.h>
 #include <i386/isa/isa_device.h>
 #include <machine/clock.h>	/* for DELAY */
 
@@ -74,7 +73,7 @@
 #define d_read_t void
 #define d_write_t void
 #define d_ioctl_t void
-#define d_poll_t void
+#define d_select_t void
 #endif /* KERNEL */
 typedef void    (irq_proc_t) (int irq);
 
@@ -125,7 +124,7 @@
     d_read_t *read ;
     d_write_t *write ;
     d_ioctl_t *ioctl ;
-    d_poll_t *poll ;
+    d_select_t *select ;
     irq_proc_t  *isr ;
     snd_callback_t *callback;
 
@@ -483,7 +482,7 @@
 void dsp_wr_dmaupdate(snd_dbuf *b);
 void dsp_rd_dmaupdate(snd_dbuf *b);
 
-d_poll_t sndpoll;
+d_select_t sndselect;
 
 /*
  * library functions (in sound.c)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802122042.NAA05488>