0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef __LINUX_USB_MIDI_H
0020 #define __LINUX_USB_MIDI_H
0021
0022 #include <linux/types.h>
0023
0024
0025 #define USB_MS_HEADER 0x01
0026 #define USB_MS_MIDI_IN_JACK 0x02
0027 #define USB_MS_MIDI_OUT_JACK 0x03
0028 #define USB_MS_ELEMENT 0x04
0029
0030
0031 #define USB_MS_GENERAL 0x01
0032
0033
0034 #define USB_MS_EMBEDDED 0x01
0035 #define USB_MS_EXTERNAL 0x02
0036
0037
0038 struct usb_ms_header_descriptor {
0039 __u8 bLength;
0040 __u8 bDescriptorType;
0041 __u8 bDescriptorSubtype;
0042 __le16 bcdMSC;
0043 __le16 wTotalLength;
0044 } __attribute__ ((packed));
0045
0046 #define USB_DT_MS_HEADER_SIZE 7
0047
0048
0049 struct usb_midi_in_jack_descriptor {
0050 __u8 bLength;
0051 __u8 bDescriptorType;
0052 __u8 bDescriptorSubtype;
0053 __u8 bJackType;
0054 __u8 bJackID;
0055 __u8 iJack;
0056 } __attribute__ ((packed));
0057
0058 #define USB_DT_MIDI_IN_SIZE 6
0059
0060 struct usb_midi_source_pin {
0061 __u8 baSourceID;
0062 __u8 baSourcePin;
0063 } __attribute__ ((packed));
0064
0065
0066 struct usb_midi_out_jack_descriptor {
0067 __u8 bLength;
0068 __u8 bDescriptorType;
0069 __u8 bDescriptorSubtype;
0070 __u8 bJackType;
0071 __u8 bJackID;
0072 __u8 bNrInputPins;
0073 struct usb_midi_source_pin pins[];
0074
0075 } __attribute__ ((packed));
0076
0077 #define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p))
0078
0079
0080 #define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \
0081 struct usb_midi_out_jack_descriptor_##p { \
0082 __u8 bLength; \
0083 __u8 bDescriptorType; \
0084 __u8 bDescriptorSubtype; \
0085 __u8 bJackType; \
0086 __u8 bJackID; \
0087 __u8 bNrInputPins; \
0088 struct usb_midi_source_pin pins[p]; \
0089 __u8 iJack; \
0090 } __attribute__ ((packed))
0091
0092
0093 struct usb_ms_endpoint_descriptor {
0094 __u8 bLength;
0095 __u8 bDescriptorType;
0096 __u8 bDescriptorSubtype;
0097 __u8 bNumEmbMIDIJack;
0098 __u8 baAssocJackID[];
0099 } __attribute__ ((packed));
0100
0101 #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
0102
0103
0104 #define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \
0105 struct usb_ms_endpoint_descriptor_##n { \
0106 __u8 bLength; \
0107 __u8 bDescriptorType; \
0108 __u8 bDescriptorSubtype; \
0109 __u8 bNumEmbMIDIJack; \
0110 __u8 baAssocJackID[n]; \
0111 } __attribute__ ((packed))
0112
0113 #endif