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/usb/umidivar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: umidivar.h,v 1.7 2003/12/05 06:05:53 gson Exp $        */
    2 /*
    3  * Copyright (c) 2001 The NetBSD Foundation, Inc.
    4  * All rights reserved.
    5  *
    6  * This code is derived from software contributed to The NetBSD Foundation
    7  * by Takuya SHIOZAKI (tshiozak@NetBSD.org).
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. All advertising materials mentioning features or use of this software
   18  *    must display the following acknowledgement:
   19  *        This product includes software developed by the NetBSD
   20  *        Foundation, Inc. and its contributors.
   21  * 4. Neither the name of The NetBSD Foundation nor the names of its
   22  *    contributors may be used to endorse or promote products derived
   23  *    from this software without specific prior written permission.
   24  *
   25  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   26  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   27  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   28  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   29  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   32  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   33  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   35  * POSSIBILITY OF SUCH DAMAGE.
   36  */
   37 
   38 /* pending MUX-MIDI packet */
   39 typedef enum {
   40         PS_EXCL_0=-2,   /* put, and next state is PS_EXCL_0 */
   41         PS_END=-1,      /* put, and next state is PS_INITIAL */
   42         PS_INITIAL=0,   /* 0>= : not put, and state is keeped */
   43         PS_NORMAL_1OF3=1,
   44         PS_NORMAL_2OF3=2,
   45         PS_NORMAL_1OF2=3,
   46         PS_EXCL_1=4,
   47         PS_EXCL_2=5
   48 } packet_state_t;
   49 
   50 #define UMIDI_PACKET_SIZE 4
   51 struct umidi_packet {
   52         char            buffer[UMIDI_PACKET_SIZE];
   53         packet_state_t  state;
   54 };
   55 
   56 /*
   57  * hierarchie
   58  *
   59  * <-- parent          child -->
   60  *
   61  * umidi(sc) -> endpoint -> jack   <- (dynamically assignable) - mididev
   62  *         ^     |    ^     |
   63  *         +-----+    +-----+
   64  */
   65 
   66 /* midi device */
   67 struct umidi_mididev {
   68         struct umidi_softc      *sc;
   69         struct device           *mdev;
   70         /* */
   71         struct umidi_jack       *in_jack;
   72         struct umidi_jack       *out_jack;
   73         /* */
   74         int                     opened;
   75         int                     flags;
   76 };
   77 
   78 /* Jack Information */
   79 struct umidi_jack {
   80         struct umidi_endpoint   *endpoint;
   81         /* */
   82         int                     cable_number;
   83         struct umidi_packet     packet;
   84         void                    *arg;
   85         int                     binded;
   86         int                     opened;
   87         union {
   88                 struct {
   89                         void                    (*intr)(void *);
   90                         LIST_ENTRY(umidi_jack)  queue_entry;
   91                 } out;
   92                 struct {
   93                         void                    (*intr)(void *, int);
   94                 } in;
   95         } u;
   96 };
   97 
   98 #define UMIDI_MAX_EPJACKS       16
   99 /* endpoint data */
  100 struct umidi_endpoint {
  101         struct umidi_softc      *sc;
  102         /* */
  103         int                     addr;
  104         usbd_pipe_handle        pipe;
  105         usbd_xfer_handle        xfer;
  106         unsigned char           *buffer;
  107         int                     num_open;
  108         int                     num_jacks;
  109         struct umidi_jack       *jacks[UMIDI_MAX_EPJACKS];
  110         LIST_HEAD(, umidi_jack) queue_head;
  111         struct umidi_jack       *queue_tail;
  112 };
  113 
  114 /* software context */
  115 struct umidi_softc {
  116         USBBASEDEVICE           sc_dev;
  117         usbd_device_handle      sc_udev;
  118         usbd_interface_handle   sc_iface;
  119         struct umidi_quirk      *sc_quirk;
  120 
  121         int                     sc_dying;
  122 
  123         int                     sc_out_num_jacks;
  124         struct umidi_jack       *sc_out_jacks;
  125         int                     sc_in_num_jacks;
  126         struct umidi_jack       *sc_in_jacks;
  127         struct umidi_jack       *sc_jacks;
  128 
  129         int                     sc_num_mididevs;
  130         struct umidi_mididev    *sc_mididevs;
  131 
  132         int                     sc_out_num_endpoints;
  133         struct umidi_endpoint   *sc_out_ep;
  134         int                     sc_in_num_endpoints;
  135         struct umidi_endpoint   *sc_in_ep;
  136         struct umidi_endpoint   *sc_endpoints;
  137 };

Cache object: f438f2826628490e992e07a83e634c7a


[ 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.