home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / LINUX-1.0 / LINUX-1 / linux / drivers / sound / midibuf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-09  |  2.8 KB  |  124 lines

  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. #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_MPU401)
  35.  
  36. #if 0
  37. #include "midiioctl.h"
  38. #include "midivar.h"
  39. #endif
  40.  
  41. static int      midibuf_busy = 0;
  42.  
  43. int
  44. MIDIbuf_open (int dev, struct fileinfo *file)
  45. {
  46.   int             mode, err;
  47.  
  48.   dev = dev >> 4;
  49.   mode = file->mode & O_ACCMODE;
  50.  
  51.   if (midibuf_busy)
  52.     return RET_ERROR (EBUSY);
  53.  
  54.   if (!mpu401_dev)
  55.     {
  56.       printk ("Midi: MPU-401 compatible Midi interface not present\n");
  57.       return RET_ERROR (ENXIO);
  58.     }
  59.  
  60.   if ((err = midi_devs[mpu401_dev]->open (mpu401_dev, mode, NULL, NULL)) < 0)
  61.     return err;
  62.  
  63.   midibuf_busy = 1;
  64.  
  65.   return RET_ERROR (ENXIO);
  66. }
  67.  
  68. void
  69. MIDIbuf_release (int dev, struct fileinfo *file)
  70. {
  71.   int             mode;
  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 (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
  82. {
  83.  
  84.   dev = dev >> 4;
  85.  
  86.   return count;
  87. }
  88.  
  89.  
  90. int
  91. MIDIbuf_read (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
  92. {
  93.   dev = dev >> 4;
  94.  
  95.   return RET_ERROR (EIO);
  96. }
  97.  
  98. int
  99. MIDIbuf_ioctl (int dev, struct fileinfo *file,
  100.            unsigned int cmd, unsigned int arg)
  101. {
  102.   dev = dev >> 4;
  103.  
  104.   switch (cmd)
  105.     {
  106.  
  107.     default:
  108.       return midi_devs[0]->ioctl (dev, cmd, arg);
  109.     }
  110. }
  111.  
  112. void
  113. MIDIbuf_bytes_received (int dev, unsigned char *buf, int count)
  114. {
  115. }
  116.  
  117. long
  118. MIDIbuf_init (long mem_start)
  119. {
  120.   return mem_start;
  121. }
  122.  
  123. #endif
  124.