root/drivers/sound/midibuf.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MIDIbuf_open
  2. MIDIbuf_release
  3. MIDIbuf_write
  4. MIDIbuf_read
  5. MIDIbuf_ioctl
  6. MIDIbuf_bytes_received
  7. MIDIbuf_init

   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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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)
     /* [previous][next][first][last][top][bottom][index][help] */
  92 {
  93   dev = dev >> 4;
  94 
  95   return RET_ERROR (EIO);
  96 }
  97 
  98 int
  99 MIDIbuf_ioctl (int dev, struct fileinfo *file,
     /* [previous][next][first][last][top][bottom][index][help] */
 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)
     /* [previous][next][first][last][top][bottom][index][help] */
 114 {
 115 }
 116 
 117 long
 118 MIDIbuf_init (long mem_start)
     /* [previous][next][first][last][top][bottom][index][help] */
 119 {
 120   return mem_start;
 121 }
 122 
 123 #endif

/* [previous][next][first][last][top][bottom][index][help] */