usb-midi.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.   usb-midi.h  --  USB-MIDI driver
  3.   Copyright (C) 2001
  4.       NAGANO Daisuke <breeze.nagano@nifty.ne.jp>
  5.   This program is free software; you can redistribute it and/or modify
  6.   it under the terms of the GNU General Public License as published by
  7.   the Free Software Foundation; either version 2, or (at your option)
  8.   any later version.
  9.   This program is distributed in the hope that it will be useful,
  10.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.   GNU General Public License for more details.
  13.   You should have received a copy of the GNU General Public License
  14.   along with this program; if not, write to the Free Software
  15.   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17. /* ------------------------------------------------------------------------- */
  18. #ifndef _USB_MIDI_H_
  19. #define _USB_MIDI_H_
  20. #ifndef USB_SUBCLASS_MIDISTREAMING
  21. #define USB_SUBCLASS_MIDISTREAMING 3
  22. #endif
  23. #define USB_DT_CS_DEVICE 0x21
  24. #define USB_DT_CS_CONFIG 0x22
  25. #define USB_DT_CS_STRING 0x23
  26. #define USB_DT_CS_INTERFACE 0x24
  27. #define USB_DT_CS_ENDPOINT 0x25
  28. /* ------------------------------------------------------------------------- */
  29. /* Roland MIDI Devices */
  30. #define USB_VENDOR_ID_ROLAND 0x0582
  31. #define USBMIDI_ROLAND_UA100G 0x0000
  32. #define USBMIDI_ROLAND_MPU64 0x0002
  33. #define USBMIDI_ROLAND_SC8850 0x0003
  34. #define USBMIDI_ROLAND_UM2 0x0005
  35. #define USBMIDI_ROLAND_UM1 0x0009
  36. #define USBMIDI_ROLAND_PC300 0x0008
  37. /* YAMAHA MIDI Devices */
  38. #define USB_VENDOR_ID_YAMAHA 0x0499
  39. #define USBMIDI_YAMAHA_MU1000 0x1001
  40. /* Steinberg MIDI Devices */
  41. #define USB_VENDOR_ID_STEINBERG 0x0763
  42. #define USBMIDI_STEINBERG_USB2MIDI 0x1001
  43. /* ------------------------------------------------------------------------- */
  44. /* Supported devices */
  45. struct usb_midi_endpoint {
  46. int  endpoint;
  47. int  cableId; /* if bit-n == 1 then cableId-n is enabled (n: 0 - 15) */
  48. };
  49. struct usb_midi_device {
  50. char  *deviceName;
  51. int    idVendor;
  52. int    idProduct;
  53. int    interface;
  54. int    altSetting; /* -1: auto detect */
  55. struct usb_midi_endpoint in[15];
  56. struct usb_midi_endpoint out[15];
  57. };
  58. static struct usb_midi_device usb_midi_devices[] = {
  59.   { /* Roland UM-1 */
  60.     "Roland UM-1",
  61.     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM1, 2, -1,
  62.     { { 0x81, 1 }, {-1, -1} },
  63.     { { 0x01, 1,}, {-1, -1} },
  64.   },
  65.   { /* Roland UM-2 */
  66.     "Roland UM-2" ,
  67.     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM2, 2, -1,
  68.     { { 0x81, 3 }, {-1, -1} },
  69.     { { 0x01, 3,}, {-1, -1} },
  70.   },
  71. /** Next entry courtesy research by Michael Minn <michael@michaelminn.com> **/
  72.   { /* Roland UA-100 */
  73.     "Roland UA-100",
  74.     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UA100G, 2, -1,
  75.     { { 0x82, 7 }, {-1, -1} }, /** cables 0,1 and 2 for SYSEX **/
  76.     { { 0x02, 7 }, {-1, -1} },
  77.   },
  78. /** Next entry courtesy research by Michael Minn <michael@michaelminn.com> **/
  79.   { /* Roland SC8850 */
  80.     "Roland SC8850",
  81.     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850, 2, -1,
  82.     { { 0x81, 15 }, {-1, -1} }, /** cables 0,1,2, and 3 **/
  83.     { { 0x01, 15 }, {-1, -1} },
  84.   },
  85.   { /* YAMAHA MU1000 */
  86.     "YAMAHA MU1000",
  87.     USB_VENDOR_ID_YAMAHA, USBMIDI_YAMAHA_MU1000, 0, -1, 
  88.     { { 0x81, 1 }, {-1, -1} },
  89.     { { 0x01, 15 }, {-1, -1} },
  90.   },
  91.   { /* Roland PC-300 */
  92.     "Roland PC-300",
  93.     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300, 2, -1, 
  94.     { { 0x81, 1 }, {-1, -1} },
  95.     { { 0x01, 1 }, {-1, -1} },
  96.   }
  97. };
  98. #define VENDOR_SPECIFIC_USB_MIDI_DEVICES (sizeof(usb_midi_devices)/sizeof(struct usb_midi_device))
  99. /* for Hot-Plugging */
  100. static struct usb_device_id usb_midi_ids [] = {
  101. { match_flags: (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS),
  102.   bInterfaceClass: USB_CLASS_AUDIO, bInterfaceSubClass: USB_SUBCLASS_MIDISTREAMING},
  103. { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM1    ) },
  104. { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM2    ) },
  105. { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UA100G ) },
  106. { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300 ) },
  107. { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850 ) },
  108. { USB_DEVICE( USB_VENDOR_ID_YAMAHA, USBMIDI_YAMAHA_MU1000 ) },
  109. /* { USB_DEVICE( USB_VENDOR_ID_STEINBERG, USBMIDI_STEINBERG_USB2MIDI ) },*/
  110. { } /* Terminating entry */
  111. };
  112. MODULE_DEVICE_TABLE (usb, usb_midi_ids);
  113. /* ------------------------------------------------------------------------- */
  114. #endif /* _USB_MIDI_H_ */