1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

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
This commit is contained in:
John-Mark Gurney 1997-09-18 07:47:03 +00:00
parent 34384756cd
commit f2ae16ee38
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29565
11 changed files with 140 additions and 170 deletions

View File

@ -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;
}

View File

@ -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 @@ sbintr(int unit)
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;

View File

@ -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;
}

View File

@ -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 @@ sbintr(int unit)
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;

View File

@ -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 @@ sbintr(int unit)
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;

View File

@ -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 @@ sbintr(int unit)
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;

View File

@ -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;
}

View File

@ -240,7 +240,7 @@ dsp_wrintr(snddev_info *d)
*/
if ( d->dma1 == d->dma2 && (d->flags & SND_F_READING) )
dsp_rdintr(d);
DEB(printf("cannot start wr-dma flags 0x%08x dma_dl %d rl %d\n",
DEB(printf("cannot start wr-dma flags 0x%08lx dma_dl %d rl %d\n",
d->flags, isa_dmastatus1(d->dma1), b->rl));
}
}
@ -276,7 +276,7 @@ dsp_write_body(snddev_info *d, struct uio *buf)
* the previous operation.
*/
bsz = (d->flags & SND_F_WR_DMA) ? 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 ... */
/*
@ -516,7 +516,7 @@ dsp_rdintr(snddev_info *d)
*/
if ( d->dma1 == d->dma2 && (d->flags & SND_F_WRITING) )
dsp_wrintr(d) ;
DEB(printf("cannot start rd-dma flags 0x%08x dma_dl %d fl %d\n",
DEB(printf("cannot start rd-dma flags 0x%08lx dma_dl %d fl %d\n",
d->flags, isa_dmastatus1(d->dma2), b->fl));
}
}
@ -831,10 +831,10 @@ dsp_rdabort(snddev_info *d)
int
snd_flush(snddev_info *d)
{
int ret, res, res1;
int ret;
int count=10;
DEB(printf("snd_flush d->flags 0x%08x\n", d->flags));
DEB(printf("snd_flush d->flags 0x%08lx\n", d->flags));
dsp_rdabort(d);
if ( d->flags & SND_F_WR_DMA ) {
/* close write */
@ -848,7 +848,7 @@ DEB(printf("snd_flush d->flags 0x%08x\n", d->flags));
return -1 ;
}
if ( ret && --count == 0) {
printf("timeout flushing dma1, cnt 0x%x flags 0x%08x\n",
printf("timeout flushing dma1, cnt 0x%x flags 0x%08lx\n",
isa_dmastatus1(d->dma1), d->flags);
return -1 ;
}

View File

@ -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 @@ sbintr(int unit)
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;

View File

@ -51,6 +51,7 @@
*/
#include <i386/isa/snd/sound.h>
#include <sys/poll.h>
#if NPCM > 0 /* from "snd.h" */
@ -75,7 +76,7 @@ static d_mmap_t sndmmap;
static struct cdevsw snd_cdevsw = {
sndopen, sndclose, sndread, sndwrite,
sndioctl, nxstop, nxreset, nxdevtotty,
sndselect, sndmmap, nxstrategy, "snd",
sndpoll, sndmmap, nxstrategy, "snd",
NULL, -1,
};
@ -271,7 +272,7 @@ print_isadev_info(struct isa_device *d, char *s)
{
if (d == NULL )
return ;
printf("%s%d at 0x%x irq %d drq %d mem 0x%x flags 0x%x en %d confl %d\n",
printf("%s%d at 0x%x irq %d drq %d mem %p flags 0x%x en %d confl %d\n",
d->id_driver ? d->id_driver->name : "NONAME",
d->id_unit,
(u_short)(d->id_iobase), ffs(d->id_irq) - 1 ,
@ -380,7 +381,8 @@ sndopen(dev_t i_dev, int flags, int mode, struct proc * p)
default:
if (d->open == NULL) {
printf("open: missing for unit %d\n", unit );
printf("open: bad unit %d, perhaps you want unit %d ?\n",
unit, unit+1 );
return (ENXIO) ;
} else
return d->open(i_dev, flags, mode, p);
@ -724,7 +726,7 @@ sndioctl(dev_t i_dev, int cmd, caddr_t arg, int mode, struct proc * p)
break ;
case AIOSYNC:
printf("AIOSYNC chan 0x%03x pos %d unimplemented\n",
printf("AIOSYNC chan 0x%03lx pos %ld unimplemented\n",
((snd_sync_parm *)arg)->chan,
((snd_sync_parm *)arg)->pos);
break;
@ -772,13 +774,13 @@ sndioctl(dev_t i_dev, int cmd, caddr_t arg, int mode, struct proc * p)
ask_init(d);
break ;
case SNDCTL_DSP_RESET:
printf("dsp reset\n");
DDB(printf("dsp reset\n"));
dsp_wrabort(d);
dsp_rdabort(d);
break ;
case SNDCTL_DSP_SYNC:
printf("dsp sync\n");
DDB(printf("dsp sync\n"));
splx(s);
snd_sync(d, 1, d->bufsize - 4); /* DMA does not start with <4 bytes */
break ;
@ -850,8 +852,10 @@ sndioctl(dev_t i_dev, int cmd, caddr_t arg, int mode, struct proc * p)
int bytes, count;
bytes = *(int *)arg & 0xffff ;
count = ( *(int *)arg >> 16) & 0xffff ;
if (bytes < 7 || bytes > 15)
return EINVAL ;
if (bytes < 7)
bytes = 7 ;
if (bytes > 15)
bytes = 15 ;
d->play_blocksize =
d->rec_blocksize = min ( 1<< bytes, d->dbuf_in.bufsize) ;
count = d->dbuf_in.bufsize / d->play_blocksize ;
@ -923,76 +927,71 @@ sndioctl(dev_t i_dev, int cmd, caddr_t arg, int mode, struct proc * p)
}
int
sndselect(dev_t i_dev, int rw, struct proc * p)
sndpoll(dev_t i_dev, int events, struct proc *p)
{
int lim ;
int revents = 0;
int dev, unit, c = 1 /* default: success */ ;
snddev_info *d ;
u_long flags;
dev = minor(i_dev);
d = get_snddev_info(dev, &unit);
DEB(printf("sndselect dev 0x%04x rw 0x%08x\n",i_dev, rw));
DEB(printf("sndpoll dev 0x%04x rw 0x%08x\n",i_dev, events));
if (d == NULL ) {
printf("select: unit %d not configured\n", unit );
return (ENXIO) ;
return ((events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM))
| POLLHUP);
}
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 */
if (d->poll == NULL)
/* is this correct hear? */
return ((events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM))
| POLLHUP);
else if (d->poll != sndpoll )
return d->poll(i_dev, events, p);
int lim ;
/* handle it here with the generic code */
/*
* 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;
switch(rw) {
case FWRITE :
if ( d->flags & SND_F_HAS_SIZE )
lim = d->play_blocksize ;
/* XXX fix the test here for half duplex devices */
if (1 /* write is compatible with current mode */) {
flags = spltty();
if (d->flags & SND_F_WR_DMA)
dsp_wr_dmaupdate(d);
c = d->dbuf_out.fl ;
if (c < lim) /* no space available */
selrecord(p, & (d->wsel));
splx(flags);
}
return c < lim ? 0 : 1 ;
case FREAD :
if ( d->flags & SND_F_HAS_SIZE )
lim = d->rec_blocksize ;
/* XXX fix the test here */
if (1 /* read is compatible with current mode */) {
flags = spltty();
if ( !(d->flags & SND_F_RD_DMA) ) /* dma idle, restart it */
dsp_rdintr(d);
else
dsp_rd_dmaupdate(d);
c = d->dbuf_in.rl ;
if (c < lim) /* no data available */
selrecord(p, & (d->rsel));
splx(flags);
}
DEB(printf("sndselect on read: %d >= %d flags 0x%08x\n",
c, lim, d->flags));
return c < lim ? 0 : 1 ;
case 0 :
DDB(printf("select on exceptions, unimplemented\n"));
return 1;
}
/*
* 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;
flags = spltty();
/* XXX fix the test here for half duplex devices */
if (events & (POLLOUT | POLLWRNORM)) {
if ( d->flags & SND_F_HAS_SIZE )
lim = d->play_blocksize ;
if (d->flags & SND_F_WR_DMA)
dsp_wr_dmaupdate(d);
c = d->dbuf_out.fl ;
if (c < lim) /* no space available */
selrecord(p, & (d->wsel));
else
revents |= events & (POLLOUT | POLLWRNORM);
}
return ENXIO ; /* notreached */
/* XXX fix the test here */
if (events & (POLLIN | POLLRDNORM)) {
if ( d->flags & SND_F_HAS_SIZE )
lim = d->rec_blocksize ;
if ( !(d->flags & SND_F_RD_DMA) ) /* dma idle, restart it */
dsp_rdintr(d);
else
dsp_rd_dmaupdate(d);
c = d->dbuf_in.rl ;
if (c < lim) /* no data available */
selrecord(p, & (d->rsel));
else
revents |= events & (POLLIN | POLLRDNORM);
DEB(printf("sndpoll on read: %d >= %d flags 0x%08lx\n", c, lim,
d->flags));
}
splx(flags);
return revents;
}
/*
@ -1021,7 +1020,7 @@ sndmmap(dev_t dev, int offset, int nprot)
{
snddev_info *d = get_snddev_info(dev, NULL);
DEB(printf("sndmmap d 0x%08x dev 0x%04x ofs 0x%08x nprot 0x%08x\n",
DEB(printf("sndmmap d %p dev 0x%04x ofs 0x%08x nprot 0x%08x\n",
d, dev, offset, nprot));
if (d == NULL || nprot & PROT_EXEC)

View File

@ -107,7 +107,7 @@ struct _snddev_info {
d_read_t *read ;
d_write_t *write ;
d_ioctl_t *ioctl ;
d_select_t *select ;
d_poll_t *poll ;
irq_proc_t *isr ;
snd_callback_t *callback;
@ -440,7 +440,7 @@ int dsp_rdabort(snddev_info *d);
void dsp_wr_dmaupdate(snddev_info *d);
void dsp_rd_dmaupdate(snddev_info *d);
d_select_t sndselect;
d_poll_t sndpoll;
/*
* library functions (in sound.c)
@ -483,4 +483,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