patch-1.3.34 linux/drivers/sound/gus_card.c
Next file: linux/drivers/sound/gus_midi.c
Previous file: linux/drivers/sound/dmabuf.c
Back to the patch index
Back to the overall index
- Lines: 187
- Date:
Wed Oct 11 07:55:40 1995
- Orig file:
v1.3.33/linux/drivers/sound/gus_card.c
- Orig date:
Tue Jul 11 10:02:52 1995
diff -u --recursive --new-file v1.3.33/linux/drivers/sound/gus_card.c linux/drivers/sound/gus_card.c
@@ -33,31 +33,40 @@
#include "gus_hw.h"
-void gusintr (INT_HANDLER_PARMS (irq, dummy));
+void gusintr (int irq, struct pt_regs *dummy);
int gus_base, gus_irq, gus_dma;
extern int gus_wave_volume;
extern int gus_pcm_volume;
extern int have_gus_max;
+sound_os_info *gus_osp;
+
long
attach_gus_card (long mem_start, struct address_info *hw_config)
{
int io_addr;
- snd_set_irq_handler (hw_config->irq, gusintr, "Gravis Ultrasound");
+ gus_osp = hw_config->osp;
+ snd_set_irq_handler (hw_config->irq, gusintr, "Gravis Ultrasound", hw_config->osp);
if (gus_wave_detect (hw_config->io_base)) /*
* Try first the default
*/
{
- mem_start = gus_wave_init (mem_start, hw_config->irq, hw_config->dma);
+ mem_start = gus_wave_init (mem_start, hw_config);
+
+ request_region (hw_config->io_base, 16, "GUS");
+ request_region (hw_config->io_base + 0x100, 12, "GUS"); /* 0x10c-> is MAX */
+
+ if (sound_alloc_dma (hw_config->dma, "GUS"))
+ printk ("gus_card.c: Can't allocate DMA channel\n");
+ if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
+ if (sound_alloc_dma (hw_config->dma2, "GUS(2)"))
+ printk ("gus_card.c: Can't allocate DMA channel2\n");
#ifndef EXCLUDE_MIDI
mem_start = gus_midi_init (mem_start);
#endif
-#ifndef EXCLUDE_SEQUENCER
- sound_timer_init (hw_config->io_base + 8);
-#endif
return mem_start;
}
@@ -73,14 +82,20 @@
*/
if (gus_wave_detect (io_addr))
{
+ hw_config->io_base = io_addr;
+
printk (" WARNING! GUS found at %x, config was %x ", io_addr, hw_config->io_base);
- mem_start = gus_wave_init (mem_start, hw_config->irq, hw_config->dma);
+ mem_start = gus_wave_init (mem_start, hw_config);
+ request_region (io_addr, 16, "GUS");
+ request_region (io_addr + 0x100, 12, "GUS"); /* 0x10c-> is MAX */
+ if (sound_alloc_dma (hw_config->dma, "GUS"))
+ printk ("gus_card.c: Can't allocate DMA channel\n");
+ if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
+ if (sound_alloc_dma (hw_config->dma2, "GUS"))
+ printk ("gus_card.c: Can't allocate DMA channel2\n");
#ifndef EXCLUDE_MIDI
mem_start = gus_midi_init (mem_start);
#endif
-#ifndef EXCLUDE_SEQUENCER
- sound_timer_init (io_addr + 8);
-#endif
return mem_start;
}
@@ -96,8 +111,12 @@
{
int io_addr;
- if (gus_wave_detect (hw_config->io_base))
- return 1;
+ gus_osp = hw_config->osp;
+
+ if (!check_region (hw_config->io_base, 16))
+ if (!check_region (hw_config->io_base + 0x100, 16))
+ if (gus_wave_detect (hw_config->io_base))
+ return 1;
#ifndef EXCLUDE_GUS_IODETECT
@@ -109,8 +128,13 @@
if (io_addr != hw_config->io_base) /*
* Already tested
*/
- if (gus_wave_detect (io_addr))
- return 1;
+ if (!check_region (io_addr, 16))
+ if (!check_region (io_addr + 0x100, 16))
+ if (gus_wave_detect (io_addr))
+ {
+ hw_config->io_base = io_addr;
+ return 1;
+ }
#endif
@@ -118,22 +142,36 @@
}
void
-gusintr (INT_HANDLER_PARMS (irq, dummy))
+unload_gus (struct address_info *hw_config)
+{
+ gus_wave_unload ();
+
+ release_region (hw_config->io_base, 16);
+ release_region (hw_config->io_base + 0x100, 12); /* 0x10c-> is MAX */
+ snd_release_irq (hw_config->irq);
+
+ sound_free_dma (hw_config->dma);
+
+ if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
+ sound_free_dma (hw_config->dma2);
+}
+
+void
+gusintr (int irq, struct pt_regs *dummy)
{
unsigned char src;
+ extern int gus_timer_enabled;
-#ifdef linux
sti ();
-#endif
#ifndef EXCLUDE_GUSMAX
if (have_gus_max)
- ad1848_interrupt (INT_HANDLER_CALL (irq));
+ ad1848_interrupt (irq, NULL);
#endif
while (1)
{
- if (!(src = INB (u_IrqStatus)))
+ if (!(src = inb (u_IrqStatus)))
return;
if (src & DMA_TC_IRQ)
@@ -151,7 +189,11 @@
if (src & (GF1_TIMER1_IRQ | GF1_TIMER2_IRQ))
{
#ifndef EXCLUDE_SEQUENCER
- sound_timer_interrupt ();
+ if (gus_timer_enabled)
+ sound_timer_interrupt ();
+ gus_write8 (0x45, 0); /* Ack IRQ */
+ gus_timer_command (4, 0x80); /* Reset IRQ flags */
+
#else
gus_write8 (0x45, 0); /* Stop timers */
#endif
@@ -174,7 +216,7 @@
int
probe_gus_db16 (struct address_info *hw_config)
{
- return ad1848_detect (hw_config->io_base);
+ return ad1848_detect (hw_config->io_base, NULL, hw_config->osp);
}
long
@@ -186,8 +228,18 @@
ad1848_init ("GUS 16 bit sampling", hw_config->io_base,
hw_config->irq,
hw_config->dma,
- hw_config->dma);
+ hw_config->dma, 0,
+ hw_config->osp);
return mem_start;
}
+void
+unload_gus_db16 (struct address_info *hw_config)
+{
+
+ ad1848_unload (hw_config->io_base,
+ hw_config->irq,
+ hw_config->dma,
+ hw_config->dma, 0);
+}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this