summaryrefslogtreecommitdiffstats
path: root/drivers/sound/gus_midi.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
commit27cfca1ec98e91261b1a5355d10a8996464b63af (patch)
tree8e895a53e372fa682b4c0a585b9377d67ed70d0e /drivers/sound/gus_midi.c
parent6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff)
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too o Upgrade to 2.1.89. Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'drivers/sound/gus_midi.c')
-rw-r--r--drivers/sound/gus_midi.c181
1 files changed, 78 insertions, 103 deletions
diff --git a/drivers/sound/gus_midi.c b/drivers/sound/gus_midi.c
index fdbde32fd..1055aa509 100644
--- a/drivers/sound/gus_midi.c
+++ b/drivers/sound/gus_midi.c
@@ -17,7 +17,7 @@
#include "gus_hw.h"
-#if ( defined(CONFIG_GUSHW) && defined(CONFIG_MIDI) ) || defined (MODULE)
+#if ( defined(CONFIG_GUS) && defined(CONFIG_MIDI) ) || defined (MODULE)
static int midi_busy = 0, input_opened = 0;
static int my_dev;
@@ -33,24 +33,18 @@ static volatile unsigned char qhead, qtail;
extern int gus_base, gus_irq, gus_dma;
extern int *gus_osp;
-static int
-GUS_MIDI_STATUS(void)
+static int GUS_MIDI_STATUS(void)
{
return inb(u_MidiStatus);
}
-static int
-gus_midi_open(int dev, int mode,
- void (*input) (int dev, unsigned char data),
- void (*output) (int dev)
-)
+static int gus_midi_open(int dev, int mode, void (*input) (int dev, unsigned char data), void (*output) (int dev))
{
-
if (midi_busy)
- {
- printk("GUS: Midi busy\n");
- return -EBUSY;
- }
+ {
+/* printk("GUS: Midi busy\n");*/
+ return -EBUSY;
+ }
outb((MIDI_RESET), u_MidiControl);
gus_delay();
@@ -59,10 +53,10 @@ gus_midi_open(int dev, int mode,
if (mode == OPEN_READ || mode == OPEN_READWRITE)
if (!gus_pnp_flag)
- {
- gus_midi_control |= MIDI_ENABLE_RCV;
- input_opened = 1;
- }
+ {
+ gus_midi_control |= MIDI_ENABLE_RCV;
+ input_opened = 1;
+ }
outb((gus_midi_control), u_MidiControl); /* Enable */
midi_busy = 1;
@@ -72,8 +66,7 @@ gus_midi_open(int dev, int mode,
return 0;
}
-static int
-dump_to_midi(unsigned char midi_byte)
+static int dump_to_midi(unsigned char midi_byte)
{
unsigned long flags;
int ok = 0;
@@ -84,24 +77,24 @@ dump_to_midi(unsigned char midi_byte)
cli();
if (GUS_MIDI_STATUS() & MIDI_XMIT_EMPTY)
- {
- ok = 1;
- outb((midi_byte), u_MidiData);
- } else
- {
- /*
- * Enable Midi xmit interrupts (again)
- */
- gus_midi_control |= MIDI_ENABLE_XMIT;
- outb((gus_midi_control), u_MidiControl);
- }
+ {
+ ok = 1;
+ outb((midi_byte), u_MidiData);
+ }
+ else
+ {
+ /*
+ * Enable Midi xmit interrupts (again)
+ */
+ gus_midi_control |= MIDI_ENABLE_XMIT;
+ outb((gus_midi_control), u_MidiControl);
+ }
restore_flags(flags);
return ok;
}
-static void
-gus_midi_close(int dev)
+static void gus_midi_close(int dev)
{
/*
* Reset FIFO pointers, disable intrs
@@ -111,10 +104,8 @@ gus_midi_close(int dev)
midi_busy = 0;
}
-static int
-gus_midi_out(int dev, unsigned char midi_byte)
+static int gus_midi_out(int dev, unsigned char midi_byte)
{
-
unsigned long flags;
/*
@@ -125,15 +116,14 @@ gus_midi_out(int dev, unsigned char midi_byte)
cli();
while (qlen && dump_to_midi(tmp_queue[qhead]))
- {
- qlen--;
- qhead++;
- }
-
+ {
+ qlen--;
+ qhead++;
+ }
restore_flags(flags);
/*
- * Output the byte if the local queue is empty.
+ * Output the byte if the local queue is empty.
*/
if (!qlen)
@@ -143,14 +133,13 @@ gus_midi_out(int dev, unsigned char midi_byte)
*/
/*
- * Put to the local queue
+ * Put to the local queue
*/
if (qlen >= 256)
return 0; /*
* Local queue full
*/
-
save_flags(flags);
cli();
@@ -159,35 +148,24 @@ gus_midi_out(int dev, unsigned char midi_byte)
qtail++;
restore_flags(flags);
-
return 1;
}
-static int
-gus_midi_start_read(int dev)
+static int gus_midi_start_read(int dev)
{
return 0;
}
-static int
-gus_midi_end_read(int dev)
+static int gus_midi_end_read(int dev)
{
return 0;
}
-static int
-gus_midi_ioctl(int dev, unsigned cmd, caddr_t arg)
+static void gus_midi_kick(int dev)
{
- return -EINVAL;
}
-static void
-gus_midi_kick(int dev)
-{
-}
-
-static int
-gus_midi_buffer_status(int dev)
+static int gus_midi_buffer_status(int dev)
{
unsigned long flags;
@@ -198,12 +176,11 @@ gus_midi_buffer_status(int dev)
cli();
if (qlen && dump_to_midi(tmp_queue[qhead]))
- {
- qlen--;
- qhead++;
- }
+ {
+ qlen--;
+ qhead++;
+ }
restore_flags(flags);
-
return (qlen > 0) | !(GUS_MIDI_STATUS() & MIDI_XMIT_EMPTY);
}
@@ -213,12 +190,14 @@ gus_midi_buffer_status(int dev)
static struct midi_operations gus_midi_operations =
{
- {"Gravis UltraSound Midi", 0, 0, SNDCARD_GUS},
+ {
+ "Gravis UltraSound Midi", 0, 0, SNDCARD_GUS
+ },
&std_midi_synth,
{0},
gus_midi_open,
gus_midi_close,
- gus_midi_ioctl,
+ NULL, /* ioctl */
gus_midi_out,
gus_midi_start_read,
gus_midi_end_read,
@@ -230,16 +209,15 @@ static struct midi_operations gus_midi_operations =
NULL
};
-void
-gus_midi_init(struct address_info *hw_config)
+void gus_midi_init(struct address_info *hw_config)
{
- int dev = sound_alloc_mididev();
+ int dev = sound_alloc_mididev();
if (dev == -1)
- {
- printk(KERN_INFO "gus_midi: Too many midi devices detected\n");
- return;
- }
+ {
+ printk(KERN_INFO "gus_midi: Too many midi devices detected\n");
+ return;
+ }
outb((MIDI_RESET), u_MidiControl);
std_midi_synth.midi_dev = my_dev = dev;
@@ -249,44 +227,41 @@ gus_midi_init(struct address_info *hw_config)
return;
}
-void
-gus_midi_interrupt(int dummy)
+void gus_midi_interrupt(int dummy)
{
volatile unsigned char stat, data;
- unsigned long flags;
- int timeout = 10;
+ unsigned long flags;
+ int timeout = 10;
save_flags(flags);
cli();
while (timeout-- > 0 && (stat = GUS_MIDI_STATUS()) & (MIDI_RCV_FULL | MIDI_XMIT_EMPTY))
- {
- if (stat & MIDI_RCV_FULL)
- {
- data = inb(u_MidiData);
- if (input_opened)
- midi_input_intr(my_dev, data);
- }
- if (stat & MIDI_XMIT_EMPTY)
- {
- while (qlen && dump_to_midi(tmp_queue[qhead]))
- {
- qlen--;
- qhead++;
- }
-
- if (!qlen)
- {
- /*
- * Disable Midi output interrupts, since no data in the buffer
- */
- gus_midi_control &= ~MIDI_ENABLE_XMIT;
- outb((gus_midi_control), u_MidiControl);
- outb((gus_midi_control), u_MidiControl);
- }
- }
- }
-
+ {
+ if (stat & MIDI_RCV_FULL)
+ {
+ data = inb(u_MidiData);
+ if (input_opened)
+ midi_input_intr(my_dev, data);
+ }
+ if (stat & MIDI_XMIT_EMPTY)
+ {
+ while (qlen && dump_to_midi(tmp_queue[qhead]))
+ {
+ qlen--;
+ qhead++;
+ }
+ if (!qlen)
+ {
+ /*
+ * Disable Midi output interrupts, since no data in the buffer
+ */
+ gus_midi_control &= ~MIDI_ENABLE_XMIT;
+ outb((gus_midi_control), u_MidiControl);
+ outb((gus_midi_control), u_MidiControl);
+ }
+ }
+ }
restore_flags(flags);
}