* linux/kernel/chr_drv/sound/gus_card.c
* Detection routine for the Gravis Ultrasound.
* (C) 1993 Hannu Savolainen (hsavolai@cs.helsinki.fi) See COPYING for further
* details. Should be distributed with this file.
#include "sound_config.h"
#if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_GUS)
int gus_base
, gus_irq
, gus_dma
;
set_gus_irq (int interrupt_level
)
sa
.sa_flags
= SA_INTERRUPT
;
retcode
= irqaction (interrupt_level
, &sa
);
printk ("GUS: IRQ%d already in use\n", interrupt_level
);
/* # error Unimplemented for this OS */
gus_set_midi_irq (int interrupt_level
)
sa
.sa_handler
= gus_midi_interrupt
;
sa
.sa_flags
= SA_INTERRUPT
;
retcode
= irqaction (interrupt_level
, &sa
);
printk ("GUS: IRQ%d already in use\n", interrupt_level
);
/* # error Unimplemented for this OS */
attach_gus_card (long mem_start
, struct address_info
*hw_config
)
set_gus_irq (hw_config
->irq
);
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_midi_init (mem_start
);
#ifndef EXCLUDE_GUS_IODETECT
* Look at the possible base addresses (0x2X0, X=1, 2, 3, 4, 5, 6)
for (io_addr
= 0x210; io_addr
<= 0x260; io_addr
+= 0x10)
if (io_addr
!= hw_config
->io_base
) /* Already tested */
if (gus_wave_detect (io_addr
))
printk (" WARNING! GUS found at %03x, config was %03x ", io_addr
, hw_config
->io_base
);
mem_start
= gus_wave_init (mem_start
, hw_config
->irq
, hw_config
->dma
);
mem_start
= gus_midi_init (mem_start
);
return mem_start
; /* Not detected */
probe_gus (struct address_info
*hw_config
)
if (gus_wave_detect (hw_config
->io_base
))
#ifndef EXCLUDE_GUS_IODETECT
* Look at the possible base addresses (0x2X0, X=1, 2, 3, 4, 5, 6)
for (io_addr
= 0x210; io_addr
<= 0x260; io_addr
+= 0x10)
if (io_addr
!= hw_config
->io_base
) /* Already tested */
if (gus_wave_detect (io_addr
))
if (!(src
= INB (u_IrqStatus
)))
if (src
& (MIDI_TX_IRQ
| MIDI_RX_IRQ
))
if (src
& (GF1_TIMER1_IRQ
| GF1_TIMER2_IRQ
))
gus_write8 (0x45, 0); /* Timer control */
if (src
& (WAVETABLE_IRQ
| ENVELOPE_IRQ
))