summaryrefslogtreecommitdiffstats
path: root/sys/dev/pcm
diff options
context:
space:
mode:
authorjmg <jmg@FreeBSD.org>1997-09-18 07:47:03 +0000
committerjmg <jmg@FreeBSD.org>1997-09-18 07:47:03 +0000
commit5280f97f953f261edc638240462e6c394f0b326b (patch)
tree526b5df60d6dc30bd18b9c3cb99357963b2cd9c1 /sys/dev/pcm
parent1754071cd4379522b965738c1e339a06907577b6 (diff)
downloadFreeBSD-src-5280f97f953f261edc638240462e6c394f0b326b.zip
FreeBSD-src-5280f97f953f261edc638240462e6c394f0b326b.tar.gz
update Luigi's driver to poll interface (Peter, you might want to check
that I've done this properly, it does work though :) )... a few minor fixes to code part-Submitted-by: Luigi
Diffstat (limited to 'sys/dev/pcm')
-rw-r--r--sys/dev/pcm/isa/mss.c26
-rw-r--r--sys/dev/pcm/isa/sb.c16
2 files changed, 16 insertions, 26 deletions
diff --git a/sys/dev/pcm/isa/mss.c b/sys/dev/pcm/isa/mss.c
index 97b328d0..c7a3551 100644
--- a/sys/dev/pcm/isa/mss.c
+++ b/sys/dev/pcm/isa/mss.c
@@ -103,7 +103,7 @@ snddev_info mss_op_desc = {
NULL /* mss_read */,
NULL /* mss_write */,
mss_ioctl,
- sndselect /* mss_select */,
+ sndpoll /* mss_poll */,
mss_intr,
mss_callback ,
@@ -138,6 +138,7 @@ mss_probe(struct isa_device *dev)
u_char tmp;
int irq = ffs(dev->id_irq) - 1;
+ bzero(&pcm_info[dev->id_unit], sizeof(pcm_info[dev->id_unit]) );
if (dev->id_iobase == -1) {
dev->id_iobase = 0x530;
printf("mss_probe: no address supplied, try default 0x%x\n",
@@ -1320,14 +1321,13 @@ cs4236_attach(u_long csn, u_long vend_id, char *name,
return ;
}
snddev_last_probed = &tmp_d;
-#if 0
- /* sb-compatible codec */
+ if (d.flags & DV_PNP_SBCODEC) {
+ printf("CS423x use sb-compatible codec\n");
dev->id_iobase = d.port[2] ;
tmp_d = sb_op_desc ;
tmp_d.alt_base = d.port[0] - 4;
d.drq[1] = 4 ; /* disable, it is not used ... */
- d.drq[0] = 0 ; /* remap ... */
-#else
+ } else {
/* mss-compatible codec */
dev->id_iobase = d.port[0] -4 ; /* XXX old mss have 4 bytes before... */
tmp_d = mss_op_desc ;
@@ -1335,7 +1335,7 @@ cs4236_attach(u_long csn, u_long vend_id, char *name,
tmp_d.alt_base = d.port[2];
strcpy(tmp_d.name, name);
tmp_d.audio_fmt |= AFMT_FULLDUPLEX ;
-#endif
+ }
write_pnp_parms( &d, ldn );
enable_pnp_card();
@@ -1344,9 +1344,6 @@ cs4236_attach(u_long csn, u_long vend_id, char *name,
dev->id_intr = pcmintr ;
dev->id_flags = DV_F_DUAL_DMA | (d.drq[1] ) ;
- pcm_info[dev->id_unit] = tmp_d; /* during the probe... */
- snddev_last_probed->probe(dev);
-
pcmattach(dev);
}
@@ -1384,7 +1381,6 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
struct pnp_cinfo d ;
snddev_info tmp_d ; /* patched copy of the basic snddev_info */
int p;
- int sb_mode = 0 ; /* XXX still not work in SB mode */
read_pnp_parms ( &d , 3 ); /* free resources taken by LDN 3 */
d.irq[0]=0; /* free irq... */
@@ -1401,7 +1397,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
enable_pnp_card();
snddev_last_probed = &tmp_d;
- tmp_d = sb_mode ? sb_op_desc : mss_op_desc ;
+ tmp_d = d.flags & DV_PNP_SBCODEC ? sb_op_desc : mss_op_desc ;
strcpy(tmp_d.name, name);
@@ -1422,11 +1418,12 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
opti_write(p, 4, 0x56 /* fifo 1/2, OPL3, audio enable, SB3.2 */ );
ad_write (&tmp_d, 10, 2); /* enable interrupts */
- if (sb_mode) { /* 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...
*/
+ printf("--- opti931 in sb mode ---\n");
opti_write(p, 6, 1); /* MCIR6 wss disable, sb enable */
/*
* swap the main and alternate iobase address since we want
@@ -1438,13 +1435,8 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
} else { /* mss-compatible codec */
tmp_d.bd_id = MD_OPTI931 ; /* to short-circuit the detect routine */
opti_write(p, 6 , 2); /* MCIR6: wss enable, sb disable */
-#if 0 /* not working yet... */
- opti_write(p, 5, 0x0 /* codec in single mode */ );
- dev->id_flags = 0 ;
-#else
opti_write(p, 5, 0x28); /* MCIR5: codec in exp. mode,fifo */
dev->id_flags = DV_F_DUAL_DMA | d.drq[1] ;
-#endif
tmp_d.audio_fmt |= AFMT_FULLDUPLEX ; /* not really well... */
tmp_d.isr = opti931_intr;
}
diff --git a/sys/dev/pcm/isa/sb.c b/sys/dev/pcm/isa/sb.c
index 4ca1f1f..ed9225f 100644
--- a/sys/dev/pcm/isa/sb.c
+++ b/sys/dev/pcm/isa/sb.c
@@ -91,7 +91,7 @@ snddev_info sb_op_desc = {
NULL /* use generic sndread */,
NULL /* use generic sndwrite */,
sb_dsp_ioctl,
- sndselect,
+ sndpoll,
sbintr,
sb_callback,
@@ -119,6 +119,7 @@ snddev_info sb_op_desc = {
static int
sb_probe(struct isa_device *dev)
{
+ bzero(&pcm_info[dev->id_unit], sizeof(pcm_info[dev->id_unit]) );
if (dev->id_iobase == -1) {
dev->id_iobase = 0x220;
printf("sb_probe: no address supplied, try defaults (0x220,0x240)\n");
@@ -259,7 +260,7 @@ sbintr(int unit)
snddev_info *d = &pcm_info[unit];
int reason = 3, c=1, io_base = d->io_base;
- DEB(printf("got sbintr for unit %d, flags 0x%08x\n", unit, d->flags));
+ DEB(printf("got sbintr for unit %d, flags 0x%08lx\n", unit, d->flags));
/*
* SB < 4.0 is half duplex and has only 1 bit for int source,
@@ -291,7 +292,7 @@ again:
if (c & 1)
inb(DSP_DATA_AVAIL); /* 8-bit int ack */
-DEB(printf("sbintr, flags 0x%08x reason %d\n", d->flags, reason));
+DEB(printf("sbintr, flags 0x%08lx reason %d\n", d->flags, reason));
if ( (d->flags & SND_F_WR_DMA) && (reason & 1) )
dsp_wrintr(d);
if ( (d->flags & SND_F_RD_DMA) && (reason & 2) )
@@ -318,7 +319,6 @@ DEB(printf("sbintr, flags 0x%08x reason %d\n", d->flags, reason));
static int
sb_callback(snddev_info *d, int reason)
{
- u_long s ;
int rd = reason & SND_CB_RD ;
int l = (rd) ? d->dbuf_in.dl0 : d->dbuf_out.dl0 ;
@@ -367,7 +367,7 @@ sb_callback(snddev_info *d, int reason)
d->dma2 = d->dma1;
d->dma1 = c ;
}
- DEB(printf("sb_init: play %d rec %d dma1 %d dma2 %d\n",
+ DEB(printf("sb_init: play %ld rec %ld dma1 %d dma2 %d\n",
d->play_fmt, d->rec_fmt, d->dma1, d->dma2));
}
/* fallthrough */
@@ -746,15 +746,14 @@ dsp_speed(snddev_info *d)
speed = 22050;
#endif
- if ((speed > 22050) && d->bd_flags & BD_F_MIDIBUSY)
- speed = 22050;
-
if (d->flags & SND_F_STEREO)
speed *= 2;
/*
* Now the speed should be valid. Compute the value to be
* programmed into the board.
+ *
+ * XXX check this code...
*/
if (speed > 22050) { /* High speed mode on 2.01/3.xx */
@@ -797,7 +796,6 @@ dsp_speed(snddev_info *d)
static void
sb_set_recsrc(snddev_info *d, int mask)
{
- u_char outmask;
u_char recdev ;
mask &= d->mix_rec_devs;
OpenPOWER on IntegriCloud