summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/sound/soundcard.c
diff options
context:
space:
mode:
authorswallace <swallace@FreeBSD.org>1994-03-11 10:27:25 +0000
committerswallace <swallace@FreeBSD.org>1994-03-11 10:27:25 +0000
commit0c4addc896f5d9665b20572130047785a136c047 (patch)
treeafd23eb03a99a10a280a5b897644ade0e01050a8 /sys/i386/isa/sound/soundcard.c
parentcc04fd6ad5dcc912d19e2422142eb7ba973e88da (diff)
downloadFreeBSD-src-0c4addc896f5d9665b20572130047785a136c047.zip
FreeBSD-src-0c4addc896f5d9665b20572130047785a136c047.tar.gz
Integrated Hannu Savolainen's new VoxWare sound drivers, version 2.4.
These drivers now have full SoundBlaster 16 support.
Diffstat (limited to 'sys/i386/isa/sound/soundcard.c')
-rw-r--r--sys/i386/isa/sound/soundcard.c256
1 files changed, 30 insertions, 226 deletions
diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c
index 79c9b09..3448f32 100644
--- a/sys/i386/isa/sound/soundcard.c
+++ b/sys/i386/isa/sound/soundcard.c
@@ -34,28 +34,20 @@
#include "dev_table.h"
-int __timeout_val = 0;
-int __process_aborting = 0;
-
u_int snd1mask;
u_int snd2mask;
u_int snd3mask;
u_int snd4mask;
u_int snd5mask;
-
-struct sbc_device
-{
- int usecount;
-};
+u_int snd6mask;
+u_int snd7mask;
+u_int snd8mask;
+u_int snd9mask;
#define FIX_RETURN(ret) {if ((ret)<0) return -(ret); else return 0;}
-static struct sbc_device sbc_devices[SND_NDEVS];
static int timer_running = 0;
-static int in_use = 0; /* Total # of open device files (excluding
- * minor 0) */
-
static int soundcards_installed = 0; /* Number of installed
* soundcards */
static int soundcard_configured = 0;
@@ -91,41 +83,7 @@ sndread (int dev, struct uio *buf)
dev = minor (dev);
- DEB (printk ("sound_read(dev=%d, count=%d)\n", dev, count));
-
- switch (dev & 0x0f) /* It really has to be 0x0f */
- {
- case SND_DEV_AUDIO:
- FIX_RETURN (audio_read (dev, &files[dev], buf, count));
- break;
-
- case SND_DEV_DSP:
- case SND_DEV_DSP16:
- FIX_RETURN (dsp_read (dev, &files[dev], buf, count));
- break;
-
- case SND_DEV_SEQ:
- FIX_RETURN (sequencer_read (dev, &files[dev], buf, count));
- break;
-
-#ifndef EXCLUDE_CHIP_MIDI
- case CMIDI_DEV_PRO:
- FIX_RETURN (CMIDI_read (dev, &files[dev], buf, count));
-
- break;
-#endif
-
-
-#ifndef EXCLUDE_MPU401
- case SND_DEV_MIDIN:
- FIX_RETURN (MIDIbuf_read (dev, &files[dev], buf, count));
-#endif
-
- default:
- ;
- }
-
- FIX_RETURN (-EPERM);
+ FIX_RETURN (sound_read_sw (dev, &files[dev], buf, count));
}
int
@@ -133,37 +91,9 @@ sndwrite (int dev, struct uio *buf)
{
int count = buf->uio_resid;
- DEB (printk ("sound_write(dev=%d, count=%d)\n", dev, count));
-
dev = minor (dev);
- switch (dev & 0x0f) /* It really has to be 0x0f */
- {
-
- case SND_DEV_SEQ:
- FIX_RETURN (sequencer_write (dev, &files[dev], buf, count));
- break;
-
- case SND_DEV_AUDIO:
- FIX_RETURN (audio_write (dev, &files[dev], buf, count));
- break;
-
- case SND_DEV_DSP:
- case SND_DEV_DSP16:
- FIX_RETURN (dsp_write (dev, &files[dev], buf, count));
- break;
-
-#ifndef EXCLUDE_CHIP_MIDI
- case CMIDI_DEV_PRO:
- FIX_RETURN (CMIDI_write (dev, &files[dev], buf, count));
- break;
-#endif
-
- default:
- FIX_RETURN (-EPERM);
- }
-
- FIX_RETURN (count);
+ FIX_RETURN (sound_write_sw (dev, &files[dev], buf, count));
}
int
@@ -173,16 +103,6 @@ sndopen (dev_t dev, int flags)
dev = minor (dev);
- /* printf("SND: Minor number is now : %ld\n",dev); */
-
- DEB (printk ("sound_open(dev=%d) : usecount=%d\n", dev, sbc_devices[dev].usecount));
-
- if ((dev >= SND_NDEVS) || (dev < 0))
- {
- printk ("Invalid minor device %d\n", dev);
- FIX_RETURN (-ENODEV);
- }
-
if (!soundcard_configured && dev)
{
printk ("SoundCard Error: The soundcard system has not been configured\n");
@@ -198,62 +118,7 @@ sndopen (dev_t dev, int flags)
else if (flags & FWRITE)
files[dev].mode = OPEN_WRITE;
- switch (dev & 0x0f) /* It has to be 0x0f. Trust me */
- {
- case SND_DEV_CTL:
- if (!soundcards_installed)
- if (soundcard_configured)
- {
- printk ("Soundcard not installed\n");
- FIX_RETURN (-ENODEV);
- }
- break;
-
- case SND_DEV_SEQ:
- if ((retval = sequencer_open (dev, &files[dev])) < 0)
- FIX_RETURN (retval);
- break;
-
-/** UWM stuff **/
-
-#ifndef EXCLUDE_CHIP_MIDI
- case CMIDI_DEV_PRO:
- FIX_RETURN ( CMIDI_open (dev, &files[dev]) );
- break;
-#endif
-
-
-#ifndef EXCLUDE_MPU401
- case SND_DEV_MIDIN:
- if ((retval = MIDIbuf_open (dev, &files[dev])) < 0)
- FIX_RETURN (retval);
- break;
-#endif
-
- case SND_DEV_AUDIO:
- if ((retval = audio_open (dev, &files[dev])) < 0)
- FIX_RETURN (retval);
- break;
-
- case SND_DEV_DSP:
- if ((retval = dsp_open (dev, &files[dev], 8)) < 0)
- FIX_RETURN (retval);
- break;
-
- case SND_DEV_DSP16:
- if ((retval = dsp_open (dev, &files[dev], 16)) < 0)
- FIX_RETURN (retval);
- break;
-
- default:
- printk ("Invalid minor device %d\n", dev);
- FIX_RETURN (-ENODEV);
- }
-
- sbc_devices[dev].usecount++;
- in_use++;
-
- FIX_RETURN (0);
+ FIX_RETURN(sound_open_sw (dev, &files[dev]));
}
int
@@ -262,41 +127,7 @@ sndclose (dev_t dev, int flags)
dev = minor (dev);
- DEB (printk ("sound_release(dev=%d)\n", dev));
-
- switch (dev & 0x0f) /* Has to be 0x0f */
- {
- case SND_DEV_SEQ:
- sequencer_release (dev, &files[dev]);
- break;
-
-#ifndef EXCLUDE_CHIP_MIDI
- case CMIDI_DEV_PRO:
- CMIDI_close (dev, &files[dev]);
- break;
-#endif
-
-#ifndef EXCLUDE_MPU401
- case SND_DEV_MIDIN:
- MIDIbuf_release (dev, &files[dev]);
- break;
-#endif
-
- case SND_DEV_AUDIO:
- audio_release (dev, &files[dev]);
- break;
-
- case SND_DEV_DSP:
- case SND_DEV_DSP16:
- dsp_release (dev, &files[dev]);
- break;
-
- default:;
- }
-
- sbc_devices[dev].usecount--;
- in_use--; /* If not control port */
-
+ sound_release_sw(dev, &files[dev]);
FIX_RETURN (0);
}
@@ -305,46 +136,7 @@ sndioctl (dev_t dev, int cmd, caddr_t arg, int mode)
{
dev = minor (dev);
- DEB (printk ("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg));
-
- switch (dev & 0x0f)
- {
-
- case SND_DEV_CTL:
- if (!num_mixers)
- FIX_RETURN (-ENODEV);
-
- if (dev >= num_mixers)
- FIX_RETURN (-ENODEV);
-
- FIX_RETURN (mixer_devs[dev]->ioctl (dev, cmd, (unsigned int) arg));
- break;
-
- case SND_DEV_SEQ:
- FIX_RETURN (sequencer_ioctl (dev, &files[dev], cmd, (unsigned int) arg));
- break;
-
- case SND_DEV_AUDIO:
- FIX_RETURN (audio_ioctl (dev, &files[dev], cmd, (unsigned int) arg));
- break;
-
- case SND_DEV_DSP:
- case SND_DEV_DSP16:
- FIX_RETURN (dsp_ioctl (dev, &files[dev], cmd, (unsigned int) arg));
- break;
-
-#ifndef EXCLUDE_MPU401
- case SND_DEV_MIDIN:
- FIX_RETURN (MIDIbuf_ioctl (dev, &files[dev], cmd, (unsigned int) arg));
- break;
-#endif
-
- default:
- FIX_RETURN (-EPERM);
- break;
- }
-
- FIX_RETURN (-EPERM);
+ FIX_RETURN (sound_ioctl_sw (dev, &files[dev], cmd, (unsigned int) arg));
}
int
@@ -380,7 +172,6 @@ sndprobe (struct isa_device *dev)
hw_config.io_base = dev->id_iobase;
hw_config.irq = ipri_to_irq (dev->id_irq);
hw_config.dma = dev->id_drq;
-
return sndtable_probe (dev->id_unit, &hw_config);
}
@@ -430,7 +221,6 @@ sndattach (struct isa_device *dev)
dsp_initialized = 1;
mem_start = DMAbuf_init (mem_start);
mem_start = audio_init (mem_start);
- mem_start = dsp_init (mem_start);
}
/** UWM stuff **/
@@ -459,11 +249,6 @@ sndattach (struct isa_device *dev)
mem_start = sequencer_init (mem_start);
}
- for (i = 0; i < SND_NDEVS; i++)
- {
- sbc_devices[i].usecount = 0;
- }
-
return TRUE;
}
@@ -514,7 +299,7 @@ void
sound_stop_timer (void)
{
if (timer_running)
- untimeout ((timeout_func_t)sequencer_timer, 0); /* XXX should fix */
+ untimeout ((timeout_func_t)sequencer_timer, 0);
timer_running = 0;
}
@@ -532,6 +317,7 @@ sound_mem_init (void)
{
dsp_init_mask |= (1 << dev);
+#if 1 /* 0 */
if (sound_dma_automode[dev])
{
sound_dma_automode[dev] = 0; /* Not possible with FreeBSD */
@@ -551,8 +337,10 @@ sound_mem_init (void)
dma_pagesize = 131072; /* 128k */
else
dma_pagesize = 65536;
-#endif
+#else
dma_pagesize = 4096; /* use bounce buffer */
+#endif
+
/* More sanity checks */
@@ -561,6 +349,11 @@ sound_mem_init (void)
sound_buffsizes[dev] &= ~0xfff; /* Truncate to n*4k */
if (sound_buffsizes[dev] < 4096)
sound_buffsizes[dev] = 4096;
+#else
+ dma_pagesize = 4096;
+ sound_buffsizes[dev] = 4096;
+ sound_buffcounts[dev] = 16; /* -> 64k */
+#endif
/* Now allocate the buffers */
@@ -616,4 +409,15 @@ snd_ioctl_return (int *addr, int value)
return 0;
}
+int
+snd_set_irq_handler (int interrupt_level, void(*hndlr)(int))
+{
+ return 1;
+}
+
+void
+snd_release_irq(int vect)
+{
+}
+
#endif
OpenPOWER on IntegriCloud