Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __USBAUDIO_HELPER_H
0003 #define __USBAUDIO_HELPER_H
0004 
0005 unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size);
0006 
0007 void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype);
0008 void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype);
0009 
0010 int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe,
0011             __u8 request, __u8 requesttype, __u16 value, __u16 index,
0012             void *data, __u16 size);
0013 
0014 unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip,
0015                      struct usb_host_interface *alts);
0016 
0017 struct usb_host_interface *
0018 snd_usb_get_host_interface(struct snd_usb_audio *chip, int ifnum, int altsetting);
0019 
0020 /*
0021  * retrieve usb_interface descriptor from the host interface
0022  * (conditional for compatibility with the older API)
0023  */
0024 #define get_iface_desc(iface)   (&(iface)->desc)
0025 #define get_endpoint(alt,ep)    (&(alt)->endpoint[ep].desc)
0026 #define get_ep_desc(ep)     (&(ep)->desc)
0027 #define get_cfg_desc(cfg)   (&(cfg)->desc)
0028 
0029 #define snd_usb_get_speed(dev) ((dev)->speed)
0030 
0031 static inline int snd_usb_ctrl_intf(struct snd_usb_audio *chip)
0032 {
0033     return get_iface_desc(chip->ctrl_intf)->bInterfaceNumber;
0034 }
0035 
0036 /* in validate.c */
0037 bool snd_usb_validate_audio_desc(void *p, int protocol);
0038 bool snd_usb_validate_midi_desc(void *p);
0039 
0040 #endif /* __USBAUDIO_HELPER_H */