1 /* 2 * sound/midibuf.c 3 * 4 * Device file manager for /dev/midi 5 * 6 * NOTE! This part of the driver is currently just a stub. 7 * 8 * Copyright by Hannu Savolainen 1993 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions are 12 * met: 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 2. 14 * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 */ 31
32 #include "sound_config.h"
33
34 #ifdefined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_MPU401)
35
36 #if 0
37 #include "midiioctl.h"
38 #include "midivar.h"
39 #endif 40
41 staticintmidibuf_busy = 0;
42
43 int 44 MIDIbuf_open (intdev, structfileinfo *file)
/* */ 45 { 46 intmode, err;
47
48 dev = dev >> 4;
49 mode = file->mode & O_ACCMODE;
50
51 if (midibuf_busy)
52 returnRET_ERROR (EBUSY);
53
54 if (!mpu401_dev)
55 { 56 printk ("Midi: MPU-401 compatible Midi interface not present\n");
57 returnRET_ERROR (ENXIO);
58 } 59
60 if ((err = midi_devs[mpu401_dev]->open (mpu401_dev, mode, NULL, NULL)) < 0)
61 returnerr;
62
63 midibuf_busy = 1;
64
65 returnRET_ERROR (ENXIO);
66 } 67
68 void 69 MIDIbuf_release (intdev, structfileinfo *file)
/* */ 70 { 71 intmode;
72
73 dev = dev >> 4;
74 mode = file->mode & O_ACCMODE;
75
76 midi_devs[mpu401_dev]->close (mpu401_dev);
77 midibuf_busy = 0;
78 } 79
80 int 81 MIDIbuf_write (intdev, structfileinfo *file, snd_rw_buf * buf, intcount)
/* */ 82 { 83
84 dev = dev >> 4;
85
86 returncount;
87 } 88
89
90 int 91 MIDIbuf_read (intdev, structfileinfo *file, snd_rw_buf * buf, intcount)
/* */ 92 { 93 dev = dev >> 4;
94
95 returnRET_ERROR (EIO);
96 } 97
98 int 99 MIDIbuf_ioctl (intdev, structfileinfo *file,
/* */ 100 unsignedintcmd, unsignedintarg)
101 { 102 dev = dev >> 4;
103
104 switch (cmd)
105 { 106
107 default:
108 returnmidi_devs[0]->ioctl (dev, cmd, arg);
109 } 110 } 111
112 void 113 MIDIbuf_bytes_received (intdev, unsignedchar *buf, intcount)
/* */ 114 { 115 } 116
117 long 118 MIDIbuf_init (longmem_start)
/* */ 119 { 120 returnmem_start;
121 } 122
123 #endif