helper.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __USBAUDIO_HELPER_H
  2. #define __USBAUDIO_HELPER_H
  3. unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size);
  4. void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype);
  5. void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype);
  6. int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe,
  7. __u8 request, __u8 requesttype, __u16 value, __u16 index,
  8. void *data, __u16 size);
  9. unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip,
  10. struct usb_host_interface *alts);
  11. /*
  12. * retrieve usb_interface descriptor from the host interface
  13. * (conditional for compatibility with the older API)
  14. */
  15. #ifndef get_iface_desc
  16. #define get_iface_desc(iface) (&(iface)->desc)
  17. #define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc)
  18. #define get_ep_desc(ep) (&(ep)->desc)
  19. #define get_cfg_desc(cfg) (&(cfg)->desc)
  20. #endif
  21. #ifndef snd_usb_get_speed
  22. #define snd_usb_get_speed(dev) ((dev)->speed)
  23. #endif
  24. static inline int snd_usb_ctrl_intf(struct snd_usb_audio *chip)
  25. {
  26. return get_iface_desc(chip->ctrl_intf)->bInterfaceNumber;
  27. }
  28. #endif /* __USBAUDIO_HELPER_H */