1993-10-23 10:55:52 +00:00
|
|
|
/*
|
|
|
|
* sound/386bsd/soundcard.c
|
1995-07-28 21:40:49 +00:00
|
|
|
*
|
1993-10-29 03:44:07 +00:00
|
|
|
* Soundcard driver for FreeBSD.
|
1995-07-28 21:40:49 +00:00
|
|
|
*
|
1993-10-29 03:44:07 +00:00
|
|
|
* Copyright by Hannu Savolainen 1993
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1997-02-22 09:48:43 +00:00
|
|
|
* $Id$
|
1993-10-23 10:55:52 +00:00
|
|
|
*/
|
|
|
|
|
1996-09-10 08:32:01 +00:00
|
|
|
#include <i386/isa/sound/sound_config.h>
|
1995-12-06 23:52:35 +00:00
|
|
|
#include <vm/vm.h>
|
1995-12-10 02:53:07 +00:00
|
|
|
#include <vm/vm_extern.h>
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
#ifdef CONFIGURE_SOUNDCARD
|
|
|
|
|
1996-09-10 08:32:01 +00:00
|
|
|
#include <i386/isa/sound/dev_table.h>
|
1995-09-01 19:09:11 +00:00
|
|
|
#include <i386/isa/isa_device.h>
|
the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:43:45 +00:00
|
|
|
#include <sys/conf.h>
|
1995-11-29 10:49:16 +00:00
|
|
|
#include <sys/kernel.h>
|
|
|
|
#ifdef DEVFS
|
|
|
|
#include <sys/devfsext.h>
|
|
|
|
#endif /*DEVFS*/
|
the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:43:45 +00:00
|
|
|
|
1995-11-29 01:07:59 +00:00
|
|
|
#define FIX_RETURN(ret) { \
|
|
|
|
int tmp_ret = (ret); \
|
|
|
|
if (tmp_ret<0) return -tmp_ret; else return 0; \
|
|
|
|
}
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
static int timer_running = 0;
|
|
|
|
|
|
|
|
static int soundcards_installed = 0; /* Number of installed
|
|
|
|
* soundcards */
|
|
|
|
static int soundcard_configured = 0;
|
|
|
|
|
|
|
|
static struct fileinfo files[SND_NDEVS];
|
1996-03-28 14:31:42 +00:00
|
|
|
|
|
|
|
#ifdef DEVFS
|
1995-12-08 11:19:42 +00:00
|
|
|
static void * snd_devfs_token[SND_NDEVS];
|
|
|
|
static void * sndstat_devfs_token;
|
1996-03-28 14:31:42 +00:00
|
|
|
#endif
|
|
|
|
|
1995-03-05 04:01:29 +00:00
|
|
|
struct selinfo selinfo[SND_NDEVS >> 4];
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1995-12-11 09:26:18 +00:00
|
|
|
static int sndprobe (struct isa_device *dev);
|
|
|
|
static int sndattach (struct isa_device *dev);
|
1993-10-23 10:55:52 +00:00
|
|
|
static void sound_mem_init(void);
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static d_open_t sndopen;
|
|
|
|
static d_close_t sndclose;
|
|
|
|
static d_read_t sndread;
|
|
|
|
static d_write_t sndwrite;
|
|
|
|
static d_ioctl_t sndioctl;
|
|
|
|
static d_select_t sndselect;
|
|
|
|
|
|
|
|
#define CDEV_MAJOR 30
|
1995-12-08 23:23:00 +00:00
|
|
|
static struct cdevsw snd_cdevsw =
|
1995-12-08 11:19:42 +00:00
|
|
|
{ sndopen, sndclose, sndread, sndwrite, /*30*/
|
|
|
|
sndioctl, nostop, nullreset, nodevtotty,/* sound */
|
|
|
|
sndselect, nommap, NULL, "snd", NULL, -1 };
|
|
|
|
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
struct isa_driver opldriver = {sndprobe, sndattach, "opl"};
|
|
|
|
struct isa_driver sbdriver = {sndprobe, sndattach, "sb"};
|
|
|
|
struct isa_driver sbxvidriver = {sndprobe, sndattach, "sbxvi"};
|
|
|
|
struct isa_driver sbmididriver = {sndprobe, sndattach, "sbmidi"};
|
1996-11-15 18:35:35 +00:00
|
|
|
struct isa_driver awedriver = {sndprobe, sndattach, "awe"};
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
struct isa_driver pasdriver = {sndprobe, sndattach, "pas"};
|
|
|
|
struct isa_driver mpudriver = {sndprobe, sndattach, "mpu"};
|
|
|
|
struct isa_driver gusdriver = {sndprobe, sndattach, "gus"};
|
|
|
|
struct isa_driver gusxvidriver = {sndprobe, sndattach, "gusxvi"};
|
|
|
|
struct isa_driver gusmaxdriver = {sndprobe, sndattach, "gusmax"};
|
|
|
|
struct isa_driver uartdriver = {sndprobe, sndattach, "uart"};
|
|
|
|
struct isa_driver mssdriver = {sndprobe, sndattach, "mss"};
|
1996-11-02 10:41:28 +00:00
|
|
|
#ifdef PC98
|
|
|
|
struct isa_driver pcmdriver = {sndprobe, sndattach, "pcm"};
|
|
|
|
#endif
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
|
1995-09-01 19:09:11 +00:00
|
|
|
static unsigned short
|
|
|
|
ipri_to_irq (unsigned short ipri);
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
void
|
1995-09-01 19:09:11 +00:00
|
|
|
adintr(INT_HANDLER_PARMS(unit,dummy))
|
1995-07-28 21:40:49 +00:00
|
|
|
{
|
|
|
|
#ifndef EXCLUDE_AD1848
|
1995-09-01 19:09:11 +00:00
|
|
|
static short unit_to_irq[4] = { -1, -1, -1, -1 };
|
|
|
|
struct isa_device *dev;
|
|
|
|
|
|
|
|
if (unit_to_irq [unit] > 0)
|
|
|
|
ad1848_interrupt(INT_HANDLER_CALL (unit_to_irq [unit]));
|
|
|
|
else {
|
|
|
|
dev = find_isadev (isa_devtab_null, &mssdriver, unit);
|
|
|
|
if (!dev)
|
|
|
|
printk ("ad1848: Couldn't determine unit\n");
|
|
|
|
else {
|
|
|
|
unit_to_irq [unit] = ipri_to_irq (dev->id_irq);
|
|
|
|
ad1848_interrupt(INT_HANDLER_CALL (unit_to_irq [unit]));
|
|
|
|
}
|
|
|
|
}
|
1995-07-28 21:40:49 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
1994-03-23 19:27:52 +00:00
|
|
|
unsigned
|
1993-12-19 00:55:01 +00:00
|
|
|
long
|
1994-04-23 04:16:53 +00:00
|
|
|
get_time(void)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-23 19:27:52 +00:00
|
|
|
struct timeval timecopy;
|
1994-03-24 22:23:51 +00:00
|
|
|
int x;
|
|
|
|
|
|
|
|
x = splclock();
|
1994-03-23 19:27:52 +00:00
|
|
|
timecopy = time;
|
|
|
|
splx(x);
|
1994-03-24 22:23:51 +00:00
|
|
|
return timecopy.tv_usec/(1000000/HZ) +
|
1994-03-23 19:27:52 +00:00
|
|
|
(unsigned long)timecopy.tv_sec*HZ;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
1995-07-28 21:40:49 +00:00
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 19:57:13 +00:00
|
|
|
sndread (dev_t dev, struct uio *buf, int ioflag)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
int count = buf->uio_resid;
|
|
|
|
|
|
|
|
dev = minor (dev);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
FIX_RETURN (sound_read_sw (dev, &files[dev], buf, count));
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 19:57:13 +00:00
|
|
|
sndwrite (dev_t dev, struct uio *buf, int ioflag)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
int count = buf->uio_resid;
|
|
|
|
|
|
|
|
dev = minor (dev);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
FIX_RETURN (sound_write_sw (dev, &files[dev], buf, count));
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 19:57:13 +00:00
|
|
|
sndopen (dev_t dev, int flags, int fmt, struct proc *p)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
dev = minor (dev);
|
|
|
|
|
|
|
|
if (!soundcard_configured && dev)
|
|
|
|
{
|
|
|
|
printk ("SoundCard Error: The soundcard system has not been configured\n");
|
|
|
|
FIX_RETURN (-ENODEV);
|
|
|
|
}
|
|
|
|
|
|
|
|
files[dev].mode = 0;
|
|
|
|
|
|
|
|
if (flags & FREAD && flags & FWRITE)
|
|
|
|
files[dev].mode = OPEN_READWRITE;
|
|
|
|
else if (flags & FREAD)
|
|
|
|
files[dev].mode = OPEN_READ;
|
|
|
|
else if (flags & FWRITE)
|
|
|
|
files[dev].mode = OPEN_WRITE;
|
|
|
|
|
1995-03-05 04:01:29 +00:00
|
|
|
selinfo[dev >> 4].si_pid = 0;
|
|
|
|
selinfo[dev >> 4].si_flags = 0;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
FIX_RETURN(sound_open_sw (dev, &files[dev]));
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 19:57:13 +00:00
|
|
|
sndclose (dev_t dev, int flags, int fmt, struct proc *p)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
dev = minor (dev);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sound_release_sw(dev, &files[dev]);
|
1993-10-23 10:55:52 +00:00
|
|
|
FIX_RETURN (0);
|
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 19:57:13 +00:00
|
|
|
sndioctl (dev_t dev, int cmd, caddr_t arg, int flags, struct proc *p)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
dev = minor (dev);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
FIX_RETURN (sound_ioctl_sw (dev, &files[dev], cmd, (unsigned int) arg));
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static int
|
1995-09-08 19:57:13 +00:00
|
|
|
sndselect (dev_t dev, int rw, struct proc *p)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
dev = minor (dev);
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
DEB (printk ("snd_select(dev=%d, rw=%d, pid=%d)\n", dev, rw, p->p_pid));
|
|
|
|
#ifdef ALLOW_SELECT
|
|
|
|
switch (dev & 0x0f)
|
|
|
|
{
|
|
|
|
#ifndef EXCLUDE_SEQUENCER
|
|
|
|
case SND_DEV_SEQ:
|
|
|
|
case SND_DEV_SEQ2:
|
|
|
|
return sequencer_select (dev, &files[dev], rw, p);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_MIDI
|
|
|
|
case SND_DEV_MIDIN:
|
|
|
|
return MIDIbuf_select (dev, &files[dev], rw, p);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_AUDIO
|
|
|
|
case SND_DEV_DSP:
|
|
|
|
case SND_DEV_DSP16:
|
|
|
|
case SND_DEV_AUDIO:
|
|
|
|
return audio_select (dev, &files[dev], rw, p);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1993-11-09 01:20:33 +00:00
|
|
|
static unsigned short
|
1993-10-29 03:44:07 +00:00
|
|
|
ipri_to_irq (unsigned short ipri)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Converts the ipri (bitmask) to the corresponding irq number
|
|
|
|
*/
|
|
|
|
int irq;
|
|
|
|
|
|
|
|
for (irq = 0; irq < 16; irq++)
|
|
|
|
if (ipri == (1 << irq))
|
|
|
|
return irq;
|
|
|
|
|
|
|
|
return -1; /* Invalid argument */
|
|
|
|
}
|
|
|
|
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
static int
|
|
|
|
driver_to_voxunit(struct isa_driver *driver)
|
|
|
|
{
|
|
|
|
/* converts a sound driver pointer into the equivalent
|
|
|
|
VoxWare device unit number */
|
|
|
|
if(driver == &opldriver)
|
|
|
|
return(SNDCARD_ADLIB);
|
|
|
|
else if(driver == &sbdriver)
|
|
|
|
return(SNDCARD_SB);
|
|
|
|
else if(driver == &pasdriver)
|
|
|
|
return(SNDCARD_PAS);
|
|
|
|
else if(driver == &gusdriver)
|
|
|
|
return(SNDCARD_GUS);
|
|
|
|
else if(driver == &mpudriver)
|
|
|
|
return(SNDCARD_MPU401);
|
|
|
|
else if(driver == &sbxvidriver)
|
|
|
|
return(SNDCARD_SB16);
|
|
|
|
else if(driver == &sbmididriver)
|
|
|
|
return(SNDCARD_SB16MIDI);
|
1996-11-15 18:35:35 +00:00
|
|
|
else if(driver == &awedriver)
|
|
|
|
return(SNDCARD_AWE32);
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
else if(driver == &uartdriver)
|
|
|
|
return(SNDCARD_UART6850);
|
|
|
|
else if(driver == &gusdriver)
|
|
|
|
return(SNDCARD_GUS16);
|
|
|
|
else if(driver == &mssdriver)
|
|
|
|
return(SNDCARD_MSS);
|
1996-11-02 10:41:28 +00:00
|
|
|
#ifdef PC98
|
|
|
|
else if(driver == &pcmdriver)
|
|
|
|
return(SNDCARD_PCM86);
|
|
|
|
#endif
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
else
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
1995-12-11 09:26:18 +00:00
|
|
|
static int
|
1993-10-23 10:55:52 +00:00
|
|
|
sndprobe (struct isa_device *dev)
|
|
|
|
{
|
|
|
|
struct address_info hw_config;
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
int unit;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
unit = driver_to_voxunit(dev->id_driver);
|
1993-10-23 10:55:52 +00:00
|
|
|
hw_config.io_base = dev->id_iobase;
|
|
|
|
hw_config.irq = ipri_to_irq (dev->id_irq);
|
|
|
|
hw_config.dma = dev->id_drq;
|
1995-07-28 21:40:49 +00:00
|
|
|
hw_config.dma_read = dev->id_flags; /* misuse the flags field for read dma*/
|
|
|
|
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
if(unit)
|
1996-11-02 10:41:28 +00:00
|
|
|
#ifdef PC98
|
|
|
|
if(unit == SNDCARD_PCM86) {
|
|
|
|
int result;
|
|
|
|
|
|
|
|
result = sndtable_probe (unit, &hw_config);
|
|
|
|
dev->id_iobase = hw_config.io_base;
|
|
|
|
dev->id_irq = (1 << hw_config.irq);
|
|
|
|
dev->id_drq = hw_config.dma;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
return sndtable_probe (unit, &hw_config);
|
|
|
|
else
|
|
|
|
return 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1995-12-11 09:26:18 +00:00
|
|
|
static int
|
1993-10-23 10:55:52 +00:00
|
|
|
sndattach (struct isa_device *dev)
|
|
|
|
{
|
1995-12-11 09:26:18 +00:00
|
|
|
int unit;
|
1997-01-15 03:42:30 +00:00
|
|
|
int minor;
|
|
|
|
int voxunit;
|
1993-10-23 10:55:52 +00:00
|
|
|
static int midi_initialized = 0;
|
|
|
|
static int seq_initialized = 0;
|
1993-12-19 00:55:01 +00:00
|
|
|
unsigned long mem_start = 0xefffffffUL;
|
1993-10-23 10:55:52 +00:00
|
|
|
struct address_info hw_config;
|
|
|
|
|
1997-01-15 03:42:30 +00:00
|
|
|
unit = dev->id_unit;
|
|
|
|
voxunit = driver_to_voxunit(dev->id_driver);
|
1993-10-23 10:55:52 +00:00
|
|
|
hw_config.io_base = dev->id_iobase;
|
|
|
|
hw_config.irq = ipri_to_irq (dev->id_irq);
|
|
|
|
hw_config.dma = dev->id_drq;
|
1995-07-28 21:40:49 +00:00
|
|
|
hw_config.dma_read = dev->id_flags; /* misuse the flags field for read dma*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1997-01-15 03:42:30 +00:00
|
|
|
if(!voxunit)
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
return FALSE;
|
1997-01-15 03:42:30 +00:00
|
|
|
if (!sndtable_init_card (voxunit, &hw_config))
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
{
|
|
|
|
printf (" <Driver not configured>");
|
|
|
|
return FALSE;
|
|
|
|
}
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Init the high level sound driver
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!(soundcards_installed = sndtable_get_cardcount ()))
|
|
|
|
{
|
|
|
|
printf (" <No such hardware>");
|
|
|
|
return FALSE; /* No cards detected */
|
|
|
|
}
|
|
|
|
|
1993-10-29 03:44:07 +00:00
|
|
|
printf("\n");
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#ifndef EXCLUDE_AUDIO
|
1994-10-01 02:17:17 +00:00
|
|
|
if (num_audiodevs) /* Audio devices present */
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
mem_start = DMAbuf_init (mem_start);
|
|
|
|
mem_start = audio_init (mem_start);
|
1994-10-01 02:17:17 +00:00
|
|
|
sound_mem_init ();
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
soundcard_configured = 1;
|
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
#ifndef EXCLUDE_MIDI
|
1993-10-23 10:55:52 +00:00
|
|
|
if (num_midis && !midi_initialized)
|
|
|
|
{
|
|
|
|
midi_initialized = 1;
|
|
|
|
mem_start = MIDIbuf_init (mem_start);
|
|
|
|
}
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
#ifndef EXCLUDE_SEQUENCER
|
1993-10-23 10:55:52 +00:00
|
|
|
if ((num_midis + num_synths) && !seq_initialized)
|
|
|
|
{
|
|
|
|
seq_initialized = 1;
|
|
|
|
mem_start = sequencer_init (mem_start);
|
|
|
|
}
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
#ifdef DEVFS
|
|
|
|
/* XXX */ /* should only create devices if that card has them */
|
1997-01-15 03:42:30 +00:00
|
|
|
if ( ! sndstat_devfs_token)
|
|
|
|
{
|
|
|
|
sndstat_devfs_token =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, SND_DEV_STATUS, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "sndstat");
|
|
|
|
}
|
|
|
|
|
|
|
|
minor = (unit << 4)+SND_DEV_CTL;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "mixer%d", unit);
|
|
|
|
}
|
1995-12-08 11:19:42 +00:00
|
|
|
|
|
|
|
#ifndef EXCLUDE_SEQUENCER
|
1997-01-15 03:42:30 +00:00
|
|
|
minor = (unit << 4)+SND_DEV_SEQ;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "sequencer%d", unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
minor = (unit << 4)+SND_DEV_SEQ2;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "music%d", unit);
|
|
|
|
}
|
1995-12-08 11:19:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_MIDI
|
1997-01-15 03:42:30 +00:00
|
|
|
minor = (unit << 4)+SND_DEV_MIDIN;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "midi%d", unit);
|
|
|
|
}
|
1995-12-08 11:19:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_AUDIO
|
1997-01-15 03:42:30 +00:00
|
|
|
minor = (unit << 4)+SND_DEV_DSP;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "dsp%d", unit);
|
|
|
|
}
|
1995-12-08 11:19:42 +00:00
|
|
|
|
1997-01-15 03:42:30 +00:00
|
|
|
minor = (unit << 4)+SND_DEV_AUDIO;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "audio%d", unit);
|
|
|
|
}
|
1995-12-08 11:19:42 +00:00
|
|
|
|
1997-01-15 03:42:30 +00:00
|
|
|
minor = (unit << 4)+SND_DEV_DSP16;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "dspW%d", unit);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
minor = (unit << 4)+SND_DEV_SNDPROC;
|
|
|
|
if ( ! snd_devfs_token[minor])
|
|
|
|
{
|
|
|
|
snd_devfs_token[minor] =
|
|
|
|
devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, UID_ROOT,
|
|
|
|
GID_WHEEL, 0600, "pss%d", unit);
|
1995-12-08 11:19:42 +00:00
|
|
|
}
|
|
|
|
#endif /* DEVFS */
|
1993-10-23 10:55:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tenmicrosec (void)
|
|
|
|
{
|
1994-04-11 21:27:00 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
inb (0x80);
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
#ifndef EXCLUDE_SEQUENCER
|
1993-10-23 10:55:52 +00:00
|
|
|
void
|
|
|
|
request_sound_timer (int count)
|
|
|
|
{
|
|
|
|
static int current = 0;
|
|
|
|
int tmp = count;
|
|
|
|
|
|
|
|
if (count < 0)
|
1993-11-25 01:38:01 +00:00
|
|
|
timeout ((timeout_func_t)sequencer_timer, 0, -count);
|
1993-10-23 10:55:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
if (count < current)
|
|
|
|
current = 0; /* Timer restarted */
|
|
|
|
|
|
|
|
count = count - current;
|
|
|
|
|
|
|
|
current = tmp;
|
|
|
|
|
|
|
|
if (!count)
|
|
|
|
count = 1;
|
|
|
|
|
1993-11-25 01:38:01 +00:00
|
|
|
timeout ((timeout_func_t)sequencer_timer, 0, count);
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
timer_running = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sound_stop_timer (void)
|
|
|
|
{
|
|
|
|
if (timer_running)
|
1994-03-11 10:27:25 +00:00
|
|
|
untimeout ((timeout_func_t)sequencer_timer, 0);
|
1993-10-23 10:55:52 +00:00
|
|
|
timer_running = 0;
|
|
|
|
}
|
Reorganize how sound devices are configured. Use a snd controller
with individual devices for each type of sound card:
opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart
EXCLUDE_* options are no longer required to be included in the config file.
They are automatically determined by local.h depending on the devices
included.
Move #includes in local.h to os.h so files are included in the proper
order to avoid warnings.
soundcard.c now has additional code to reflect the device driver
routines needed.
Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h.
#ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to
soundcard.c and sound_switch.c where appropriate.
Probe outputs changed to reflect new device names.
Readme.freebsd not needed. Update sound.doc with new config instructions.
Reviewed by: wollman
1995-03-12 23:34:12 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
#ifndef EXCLUDE_AUDIO
|
|
|
|
static void
|
|
|
|
sound_mem_init (void)
|
|
|
|
{
|
1995-12-11 09:26:18 +00:00
|
|
|
int dev;
|
1993-10-23 10:55:52 +00:00
|
|
|
unsigned long dma_pagesize;
|
1994-10-01 02:17:17 +00:00
|
|
|
struct dma_buffparms *dmap;
|
1993-10-23 10:55:52 +00:00
|
|
|
static unsigned long dsp_init_mask = 0;
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
for (dev = 0; dev < num_audiodevs; dev++) /* Enumerate devices */
|
1993-10-23 10:55:52 +00:00
|
|
|
if (!(dsp_init_mask & (1 << dev))) /* Not already done */
|
1996-11-02 10:41:28 +00:00
|
|
|
#ifdef PC98
|
|
|
|
if (audio_devs[dev]->buffcount > 0 && audio_devs[dev]->dmachan >= 0)
|
|
|
|
#else
|
1994-10-01 02:17:17 +00:00
|
|
|
if (audio_devs[dev]->buffcount > 0 && audio_devs[dev]->dmachan > 0)
|
1996-11-02 10:41:28 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
dsp_init_mask |= (1 << dev);
|
1994-10-01 02:17:17 +00:00
|
|
|
dmap = audio_devs[dev]->dmap;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (audio_devs[dev]->flags & DMA_AUTOMODE)
|
|
|
|
audio_devs[dev]->buffcount = 1;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1996-01-18 20:54:15 +00:00
|
|
|
audio_devs[dev]->buffsize &= ~0xfff; /* Truncate to n*4k */
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (audio_devs[dev]->dmachan > 3 && audio_devs[dev]->buffsize > 65536)
|
1993-10-23 10:55:52 +00:00
|
|
|
dma_pagesize = 131072; /* 128k */
|
|
|
|
else
|
1994-01-08 16:48:35 +00:00
|
|
|
dma_pagesize = 65536;
|
1994-03-11 10:27:25 +00:00
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
/* More sanity checks */
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (audio_devs[dev]->buffsize > dma_pagesize)
|
|
|
|
audio_devs[dev]->buffsize = dma_pagesize;
|
|
|
|
if (audio_devs[dev]->buffsize < 4096)
|
|
|
|
audio_devs[dev]->buffsize = 4096;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
/* Now allocate the buffers */
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
for (dmap->raw_count = 0; dmap->raw_count < audio_devs[dev]->buffcount; dmap->raw_count++)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-10-01 02:17:17 +00:00
|
|
|
char *tmpbuf = (char *)vm_page_alloc_contig(audio_devs[dev]->buffsize, 0ul, 0xfffffful, dma_pagesize);
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
if (tmpbuf == NULL)
|
|
|
|
{
|
1995-12-11 09:26:18 +00:00
|
|
|
printk ("snd: Unable to allocate %ld bytes of buffer\n",
|
1994-10-01 02:17:17 +00:00
|
|
|
audio_devs[dev]->buffsize);
|
1993-10-23 10:55:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
dmap->raw_buf[dmap->raw_count] = tmpbuf;
|
1993-10-23 10:55:52 +00:00
|
|
|
/*
|
|
|
|
* Use virtual address as the physical address, since
|
|
|
|
* isa_dmastart performs the phys address computation.
|
|
|
|
*/
|
1994-10-01 02:17:17 +00:00
|
|
|
dmap->raw_buf_phys[dmap->raw_count] =
|
|
|
|
(unsigned long) dmap->raw_buf[dmap->raw_count];
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
} /* for dev */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
int
|
1995-07-28 21:40:49 +00:00
|
|
|
snd_set_irq_handler (int interrupt_level, INT_HANDLER_PROTO(), char *name)
|
1994-03-11 10:27:25 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
void
|
|
|
|
snd_release_irq(int vect)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:43:45 +00:00
|
|
|
static snd_devsw_installed = 0;
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static void
|
|
|
|
snd_drvinit(void *unused)
|
the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:43:45 +00:00
|
|
|
{
|
1995-11-29 10:49:16 +00:00
|
|
|
dev_t dev;
|
|
|
|
|
the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:43:45 +00:00
|
|
|
if( ! snd_devsw_installed ) {
|
1995-12-08 11:19:42 +00:00
|
|
|
dev = makedev(CDEV_MAJOR, 0);
|
|
|
|
cdevsw_add(&dev,&snd_cdevsw, NULL);
|
the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:43:45 +00:00
|
|
|
snd_devsw_installed = 1;
|
1995-11-29 14:41:20 +00:00
|
|
|
}
|
the second set of changes in a move towards getting devices to be
totally dynamic. (the first was about 7 weeeks ago)
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:43:45 +00:00
|
|
|
}
|
1995-11-29 10:49:16 +00:00
|
|
|
|
|
|
|
SYSINIT(snddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snd_drvinit,NULL)
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
#endif
|
1995-11-29 10:49:16 +00:00
|
|
|
|