1 /* $OpenBSD: umidireg.h,v 1.6 2007/06/09 11:06:53 mbalmer Exp $ */ 2 /* $NetBSD: umidireg.h,v 1.3 2003/12/04 13:57:31 keihan 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 /* Jack Descriptor */ 40 #define UMIDI_MS_HEADER 0x01 41 #define UMIDI_IN_JACK 0x02 42 #define UMIDI_OUT_JACK 0x03 43 44 /* Jack Type */ 45 #define UMIDI_EMBEDDED 0x01 46 #define UMIDI_EXTERNAL 0x02 47 48 typedef struct { 49 uByte bLength; 50 uByte bDescriptorType; 51 uByte bDescriptorSubtype; 52 uWord bcdMSC; 53 uWord wTotalLength; 54 } __packed umidi_cs_interface_descriptor_t; 55 #define UMIDI_CS_INTERFACE_DESCRIPTOR_SIZE 7 56 57 typedef struct { 58 uByte bLength; 59 uByte bDescriptorType; 60 uByte bDescriptorSubType; 61 uByte bNumEmbMIDIJack; 62 } __packed umidi_cs_endpoint_descriptor_t; 63 #define UMIDI_CS_ENDPOINT_DESCRIPTOR_SIZE 4 64 65 typedef struct { 66 uByte bLength; 67 uByte bDescriptorType; 68 uByte bDescriptorSubtype; 69 uByte bJackType; 70 uByte bJackID; 71 } __packed umidi_jack_descriptor_t; 72 #define UMIDI_JACK_DESCRIPTOR_SIZE 5 73 74 75 #define TO_D(p) ((usb_descriptor_t *)(p)) 76 #define NEXT_D(desc) TO_D((caddr_t)(desc)+(desc)->bLength) 77 #define TO_IFD(desc) ((usb_interface_descriptor_t *)(desc)) 78 #define TO_CSIFD(desc) ((umidi_cs_interface_descriptor_t *)(desc)) 79 #define TO_EPD(desc) ((usb_endpoint_descriptor_t *)(desc)) 80 #define TO_CSEPD(desc) ((umidi_cs_endpoint_descriptor_t *)(desc))