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