summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
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 /sys/dev/sound
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. ]
Diffstat (limited to 'sys/dev/sound')
-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
4 files changed, 46 insertions, 7 deletions
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.
OpenPOWER on IntegriCloud