summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1998-02-17 19:17:08 +0000
committernate <nate@FreeBSD.org>1998-02-17 19:17:08 +0000
commit77f7d1058568bd70f67511976ce2c8693f5106e4 (patch)
treea22c393d65ae18da9b508b8658a78ddb2385385a
parentd355ca7a628dffe4ffd363b4e1fe39172a6476c6 (diff)
downloadFreeBSD-src-77f7d1058568bd70f67511976ce2c8693f5106e4.zip
FreeBSD-src-77f7d1058568bd70f67511976ce2c8693f5106e4.tar.gz
- Updated to Luigi's 2-15-98 code. The code in 2.2 is the same except for
select/poll and DEVFS changes, which are limited to an include/define in sound.h and the actual select/poll implementation in sound.c [ This commit is blind, but the code is similar enough that there will hopefully be no problems. ]
-rw-r--r--sys/dev/pcm/isa/mss.c8
-rw-r--r--sys/dev/pcm/isa/sb.c15
-rw-r--r--sys/dev/sound/isa/mss.c8
-rw-r--r--sys/dev/sound/isa/sb.c15
-rw-r--r--sys/dev/sound/isa/sb16.c15
-rw-r--r--sys/dev/sound/isa/sb8.c15
-rw-r--r--sys/i386/isa/snd/CARDS2
-rw-r--r--sys/i386/isa/snd/README76
-rw-r--r--sys/i386/isa/snd/ad1848.c8
-rw-r--r--sys/i386/isa/snd/dmabuf.c6
-rw-r--r--sys/i386/isa/snd/sb_dsp.c15
-rw-r--r--sys/i386/isa/snd/sound.c79
-rw-r--r--sys/i386/isa/snd/sound.h52
13 files changed, 133 insertions, 181 deletions
diff --git a/sys/dev/pcm/isa/mss.c b/sys/dev/pcm/isa/mss.c
index 26eaee5..7880395 100644
--- a/sys/dev/pcm/isa/mss.c
+++ b/sys/dev/pcm/isa/mss.c
@@ -6,7 +6,7 @@
*
* AD1848, CS4248, CS423x, OPTi931, Yamaha SA2 and many others.
*
- * Copyright Luigi Rizzo, 1997
+ * Copyright Luigi Rizzo, 1997,1998
* Copyright by Hannu Savolainen 1994, 1995
*
* Redistribution and use in source and binary forms, with or without
@@ -1392,7 +1392,7 @@ cs423x_attach(u_long csn, u_long vend_id, char *name,
return ;
}
snddev_last_probed = &tmp_d;
- if (d.flags) { /*** use sb-compatible codec ***/
+ if (d.flags & DV_PNP_SBCODEC) { /*** use sb-compatible codec ***/
dev->id_alive = 16 ; /* number of io ports ? */
tmp_d = sb_op_desc ;
if (vend_id==0x2000a865 || vend_id==0x3000a865 || vend_id==0x8140d315) {
@@ -1511,7 +1511,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
enable_pnp_card();
snddev_last_probed = &tmp_d;
- tmp_d = d.flags ? sb_op_desc : mss_op_desc ;
+ tmp_d = d.flags & DV_PNP_SBCODEC ? sb_op_desc : mss_op_desc ;
strcpy(tmp_d.name, name);
@@ -1533,7 +1533,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
opti_write(p, 4, 0xd6 /* fifo empty, OPL3, audio enable, SB3.2 */ );
ad_write (&tmp_d, 10, 2); /* enable interrupts */
- if (d.flags) { /* sb-compatible codec */
+ if (d.flags & DV_PNP_SBCODEC) { /* sb-compatible codec */
/*
* the 931 is not a real SB, it has important pieces of
* hardware controlled by both the WSS and the SB port...
diff --git a/sys/dev/pcm/isa/sb.c b/sys/dev/pcm/isa/sb.c
index 3d75aea..8af9908 100644
--- a/sys/dev/pcm/isa/sb.c
+++ b/sys/dev/pcm/isa/sb.c
@@ -208,6 +208,8 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
d->flags |= SND_F_NBIO ;
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
ask_init(d);
return 0;
@@ -420,6 +422,9 @@ sb_callback(snddev_info *d, int reason)
sb_cmd3(d->io_base, c1 , l - 1) ;
} else if (d->bd_flags & BD_F_ESS) {
/* XXX this code is still incomplete */
+ sb_cmd2(d->io_base, 0xb8, rd ? 4 : 0xe ) ; /* auto dma */
+ sb_cmd2(d->io_base, 0xa8, d->flags & SND_F_STEREO ? 1 : 2) ;
+ sb_cmd2(d->io_base, 0xb9, 2) ; /* demand dma */
} else { /* SBPro -- stereo not supported */
u_char c ;
if (!rd)
@@ -429,6 +434,10 @@ sb_callback(snddev_info *d, int reason)
c = (rd) ? 0x98 : 0x90 ;
else
c = (rd) ? 0x2c : 0x1c ;
+ if (d->flags & SND_F_STEREO)
+ sb_setmixer(d->io_base, 0xe, 2 );
+ else
+ sb_setmixer(d->io_base, 0xe, 0 );
/*
* some ESS extensions -- they can do 16 bits
*/
@@ -450,6 +459,8 @@ sb_callback(snddev_info *d, int reason)
cmd = DSP_CMD_DMAPAUSE_16 ;
if (d->bd_flags & BD_F_HISPEED) {
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
d->flags |= SND_F_INIT ;
} else {
sb_cmd(d->io_base, cmd); /* pause dma. */
@@ -481,7 +492,7 @@ sb_reset_dsp(int io_base)
{
int loopc;
- outb(io_base + SBDSP_RST, 1);
+ outb(io_base + SBDSP_RST, 3);
DELAY(100);
outb(io_base + SBDSP_RST, 0);
for (loopc = 0; loopc<100 && !(inb(DSP_DATA_AVAIL) & 0x80); loopc++)
@@ -795,7 +806,9 @@ dsp_speed(snddev_info *d)
* simultaneously using midi.
* At the moment we do not support either...
*/
+#if 0
d->flags &= ~SND_F_STEREO;
+#endif
/*
* here enforce speed limitations.
diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c
index 26eaee5..7880395 100644
--- a/sys/dev/sound/isa/mss.c
+++ b/sys/dev/sound/isa/mss.c
@@ -6,7 +6,7 @@
*
* AD1848, CS4248, CS423x, OPTi931, Yamaha SA2 and many others.
*
- * Copyright Luigi Rizzo, 1997
+ * Copyright Luigi Rizzo, 1997,1998
* Copyright by Hannu Savolainen 1994, 1995
*
* Redistribution and use in source and binary forms, with or without
@@ -1392,7 +1392,7 @@ cs423x_attach(u_long csn, u_long vend_id, char *name,
return ;
}
snddev_last_probed = &tmp_d;
- if (d.flags) { /*** use sb-compatible codec ***/
+ if (d.flags & DV_PNP_SBCODEC) { /*** use sb-compatible codec ***/
dev->id_alive = 16 ; /* number of io ports ? */
tmp_d = sb_op_desc ;
if (vend_id==0x2000a865 || vend_id==0x3000a865 || vend_id==0x8140d315) {
@@ -1511,7 +1511,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
enable_pnp_card();
snddev_last_probed = &tmp_d;
- tmp_d = d.flags ? sb_op_desc : mss_op_desc ;
+ tmp_d = d.flags & DV_PNP_SBCODEC ? sb_op_desc : mss_op_desc ;
strcpy(tmp_d.name, name);
@@ -1533,7 +1533,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
opti_write(p, 4, 0xd6 /* fifo empty, OPL3, audio enable, SB3.2 */ );
ad_write (&tmp_d, 10, 2); /* enable interrupts */
- if (d.flags) { /* sb-compatible codec */
+ if (d.flags & DV_PNP_SBCODEC) { /* sb-compatible codec */
/*
* the 931 is not a real SB, it has important pieces of
* hardware controlled by both the WSS and the SB port...
diff --git a/sys/dev/sound/isa/sb.c b/sys/dev/sound/isa/sb.c
index 3d75aea..8af9908 100644
--- a/sys/dev/sound/isa/sb.c
+++ b/sys/dev/sound/isa/sb.c
@@ -208,6 +208,8 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
d->flags |= SND_F_NBIO ;
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
ask_init(d);
return 0;
@@ -420,6 +422,9 @@ sb_callback(snddev_info *d, int reason)
sb_cmd3(d->io_base, c1 , l - 1) ;
} else if (d->bd_flags & BD_F_ESS) {
/* XXX this code is still incomplete */
+ sb_cmd2(d->io_base, 0xb8, rd ? 4 : 0xe ) ; /* auto dma */
+ sb_cmd2(d->io_base, 0xa8, d->flags & SND_F_STEREO ? 1 : 2) ;
+ sb_cmd2(d->io_base, 0xb9, 2) ; /* demand dma */
} else { /* SBPro -- stereo not supported */
u_char c ;
if (!rd)
@@ -429,6 +434,10 @@ sb_callback(snddev_info *d, int reason)
c = (rd) ? 0x98 : 0x90 ;
else
c = (rd) ? 0x2c : 0x1c ;
+ if (d->flags & SND_F_STEREO)
+ sb_setmixer(d->io_base, 0xe, 2 );
+ else
+ sb_setmixer(d->io_base, 0xe, 0 );
/*
* some ESS extensions -- they can do 16 bits
*/
@@ -450,6 +459,8 @@ sb_callback(snddev_info *d, int reason)
cmd = DSP_CMD_DMAPAUSE_16 ;
if (d->bd_flags & BD_F_HISPEED) {
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
d->flags |= SND_F_INIT ;
} else {
sb_cmd(d->io_base, cmd); /* pause dma. */
@@ -481,7 +492,7 @@ sb_reset_dsp(int io_base)
{
int loopc;
- outb(io_base + SBDSP_RST, 1);
+ outb(io_base + SBDSP_RST, 3);
DELAY(100);
outb(io_base + SBDSP_RST, 0);
for (loopc = 0; loopc<100 && !(inb(DSP_DATA_AVAIL) & 0x80); loopc++)
@@ -795,7 +806,9 @@ dsp_speed(snddev_info *d)
* simultaneously using midi.
* At the moment we do not support either...
*/
+#if 0
d->flags &= ~SND_F_STEREO;
+#endif
/*
* here enforce speed limitations.
diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c
index 3d75aea..8af9908 100644
--- a/sys/dev/sound/isa/sb16.c
+++ b/sys/dev/sound/isa/sb16.c
@@ -208,6 +208,8 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
d->flags |= SND_F_NBIO ;
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
ask_init(d);
return 0;
@@ -420,6 +422,9 @@ sb_callback(snddev_info *d, int reason)
sb_cmd3(d->io_base, c1 , l - 1) ;
} else if (d->bd_flags & BD_F_ESS) {
/* XXX this code is still incomplete */
+ sb_cmd2(d->io_base, 0xb8, rd ? 4 : 0xe ) ; /* auto dma */
+ sb_cmd2(d->io_base, 0xa8, d->flags & SND_F_STEREO ? 1 : 2) ;
+ sb_cmd2(d->io_base, 0xb9, 2) ; /* demand dma */
} else { /* SBPro -- stereo not supported */
u_char c ;
if (!rd)
@@ -429,6 +434,10 @@ sb_callback(snddev_info *d, int reason)
c = (rd) ? 0x98 : 0x90 ;
else
c = (rd) ? 0x2c : 0x1c ;
+ if (d->flags & SND_F_STEREO)
+ sb_setmixer(d->io_base, 0xe, 2 );
+ else
+ sb_setmixer(d->io_base, 0xe, 0 );
/*
* some ESS extensions -- they can do 16 bits
*/
@@ -450,6 +459,8 @@ sb_callback(snddev_info *d, int reason)
cmd = DSP_CMD_DMAPAUSE_16 ;
if (d->bd_flags & BD_F_HISPEED) {
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
d->flags |= SND_F_INIT ;
} else {
sb_cmd(d->io_base, cmd); /* pause dma. */
@@ -481,7 +492,7 @@ sb_reset_dsp(int io_base)
{
int loopc;
- outb(io_base + SBDSP_RST, 1);
+ outb(io_base + SBDSP_RST, 3);
DELAY(100);
outb(io_base + SBDSP_RST, 0);
for (loopc = 0; loopc<100 && !(inb(DSP_DATA_AVAIL) & 0x80); loopc++)
@@ -795,7 +806,9 @@ dsp_speed(snddev_info *d)
* simultaneously using midi.
* At the moment we do not support either...
*/
+#if 0
d->flags &= ~SND_F_STEREO;
+#endif
/*
* here enforce speed limitations.
diff --git a/sys/dev/sound/isa/sb8.c b/sys/dev/sound/isa/sb8.c
index 3d75aea..8af9908 100644
--- a/sys/dev/sound/isa/sb8.c
+++ b/sys/dev/sound/isa/sb8.c
@@ -208,6 +208,8 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
d->flags |= SND_F_NBIO ;
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
ask_init(d);
return 0;
@@ -420,6 +422,9 @@ sb_callback(snddev_info *d, int reason)
sb_cmd3(d->io_base, c1 , l - 1) ;
} else if (d->bd_flags & BD_F_ESS) {
/* XXX this code is still incomplete */
+ sb_cmd2(d->io_base, 0xb8, rd ? 4 : 0xe ) ; /* auto dma */
+ sb_cmd2(d->io_base, 0xa8, d->flags & SND_F_STEREO ? 1 : 2) ;
+ sb_cmd2(d->io_base, 0xb9, 2) ; /* demand dma */
} else { /* SBPro -- stereo not supported */
u_char c ;
if (!rd)
@@ -429,6 +434,10 @@ sb_callback(snddev_info *d, int reason)
c = (rd) ? 0x98 : 0x90 ;
else
c = (rd) ? 0x2c : 0x1c ;
+ if (d->flags & SND_F_STEREO)
+ sb_setmixer(d->io_base, 0xe, 2 );
+ else
+ sb_setmixer(d->io_base, 0xe, 0 );
/*
* some ESS extensions -- they can do 16 bits
*/
@@ -450,6 +459,8 @@ sb_callback(snddev_info *d, int reason)
cmd = DSP_CMD_DMAPAUSE_16 ;
if (d->bd_flags & BD_F_HISPEED) {
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
d->flags |= SND_F_INIT ;
} else {
sb_cmd(d->io_base, cmd); /* pause dma. */
@@ -481,7 +492,7 @@ sb_reset_dsp(int io_base)
{
int loopc;
- outb(io_base + SBDSP_RST, 1);
+ outb(io_base + SBDSP_RST, 3);
DELAY(100);
outb(io_base + SBDSP_RST, 0);
for (loopc = 0; loopc<100 && !(inb(DSP_DATA_AVAIL) & 0x80); loopc++)
@@ -795,7 +806,9 @@ dsp_speed(snddev_info *d)
* simultaneously using midi.
* At the moment we do not support either...
*/
+#if 0
d->flags &= ~SND_F_STEREO;
+#endif
/*
* here enforce speed limitations.
diff --git a/sys/i386/isa/snd/CARDS b/sys/i386/isa/snd/CARDS
index af6048e..d543e6a 100644
--- a/sys/i386/isa/snd/CARDS
+++ b/sys/i386/isa/snd/CARDS
@@ -156,7 +156,7 @@ ESS688
http://www.esstech.com
- pnp 1 1 os enable irq0 7 drq0 1 port1 0x220
+ pnp 1 1 os enable irq0 7 drq0 1 port0 0x220
There used to be documentation for the 1868 on the ESS site
(files ds1868b1.pdf and ds1868b2.pdf) but I am unable to find
diff --git a/sys/i386/isa/snd/README b/sys/i386/isa/snd/README
index 4c8119e..256ae24 100644
--- a/sys/i386/isa/snd/README
+++ b/sys/i386/isa/snd/README
@@ -20,21 +20,6 @@ set of ioctl(), to support some functions which were not easy to
express with the existing software interface (e.g. full duplex on
the SB16). To make an effective use of the new functionalities you
need to recompile applications by replacing the audio module(s).
-Such modified driver modules are present in the misc/ directory
-for several applications.
-
-This file gives quick information on how to install the driver. For
-more info you are invited to look at the doc/ directory where you
-can find more documentation (in Latex and Postscript) on the driver
-and how to extend it. I am afraid there is not yet a complete set of
-manual pages for using the driver. The files in doc/ should give a
-good idea of what the driver is supposed to do and how, the Voxware
-documentation should be of some help, and the various driver modules
-in misc/ should also give some help.
-
-Also note that you might need the PnP code (pnp971020.tgz), which
-as of January 1998 has been incorporated in -current and -stable
-versions of FreeBSD.
Updated versions of this code will available at the following URL:
@@ -45,20 +30,6 @@ to build a working kernel. The configuration is DIFFERENT (and
hopefully much simpler) from the original Voxware driver. The
relevant steps are indicated at "---INSTALLATION---".
-This code (and the associated patches) should work unmodified on 2.2.5
-and in general on 2.2.X versions of FreeBSD. Minor modifications will be
-necessary to make the code work on 2.1.X. Finally, depending on the
-version of their system, 3.0 users might need to uncomment the
-following line in snd/sound.h:
-
- /* #define USE_POLL */
-
-This archive includes:
-* the main files for the driver, in this directory, which must be
- moved to /sys/i386/isa/snd;
-* miscellaneous, but important, files in the "misc" subdirectory;
-* documentation, in the "doc" subdirectory;
-
CARDS:
The driver supports most clones of WSS, SB16 and SBPro cards.
@@ -78,55 +49,10 @@ APPLICATIONS:
- xanim
- various mpeg players (mpg123, amp, ...);
- WITH SPECIAL DRIVER MODULE (supplied)
- - speak_freely, full duplex (requires removing the definition of
- HALF_DUPLEX in the Makefile);
- - the realaudio player (3.0, dynamically linked);
- - vat, full duplex (driver included);
- - nas, full duplex (driver included);
- - timidity, a software midi-to-pcm converter;
-
NOT WORKING
- xquake (we do not support mmapped buffers yet);
-
- ---INSTALLATION---
-
-In order to use this driver, you need FreeBSD 2.2 or above (I have
-tested this code on 2.2.1 and 2.2.5, and have many reports of the
-driver working on various vintages of 3.0 ). The enclosed patch
-file refers to FreeBSD 2.2.5. Your mileage may vary -- e.g. both
--stable and -current at the time of this writing (Jan.98) have
-included the modifications to isa.c .
-
-Installation requires the following steps:
-
- * install the PnP support files (pnp971020.tgz). This is optional,
- in case you don't you might need to do some simple modifications
- to the file because pnp.h might not exist.
-
- * unpack the content of this archive in /sys/i386/isa/snd/
-
- * if you are running a version of 2.2 earlies than 2.2.5-RELEASE,
- apply the patches in "patches.22x" to isa.c
-
- * patch the following system files using the patches in
- "patches.225" :
-
- /sys/i386/isa/isa.c
- a couple of new functions have been added;
-
- /sys/i386/conf/files.i386
- lines related to this audio driver have been added;
-
- * update file soundcard.h by copying the one in this directory into:
-
- /sys/i386/include/soundcard.h
- /usr/include/machine/soundcard.h
-
- The new file should be compatible with the old one, but has
- the definition of new ioctl() calls which are implemented by
- this driver.
+ ---INSTALLATION---
* add the following lines to your kernel configuration file:
diff --git a/sys/i386/isa/snd/ad1848.c b/sys/i386/isa/snd/ad1848.c
index 26eaee5..7880395 100644
--- a/sys/i386/isa/snd/ad1848.c
+++ b/sys/i386/isa/snd/ad1848.c
@@ -6,7 +6,7 @@
*
* AD1848, CS4248, CS423x, OPTi931, Yamaha SA2 and many others.
*
- * Copyright Luigi Rizzo, 1997
+ * Copyright Luigi Rizzo, 1997,1998
* Copyright by Hannu Savolainen 1994, 1995
*
* Redistribution and use in source and binary forms, with or without
@@ -1392,7 +1392,7 @@ cs423x_attach(u_long csn, u_long vend_id, char *name,
return ;
}
snddev_last_probed = &tmp_d;
- if (d.flags) { /*** use sb-compatible codec ***/
+ if (d.flags & DV_PNP_SBCODEC) { /*** use sb-compatible codec ***/
dev->id_alive = 16 ; /* number of io ports ? */
tmp_d = sb_op_desc ;
if (vend_id==0x2000a865 || vend_id==0x3000a865 || vend_id==0x8140d315) {
@@ -1511,7 +1511,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
enable_pnp_card();
snddev_last_probed = &tmp_d;
- tmp_d = d.flags ? sb_op_desc : mss_op_desc ;
+ tmp_d = d.flags & DV_PNP_SBCODEC ? sb_op_desc : mss_op_desc ;
strcpy(tmp_d.name, name);
@@ -1533,7 +1533,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
opti_write(p, 4, 0xd6 /* fifo empty, OPL3, audio enable, SB3.2 */ );
ad_write (&tmp_d, 10, 2); /* enable interrupts */
- if (d.flags) { /* sb-compatible codec */
+ if (d.flags & DV_PNP_SBCODEC) { /* sb-compatible codec */
/*
* the 931 is not a real SB, it has important pieces of
* hardware controlled by both the WSS and the SB port...
diff --git a/sys/i386/isa/snd/dmabuf.c b/sys/i386/isa/snd/dmabuf.c
index 8c647cb..86f9304 100644
--- a/sys/i386/isa/snd/dmabuf.c
+++ b/sys/i386/isa/snd/dmabuf.c
@@ -32,7 +32,7 @@
*/
#include <i386/isa/snd/sound.h>
-#include <i386/isa/snd/ulaw.h>
+#include <i386/isa/sound/ulaw.h>
#define MIN_CHUNK_SIZE 256 /* for uiomove etc. */
#define DMA_ALIGN_THRESHOLD 4
@@ -247,7 +247,7 @@ dsp_write_body(snddev_info *d, struct uio *buf)
* the previous operation.
*/
bsz = b->dl ? MIN_CHUNK_SIZE : b->bufsize ;
- while ( n = buf->uio_resid ) {
+ while ( (n = buf->uio_resid) ) {
l = min (n, bsz); /* at most n bytes ... */
s = spltty(); /* no interrupts here ... */
dsp_wr_dmaupdate(b);
@@ -761,7 +761,7 @@ snd_flush(snddev_info *d)
return -1 ;
}
if ( ret && --count == 0) {
- printf("timeout flushing dbuf_out.chan, cnt 0x%x flags 0x%08x\n",
+ printf("timeout flushing dbuf_out.chan, cnt 0x%x flags 0x%08lx\n",
b->rl, d->flags);
break;
}
diff --git a/sys/i386/isa/snd/sb_dsp.c b/sys/i386/isa/snd/sb_dsp.c
index 3d75aea..8af9908 100644
--- a/sys/i386/isa/snd/sb_dsp.c
+++ b/sys/i386/isa/snd/sb_dsp.c
@@ -208,6 +208,8 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
d->flags |= SND_F_NBIO ;
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
ask_init(d);
return 0;
@@ -420,6 +422,9 @@ sb_callback(snddev_info *d, int reason)
sb_cmd3(d->io_base, c1 , l - 1) ;
} else if (d->bd_flags & BD_F_ESS) {
/* XXX this code is still incomplete */
+ sb_cmd2(d->io_base, 0xb8, rd ? 4 : 0xe ) ; /* auto dma */
+ sb_cmd2(d->io_base, 0xa8, d->flags & SND_F_STEREO ? 1 : 2) ;
+ sb_cmd2(d->io_base, 0xb9, 2) ; /* demand dma */
} else { /* SBPro -- stereo not supported */
u_char c ;
if (!rd)
@@ -429,6 +434,10 @@ sb_callback(snddev_info *d, int reason)
c = (rd) ? 0x98 : 0x90 ;
else
c = (rd) ? 0x2c : 0x1c ;
+ if (d->flags & SND_F_STEREO)
+ sb_setmixer(d->io_base, 0xe, 2 );
+ else
+ sb_setmixer(d->io_base, 0xe, 0 );
/*
* some ESS extensions -- they can do 16 bits
*/
@@ -450,6 +459,8 @@ sb_callback(snddev_info *d, int reason)
cmd = DSP_CMD_DMAPAUSE_16 ;
if (d->bd_flags & BD_F_HISPEED) {
sb_reset_dsp(d->io_base);
+ if (d->bd_flags & BD_F_ESS)
+ sb_cmd(d->io_base, 0xc6 ); /* enable extended ESS mode */
d->flags |= SND_F_INIT ;
} else {
sb_cmd(d->io_base, cmd); /* pause dma. */
@@ -481,7 +492,7 @@ sb_reset_dsp(int io_base)
{
int loopc;
- outb(io_base + SBDSP_RST, 1);
+ outb(io_base + SBDSP_RST, 3);
DELAY(100);
outb(io_base + SBDSP_RST, 0);
for (loopc = 0; loopc<100 && !(inb(DSP_DATA_AVAIL) & 0x80); loopc++)
@@ -795,7 +806,9 @@ dsp_speed(snddev_info *d)
* simultaneously using midi.
* At the moment we do not support either...
*/
+#if 0
d->flags &= ~SND_F_STEREO;
+#endif
/*
* here enforce speed limitations.
diff --git a/sys/i386/isa/snd/sound.c b/sys/i386/isa/snd/sound.c
index ebb5374..a630ec1 100644
--- a/sys/i386/isa/snd/sound.c
+++ b/sys/i386/isa/snd/sound.c
@@ -50,7 +50,13 @@
*
*/
+#include "opt_devfs.h"
+
#include <i386/isa/snd/sound.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /* DEVFS */
+
#if NPCM > 0 /* from "snd.h" */
@@ -215,6 +221,29 @@ pcmattach(struct isa_device * dev)
isadev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&isadev, &snd_cdevsw, NULL);
+#ifdef DEVFS
+ /*
+ * XXX remember to store the returned tokens if you want to
+ * be able to remove the device later
+ */
+ devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP,
+ DV_CHR, UID_ROOT, GID_WHEEL, 0600, "dsp%n", dev->id_unit);
+ devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP16,
+ DV_CHR, UID_ROOT, GID_WHEEL, 0600, "dspW%n", dev->id_unit);
+ devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_AUDIO,
+ DV_CHR, UID_ROOT, GID_WHEEL, 0600, "audio%n", dev->id_unit);
+ devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_CTL,
+ DV_CHR, UID_ROOT, GID_WHEEL, 0600, "mixer%n", dev->id_unit);
+ devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_STATUS,
+ DV_CHR, UID_ROOT, GID_WHEEL, 0600, "sndstat%n", dev->id_unit);
+#if 0 /* these two are still unsupported... */
+ devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_MIDIN,
+ DV_CHR, UID_ROOT, GID_WHEEL, 0600, "midi%n", dev->id_unit);
+ devfs_add_devswf(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_SYNTH,
+ DV_CHR, UID_ROOT, GID_WHEEL, 0600, "sequencer%n", dev->id_unit);
+#endif
+#endif /* DEVFS */
+
/*
* should try and find a suitable value for id_id, otherwise
* the interrupt is not registered and dispatched properly.
@@ -330,7 +359,7 @@ get_snddev_info(dev_t dev, int *unit)
case SND_DEV_DSP :
case SND_DEV_DSP16 :
case SND_DEV_AUDIO :
- case SND_DEV_SEQ : /* XXX goes here... */
+ case SND_DEV_SEQ : /* XXX when enabled... */
d = & pcm_info[u] ;
break ;
case SND_DEV_SEQ2 :
@@ -687,7 +716,7 @@ sndioctl(dev_t i_dev, int cmd, caddr_t arg, int mode, struct proc * p)
{
snd_chan_param *p = (snd_chan_param *)arg;
d->play_speed = p->play_rate;
- d->rec_speed = p->play_rate; /* XXX */
+ d->rec_speed = p->play_rate; /* XXX one speed allowed */
if (p->play_format & SND_F_STEREO)
d->flags |= SND_F_STEREO ;
else
@@ -975,6 +1004,7 @@ sndioctl(dev_t i_dev, int cmd, caddr_t arg, int mode, struct proc * p)
*/
case SOUND_MIXER_READ_DEVMASK :
+ case SOUND_MIXER_READ_CAPS :
case SOUND_MIXER_READ_STEREODEVS :
*(int *)arg = d->mix_devs;
break ;
@@ -999,10 +1029,10 @@ sndioctl(dev_t i_dev, int cmd, caddr_t arg, int mode, struct proc * p)
/*
* we use the name 'select', but the new "poll" interface this is
- * really sndpoll. Second arg is not "rw" but "events"
+ * really sndpoll. Second arg for poll is not "rw" but "events"
*/
int
-sndselect(dev_t i_dev, int rw, struct proc * p)
+sndselect(dev_t i_dev, int rw, struct proc *p)
{
int dev, unit, c = 1 /* default: success */ ;
snddev_info *d ;
@@ -1011,39 +1041,24 @@ sndselect(dev_t i_dev, int rw, struct proc * p)
dev = minor(i_dev);
d = get_snddev_info(dev, &unit);
DEB(printf("sndselect dev 0x%04x rw 0x%08x\n",i_dev, rw));
- if (d == NULL ) {
-#ifdef USE_POLL
- return ( (rw & (POLLIN|POLLOUT|POLLRDNORM|POLLWRNORM)) | POLLHUP);
-#else
+ if (d == NULL ) /* should not happen! */
return (ENXIO) ;
-#endif
- }
if (d->select == NULL)
-#ifdef USE_POLL
return ( (rw & (POLLIN|POLLOUT|POLLRDNORM|POLLWRNORM)) | POLLHUP);
-#else
- return 1 ; /* always success ? */
-#endif
else if (d->select != sndselect )
return d->select(i_dev, rw, p);
else {
/* handle it here with the generic code */
-
- int lim ;
- int revents = 0 ;
-
/*
* if the user selected a block size, then we want to use the
* device as a block device, and select will return ready when
* we have a full block.
* In all other cases, select will return when 1 byte is ready.
*/
- lim = 1;
-#ifdef USE_POLL
+ int lim = 1;
+
+ int revents = 0 ;
if (rw & (POLLOUT | POLLWRNORM) ) {
-#else
- if (rw == FWRITE) {
-#endif
if ( d->flags & SND_F_HAS_SIZE )
lim = d->play_blocksize ;
/* XXX fix the test here for half duplex devices */
@@ -1054,19 +1069,12 @@ sndselect(dev_t i_dev, int rw, struct proc * p)
c = d->dbuf_out.fl ;
if (c < lim) /* no space available */
selrecord(p, & (d->wsel));
-#ifdef USE_POLL
else
revents |= rw & (POLLOUT | POLLWRNORM);
-#endif
splx(flags);
}
-#ifdef USE_POLL
}
if (rw & (POLLIN | POLLRDNORM)) {
-#else
- return c < lim ? 0 : 1 ;
- } else if (rw == FREAD) {
-#endif
if ( d->flags & SND_F_HAS_SIZE )
lim = d->rec_blocksize ;
/* XXX fix the test here */
@@ -1079,24 +1087,15 @@ sndselect(dev_t i_dev, int rw, struct proc * p)
c = d->dbuf_in.rl ;
if (c < lim) /* no data available */
selrecord(p, & (d->rsel));
-#ifdef USE_POLL
else
revents |= rw & (POLLIN | POLLRDNORM);
-#endif
splx(flags);
}
DEB(printf("sndselect on read: %d >= %d flags 0x%08x\n",
c, lim, d->flags));
return c < lim ? 0 : 1 ;
-#ifdef USE_POLL
}
return revents;
-#else
- } else {
- DDB(printf("select on exceptions, unimplemented\n"));
- return 1;
- }
-#endif
}
return ENXIO ; /* notreached */
}
@@ -1198,7 +1197,7 @@ init_status(snddev_info *d)
if (status_len != 0) /* only do init once */
return ;
sprintf(status_buf,
- "FreeBSD Audio Driver (980123) " __DATE__ " " __TIME__ "\n"
+ "FreeBSD Audio Driver (980215) " __DATE__ " " __TIME__ "\n"
"Installed devices:\n");
for (i = 0; i < NPCM_MAX; i++) {
diff --git a/sys/i386/isa/snd/sound.h b/sys/i386/isa/snd/sound.h
index 93dd406..fbcd358 100644
--- a/sys/i386/isa/snd/sound.h
+++ b/sys/i386/isa/snd/sound.h
@@ -1,5 +1,3 @@
-/* uncomment the next line for -current with select->poll changes */
-#define USE_POLL
/*
* sound.h
*
@@ -67,10 +65,9 @@
#include <i386/isa/isa_device.h>
#include <machine/clock.h> /* for DELAY */
-#ifdef USE_POLL
+/* To minimize changes with the code in 2.2.X */
#include <sys/poll.h>
#define d_select_t d_poll_t
-#endif
#else
struct isa_device { int dummy ; } ;
@@ -297,36 +294,6 @@ struct _snddev_info {
#define NPCM_MAX 8 /* Number of supported devices */
/*
- * Supported card ID numbers (were in soundcard.h...)
- */
-
-#define SNDCARD_ADLIB 1
-#define SNDCARD_SB 2
-#define SNDCARD_PAS 3
-#define SNDCARD_GUS 4
-#define SNDCARD_MPU401 5
-#define SNDCARD_SB16 6
-#define SNDCARD_SB16MIDI 7
-#define SNDCARD_UART6850 8
-#define SNDCARD_GUS16 9
-#define SNDCARD_MSS 10
-#define SNDCARD_PSS 11
-#define SNDCARD_SSCAPE 12
-#define SNDCARD_PSS_MPU 13
-#define SNDCARD_PSS_MSS 14
-#define SNDCARD_SSCAPE_MSS 15
-#define SNDCARD_TRXPRO 16
-#define SNDCARD_TRXPRO_SB 17
-#define SNDCARD_TRXPRO_MPU 18
-#define SNDCARD_MAD16 19
-#define SNDCARD_MAD16_MPU 20
-#define SNDCARD_CS4232 21
-#define SNDCARD_CS4232_MPU 22
-#define SNDCARD_MAUI 23
-#define SNDCARD_PSEUDO_MSS 24 /* MSS without WSS regs.*/
-#define SNDCARD_AWE32 25
-
-/*
* values used in bd_id for the mss boards
*/
#define MD_AD1848 0x91
@@ -346,11 +313,7 @@ struct _snddev_info {
/*
* TODO: add some card classes rather than specific types.
*/
-#ifdef KERNEL
-#include <i386/isa/snd/soundcard.h>
-#else
-#include </sys/i386/isa/snd/soundcard.h>
-#endif
+#include <machine/soundcard.h>
/*
* many variables should be reduced to a range. Here define a macro
*/
@@ -469,12 +432,6 @@ int midiattach(struct isa_device * dev);
int synthattach(struct isa_device * dev);
/*
- * functions in isa.c
- */
-
-int isa_dmastatus(int chan);
-int isa_dmastop(int chan);
-/*
* DMA buffer calls
*/
@@ -544,4 +501,9 @@ int sb_getmixer (int io_base, u_int port);
* so it is better to make this the default behaviour
*/
+/*
+ * the following flags are for PnP cards only and are undocumented
+ */
+#define DV_PNP_SBCODEC 0x1
+
#endif
OpenPOWER on IntegriCloud