audio.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * <linux/usb/audio.h> -- USB Audio definitions.
  3. *
  4. * Copyright (C) 2006 Thumtronics Pty Ltd.
  5. * Developed for Thumtronics by Grey Innovation
  6. * Ben Williamson <ben.williamson@greyinnovation.com>
  7. *
  8. * This software is distributed under the terms of the GNU General Public
  9. * License ("GPL") version 2, as published by the Free Software Foundation.
  10. *
  11. * This file holds USB constants and structures defined
  12. * by the USB Device Class Definition for Audio Devices.
  13. * Comments below reference relevant sections of that document:
  14. *
  15. * http://www.usb.org/developers/devclass_docs/audio10.pdf
  16. */
  17. #ifndef __LINUX_USB_AUDIO_H
  18. #define __LINUX_USB_AUDIO_H
  19. #include <linux/types.h>
  20. /* A.2 Audio Interface Subclass Codes */
  21. #define USB_SUBCLASS_AUDIOCONTROL 0x01
  22. #define USB_SUBCLASS_AUDIOSTREAMING 0x02
  23. #define USB_SUBCLASS_MIDISTREAMING 0x03
  24. /* 4.3.2 Class-Specific AC Interface Descriptor */
  25. struct usb_ac_header_descriptor {
  26. __u8 bLength; // 8+n
  27. __u8 bDescriptorType; // USB_DT_CS_INTERFACE
  28. __u8 bDescriptorSubtype; // USB_MS_HEADER
  29. __le16 bcdADC; // 0x0100
  30. __le16 wTotalLength; // includes Unit and Terminal desc.
  31. __u8 bInCollection; // n
  32. __u8 baInterfaceNr[]; // [n]
  33. } __attribute__ ((packed));
  34. #define USB_DT_AC_HEADER_SIZE(n) (8+(n))
  35. /* As above, but more useful for defining your own descriptors: */
  36. #define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
  37. struct usb_ac_header_descriptor_##n { \
  38. __u8 bLength; \
  39. __u8 bDescriptorType; \
  40. __u8 bDescriptorSubtype; \
  41. __le16 bcdADC; \
  42. __le16 wTotalLength; \
  43. __u8 bInCollection; \
  44. __u8 baInterfaceNr[n]; \
  45. } __attribute__ ((packed))
  46. #endif