The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/midivar.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: midivar.h,v 1.5 2005/11/21 18:16:38 millert Exp $     */
    2 
    3 /*
    4  * Copyright (c) 2003, 2004 Alexandre Ratchov
    5  *
    6  * Permission to use, copy, modify, and distribute this software for any
    7  * purpose with or without fee is hereby granted, provided that the above
    8  * copyright notice and this permission notice appear in all copies.
    9  *
   10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   17  */
   18 
   19 #ifndef _SYS_DEV_MIDIVAR_H_
   20 #define _SYS_DEV_MIDIVAR_H_
   21 
   22 #include <dev/midi_if.h>
   23 #include <sys/device.h>
   24 #include <sys/selinfo.h>
   25 #include <sys/proc.h>
   26 #include <sys/timeout.h>
   27 
   28 #define MIDI_MAXWRITE   32      /* max bytes to give to the uart at once */
   29 #define MIDI_RATE       3125    /* midi uart baud rate in bytes/second */
   30 #define MIDI_UNIT(a)    ((a) & 0xff)
   31 #define MIDI_DEV2SC(a)  (midi_cd.cd_devs[MIDI_UNIT(a)])
   32 
   33 #include "sequencer.h"
   34 
   35 #if NSEQUENCER > 0
   36 struct midi_dev;                /* defined in sequencervar.h */
   37 #endif
   38 
   39 /*
   40  * simple ring buffer
   41  */
   42 #define MIDIBUF_SIZE            (1 << 10)
   43 #define MIDIBUF_MASK            (MIDIBUF_SIZE - 1)
   44 struct midi_buffer {
   45         unsigned char data[MIDIBUF_SIZE]; 
   46         unsigned      start, used;
   47 };
   48 #define MIDIBUF_START(buf)      ((buf)->start)
   49 #define MIDIBUF_END(buf)        (((buf)->start + (buf)->used) & MIDIBUF_MASK)
   50 #define MIDIBUF_USED(buf)       ((buf)->used)
   51 #define MIDIBUF_AVAIL(buf)      (MIDIBUF_SIZE - (buf)->used)
   52 #define MIDIBUF_ISFULL(buf)     ((buf)->used >= MIDIBUF_SIZE)
   53 #define MIDIBUF_ISEMPTY(buf)    ((buf)->used == 0)
   54 #define MIDIBUF_WRITE(buf, byte)                                \
   55         do {                                                    \
   56                 (buf)->data[MIDIBUF_END(buf)] = (byte);         \
   57                 (buf)->used++;                                  \
   58         } while(0)
   59 #define MIDIBUF_READ(buf, byte)                                 \
   60         do {                                                    \
   61                 (byte) = (buf)->data[(buf)->start++];           \
   62                 (buf)->start &= MIDIBUF_MASK;                   \
   63                 (buf)->used--;                                  \
   64         } while(0)
   65 #define MIDIBUF_REMOVE(buf, count)                              \
   66         do {                                                    \
   67                 (buf)->start += (count);                        \
   68                 (buf)->start &= MIDIBUF_MASK;                   \
   69                 (buf)->used  -= (count);                        \
   70         } while(0)
   71 #define MIDIBUF_INIT(buf)                                       \
   72         do {                                                    \
   73                 (buf)->start = (buf)->used = 0;                 \
   74         } while(0)
   75         
   76 
   77 struct midi_softc {
   78         struct device       dev;
   79         struct midi_hw_if  *hw_if;
   80         void               *hw_hdl;
   81         int                 isopen;
   82         int                 isbusy;             /* concerns only the output */
   83         int                 isdying;
   84         int                 flags;              /* open flags */
   85         int                 props;              /* midi hw proprieties */
   86         int                 rchan;
   87         int                 wchan;
   88         unsigned            wait;               /* see midi_out_do */
   89         struct selinfo      rsel;
   90         struct selinfo      wsel;
   91         struct proc        *async;
   92         struct timeout      timeo;
   93         struct midi_buffer  inbuf;
   94         struct midi_buffer  outbuf;
   95 #if NSEQUENCER > 0
   96         int                 seqopen;
   97         struct midi_dev    *seq_md;             /* structure that links us with the seq. */
   98         int                 evindex;
   99         unsigned char       evstatus;
  100         unsigned char       evdata[2];
  101 #endif /* NSEQUENCER > 0 */
  102 };
  103 
  104 #endif /* _SYS_DEV_MIDIVAR_H_ */

Cache object: 6541837dfe5fbdebd6e6a126aa7e8438


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.