1*ab0b1be7Smglocker /* $OpenBSD: umidireg.h,v 1.8 2013/04/15 09:23:02 mglocker Exp $ */ 2081bdb75Sderaadt /* $NetBSD: umidireg.h,v 1.3 2003/12/04 13:57:31 keihan Exp $ */ 3c925c334Snate /* 4c925c334Snate * Copyright (c) 2001 The NetBSD Foundation, Inc. 5c925c334Snate * All rights reserved. 6c925c334Snate * 7c925c334Snate * This code is derived from software contributed to The NetBSD Foundation 8081bdb75Sderaadt * by Takuya SHIOZAKI (tshiozak@NetBSD.org). 9c925c334Snate * 10c925c334Snate * Redistribution and use in source and binary forms, with or without 11c925c334Snate * modification, are permitted provided that the following conditions 12c925c334Snate * are met: 13c925c334Snate * 1. Redistributions of source code must retain the above copyright 14c925c334Snate * notice, this list of conditions and the following disclaimer. 15c925c334Snate * 2. Redistributions in binary form must reproduce the above copyright 16c925c334Snate * notice, this list of conditions and the following disclaimer in the 17c925c334Snate * documentation and/or other materials provided with the distribution. 18c925c334Snate * 19c925c334Snate * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20c925c334Snate * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21c925c334Snate * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22c925c334Snate * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23c925c334Snate * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24c925c334Snate * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25c925c334Snate * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26c925c334Snate * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27c925c334Snate * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28c925c334Snate * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29c925c334Snate * POSSIBILITY OF SUCH DAMAGE. 30c925c334Snate */ 31c925c334Snate 32c925c334Snate /* Jack Descriptor */ 33c925c334Snate #define UMIDI_MS_HEADER 0x01 34c925c334Snate #define UMIDI_IN_JACK 0x02 35c925c334Snate #define UMIDI_OUT_JACK 0x03 36c925c334Snate 37c925c334Snate /* Jack Type */ 38c925c334Snate #define UMIDI_EMBEDDED 0x01 39c925c334Snate #define UMIDI_EXTERNAL 0x02 40c925c334Snate 41*ab0b1be7Smglocker struct umidi_cs_interface_descriptor { 42c925c334Snate uByte bLength; 43c925c334Snate uByte bDescriptorType; 44c925c334Snate uByte bDescriptorSubtype; 45c925c334Snate uWord bcdMSC; 46c925c334Snate uWord wTotalLength; 47*ab0b1be7Smglocker } __packed; 48c925c334Snate #define UMIDI_CS_INTERFACE_DESCRIPTOR_SIZE 7 49c925c334Snate 50*ab0b1be7Smglocker struct umidi_cs_endpoint_descriptor { 51c925c334Snate uByte bLength; 52c925c334Snate uByte bDescriptorType; 53c925c334Snate uByte bDescriptorSubType; 54c925c334Snate uByte bNumEmbMIDIJack; 55*ab0b1be7Smglocker } __packed; 56c925c334Snate #define UMIDI_CS_ENDPOINT_DESCRIPTOR_SIZE 4 57c925c334Snate 58*ab0b1be7Smglocker struct umidi_jack_descriptor { 59c925c334Snate uByte bLength; 60c925c334Snate uByte bDescriptorType; 61c925c334Snate uByte bDescriptorSubtype; 62c925c334Snate uByte bJackType; 63c925c334Snate uByte bJackID; 64*ab0b1be7Smglocker } __packed; 65c925c334Snate #define UMIDI_JACK_DESCRIPTOR_SIZE 5 66c925c334Snate 67c925c334Snate 68c925c334Snate #define TO_D(p) ((usb_descriptor_t *)(p)) 69c925c334Snate #define NEXT_D(desc) TO_D((caddr_t)(desc)+(desc)->bLength) 70c925c334Snate #define TO_IFD(desc) ((usb_interface_descriptor_t *)(desc)) 71*ab0b1be7Smglocker #define TO_CSIFD(desc) ((struct umidi_cs_interface_descriptor *)(desc)) 72c925c334Snate #define TO_EPD(desc) ((usb_endpoint_descriptor_t *)(desc)) 73*ab0b1be7Smglocker #define TO_CSEPD(desc) ((struct umidi_cs_endpoint_descriptor *)(desc)) 74