diff options
Diffstat (limited to 'sys/i386/isa/sound/midi.c')
-rw-r--r-- | sys/i386/isa/sound/midi.c | 220 |
1 files changed, 112 insertions, 108 deletions
diff --git a/sys/i386/isa/sound/midi.c b/sys/i386/isa/sound/midi.c index 8d604a80abc23..6ea51b061b9cf 100644 --- a/sys/i386/isa/sound/midi.c +++ b/sys/i386/isa/sound/midi.c @@ -31,24 +31,27 @@ #ifndef EXCLUDE_CHIP_MIDI -static int generic_midi_busy[MAX_MIDI_DEV]; +static int generic_midi_busy[MAX_MIDI_DEV]; -long CMIDI_init (long mem_start) +long +CMIDI_init (long mem_start) { - - int i; - int n = num_midi_drivers; - /* int n = sizeof (midi_supported) / sizeof( struct generic_midi_info ); - */ - for (i = 0; i < n; i++) - { - if ( midi_supported[i].attach (mem_start) ) + + int i; + int n = num_midi_drivers; + + /* + * int n = sizeof (midi_supported) / sizeof( struct generic_midi_info ); + */ + for (i = 0; i < n; i++) { - printk("MIDI: Successfully attached %s\n",midi_supported[i].name); - } + if (midi_supported[i].attach (mem_start)) + { + printk ("MIDI: Successfully attached %s\n", midi_supported[i].name); + } - } - return (mem_start); + } + return (mem_start); } @@ -56,142 +59,143 @@ int CMIDI_open (int dev, struct fileinfo *file) { - int mode, err, retval; + int mode, err, retval; - dev = dev >> 4; + dev = dev >> 4; - mode = file->mode & O_ACCMODE; + mode = file->mode & O_ACCMODE; - if (generic_midi_busy[dev]) - return (RET_ERROR(EBUSY)); + if (generic_midi_busy[dev]) + return (RET_ERROR (EBUSY)); - - if (dev >= num_generic_midis) - { - printk(" MIDI device %d not installed.\n", dev); - return (ENXIO); - } - if (!generic_midi_devs[dev]) - { - printk(" MIDI device %d not initialized\n",dev); + if (dev >= num_generic_midis) + { + printk (" MIDI device %d not installed.\n", dev); return (ENXIO); - } + } + + if (!generic_midi_devs[dev]) + { + printk (" MIDI device %d not initialized\n", dev); + return (ENXIO); + } + + /* If all good and healthy, go ahead and issue call! */ - /* If all good and healthy, go ahead and issue call! */ - - retval = generic_midi_devs[dev]->open (dev, mode) ; + retval = generic_midi_devs[dev]->open (dev, mode); - /* If everything ok, set device as busy */ + /* If everything ok, set device as busy */ - if ( retval >= 0 ) - generic_midi_busy[dev] = 1; - - return ( retval ); + if (retval >= 0) + generic_midi_busy[dev] = 1; + + return (retval); } -int -CMIDI_write (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) +int +CMIDI_write (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) { - int retval; - - dev = dev >> 4; + int retval; + + dev = dev >> 4; - if (dev >= num_generic_midis) - { - printk(" MIDI device %d not installed.\n", dev); - return (ENXIO); - } + if (dev >= num_generic_midis) + { + printk (" MIDI device %d not installed.\n", dev); + return (ENXIO); + } - /* Make double sure of healthiness -- doubt - * Need we check this again?? - * - */ + /* + * Make double sure of healthiness -- doubt Need we check this again?? + * + */ - if (!generic_midi_devs[dev]) - { - printk(" MIDI device %d not initialized\n",dev); + if (!generic_midi_devs[dev]) + { + printk (" MIDI device %d not initialized\n", dev); return (ENXIO); - } + } - /* If all good and healthy, go ahead and issue call! */ + /* If all good and healthy, go ahead and issue call! */ - - retval = generic_midi_devs[dev]->write (dev, buf); - return ( retval ); + retval = generic_midi_devs[dev]->write (dev, buf); -} + return (retval); + +} int -CMIDI_read (int dev, struct fileinfo *file, snd_rw_buf *buf, int count) +CMIDI_read (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) { - int retval; - - dev = dev >> 4; - - if (dev >= num_generic_midis) - { - printk(" MIDI device %d not installed.\n", dev); - return (ENXIO); - } - - /* Make double sure of healthiness -- doubt - * Need we check this again?? - * - */ - - if (!generic_midi_devs[dev]) - { - printk(" MIDI device %d not initialized\n",dev); + int retval; + + dev = dev >> 4; + + if (dev >= num_generic_midis) + { + printk (" MIDI device %d not installed.\n", dev); return (ENXIO); - } + } - /* If all good and healthy, go ahead and issue call! */ + /* + * Make double sure of healthiness -- doubt Need we check this again?? + * + */ + + if (!generic_midi_devs[dev]) + { + printk (" MIDI device %d not initialized\n", dev); + return (ENXIO); + } + + /* If all good and healthy, go ahead and issue call! */ - - retval = generic_midi_devs[dev]->read(dev,buf); - return (retval); + retval = generic_midi_devs[dev]->read (dev, buf); + + return (retval); + +} -} - int CMIDI_close (int dev, struct fileinfo *file) { - int retval; - dev = dev >> 4; - - if (dev >= num_generic_midis) - { - printk(" MIDI device %d not installed.\n", dev); - return (ENXIO); - } - - /* Make double sure of healthiness -- doubt - * Need we check this again?? - * - */ - - if (!generic_midi_devs[dev]) - { - printk(" MIDI device %d not initialized\n",dev); + int retval; + + dev = dev >> 4; + + if (dev >= num_generic_midis) + { + printk (" MIDI device %d not installed.\n", dev); + return (ENXIO); + } + + /* + * Make double sure of healthiness -- doubt Need we check this again?? + * + */ + + if (!generic_midi_devs[dev]) + { + printk (" MIDI device %d not initialized\n", dev); return (ENXIO); - } + } - /* If all good and healthy, go ahead and issue call! */ + /* If all good and healthy, go ahead and issue call! */ - generic_midi_devs[dev]->close(dev); + generic_midi_devs[dev]->close (dev); - generic_midi_busy[dev] = 0; /* Free the device */ + generic_midi_busy[dev] = 0; /* Free the device */ - return (0) ; + return (0); } |