From owner-freebsd-multimedia Thu Feb 12 12:42:21 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA26414 for freebsd-multimedia-outgoing; Thu, 12 Feb 1998 12:42:21 -0800 (PST) (envelope-from owner-freebsd-multimedia@FreeBSD.ORG) Received: from ns.mt.sri.com (sri-gw.MT.net [206.127.105.141]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA26396; Thu, 12 Feb 1998 12:42:17 -0800 (PST) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id NAA13376; Thu, 12 Feb 1998 13:42:06 -0700 (MST) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id NAA05488; Thu, 12 Feb 1998 13:42:00 -0700 Date: Thu, 12 Feb 1998 13:42:00 -0700 Message-Id: <199802122042.NAA05488@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Studded Cc: Nate Williams , Luigi Rizzo , freebsd-stable@FreeBSD.ORG, freebsd-multimedia@FreeBSD.ORG Subject: Re: Problems with new sound code? In-Reply-To: <34E35A5A.D76BB4E6@dal.net> References: <199802121749.SAA19798@labinfo.iet.unipi.it> <199802121949.MAA05172@mt.sri.com> <34E35A5A.D76BB4E6@dal.net> X-Mailer: VM 6.29 under 19.15 XEmacs Lucid Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org [ 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 -#ifdef DEVFS -#include -#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 #include #include -#include #include #include /* 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