1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * <linux/usb/midi-v2.h> -- USB MIDI 2.0 definitions. 4 */ 5 6 #ifndef __LINUX_USB_MIDI_V2_H 7 #define __LINUX_USB_MIDI_V2_H 8 9 #include <linux/types.h> 10 #include <linux/usb/midi.h> 11 12 /* A.1 MS Class-Specific Interface Descriptor Types */ 13 #define USB_DT_CS_GR_TRM_BLOCK 0x26 14 15 /* A.1 MS Class-Specific Interface Descriptor Subtypes */ 16 /* same as MIDI 1.0 */ 17 18 /* A.2 MS Class-Specific Endpoint Descriptor Subtypes */ 19 #define USB_MS_GENERAL_2_0 0x02 20 21 /* A.3 MS Class-Specific Group Terminal Block Descriptor Subtypes */ 22 #define USB_MS_GR_TRM_BLOCK_UNDEFINED 0x00 23 #define USB_MS_GR_TRM_BLOCK_HEADER 0x01 24 #define USB_MS_GR_TRM_BLOCK 0x02 25 26 /* A.4 MS Interface Header MIDIStreaming Class Revision */ 27 #define USB_MS_REV_MIDI_1_0 0x0100 28 #define USB_MS_REV_MIDI_2_0 0x0200 29 30 /* A.5 MS MIDI IN and OUT Jack Types */ 31 /* same as MIDI 1.0 */ 32 33 /* A.6 Group Terminal Block Types */ 34 #define USB_MS_GR_TRM_BLOCK_TYPE_BIDIRECTIONAL 0x00 35 #define USB_MS_GR_TRM_BLOCK_TYPE_INPUT_ONLY 0x01 36 #define USB_MS_GR_TRM_BLOCK_TYPE_OUTPUT_ONLY 0x02 37 38 /* A.7 Group Terminal Default MIDI Protocol */ 39 #define USB_MS_MIDI_PROTO_UNKNOWN 0x00 /* Unknown (Use MIDI-CI) */ 40 #define USB_MS_MIDI_PROTO_1_0_64 0x01 /* MIDI 1.0, UMP up to 64bits */ 41 #define USB_MS_MIDI_PROTO_1_0_64_JRTS 0x02 /* MIDI 1.0, UMP up to 64bits, Jitter Reduction Timestamps */ 42 #define USB_MS_MIDI_PROTO_1_0_128 0x03 /* MIDI 1.0, UMP up to 128bits */ 43 #define USB_MS_MIDI_PROTO_1_0_128_JRTS 0x04 /* MIDI 1.0, UMP up to 128bits, Jitter Reduction Timestamps */ 44 #define USB_MS_MIDI_PROTO_2_0 0x11 /* MIDI 2.0 */ 45 #define USB_MS_MIDI_PROTO_2_0_JRTS 0x12 /* MIDI 2.0, Jitter Reduction Timestamps */ 46 47 /* 5.2.2.1 Class-Specific MS Interface Header Descriptor */ 48 /* Same as MIDI 1.0, use struct usb_ms_header_descriptor */ 49 50 /* 5.3.2 Class-Specific MIDI Streaming Data Endpoint Descriptor */ 51 struct usb_ms20_endpoint_descriptor { 52 __u8 bLength; /* 4+n */ 53 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ 54 __u8 bDescriptorSubtype; /* USB_MS_GENERAL_2_0 */ 55 __u8 bNumGrpTrmBlock; /* Number of Group Terminal Blocks: n */ 56 __u8 baAssoGrpTrmBlkID[]; /* ID of the Group Terminal Blocks [n] */ 57 } __packed; 58 59 #define USB_DT_MS20_ENDPOINT_SIZE(n) (4 + (n)) 60 61 /* As above, but more useful for defining your own descriptors: */ 62 #define DECLARE_USB_MS20_ENDPOINT_DESCRIPTOR(n) \ 63 struct usb_ms20_endpoint_descriptor_##n { \ 64 __u8 bLength; \ 65 __u8 bDescriptorType; \ 66 __u8 bDescriptorSubtype; \ 67 __u8 bNumGrpTrmBlock; \ 68 __u8 baAssoGrpTrmBlkID[n]; \ 69 } __packed 70 71 /* 5.4.1 Class-Specific Group Terminal Block Header Descriptor */ 72 struct usb_ms20_gr_trm_block_header_descriptor { 73 __u8 bLength; /* 5 */ 74 __u8 bDescriptorType; /* USB_DT_CS_GR_TRM_BLOCK */ 75 __u8 bDescriptorSubtype; /* USB_MS_GR_TRM_BLOCK_HEADER */ 76 __le16 wTotalLength; /* Total number of bytes */ 77 } __packed; 78 79 /* 5.4.2.1 Group Terminal Block Descriptor */ 80 struct usb_ms20_gr_trm_block_descriptor { 81 __u8 bLength; /* 13 */ 82 __u8 bDescriptorType; /* USB_DT_CS_GR_TRM_BLOCK */ 83 __u8 bDescriptorSubtype; /* USB_MS_GR_TRM_BLOCK */ 84 __u8 bGrpTrmBlkID; /* ID of this Group Terminal Block */ 85 __u8 bGrpTrmBlkType; /* Group Terminal Block Type */ 86 __u8 nGroupTrm; /* The first member Group Terminal in this block */ 87 __u8 nNumGroupTrm; /* Number of member Group Terminals spanned */ 88 __u8 iBlockItem; /* String ID of Block item */ 89 __u8 bMIDIProtocol; /* Default MIDI protocol */ 90 __le16 wMaxInputBandwidth; /* Max input bandwidth capability in 4kB/s */ 91 __le16 wMaxOutputBandwidth; /* Max output bandwidth capability in 4kB/s */ 92 } __packed; 93 94 #endif /* __LINUX_USB_MIDI_V2_H */ 95
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.