Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 2 | #ifndef __USBAUDIO_HELPER_H |
| 3 | #define __USBAUDIO_HELPER_H |
| 4 | |
| 5 | unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size); |
| 6 | |
| 7 | void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype); |
| 8 | void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype); |
| 9 | |
| 10 | int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, |
| 11 | __u8 request, __u8 requesttype, __u16 value, __u16 index, |
Clemens Ladisch | 17d900c | 2011-09-26 21:15:27 +0200 | [diff] [blame] | 12 | void *data, __u16 size); |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 13 | |
| 14 | unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip, |
| 15 | struct usb_host_interface *alts); |
| 16 | |
| 17 | /* |
| 18 | * retrieve usb_interface descriptor from the host interface |
| 19 | * (conditional for compatibility with the older API) |
| 20 | */ |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 21 | #define get_iface_desc(iface) (&(iface)->desc) |
| 22 | #define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc) |
| 23 | #define get_ep_desc(ep) (&(ep)->desc) |
| 24 | #define get_cfg_desc(cfg) (&(cfg)->desc) |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 25 | |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 26 | #define snd_usb_get_speed(dev) ((dev)->speed) |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 27 | |
Daniel Mack | 11bcbc4 | 2010-06-11 17:34:20 +0200 | [diff] [blame] | 28 | static inline int snd_usb_ctrl_intf(struct snd_usb_audio *chip) |
| 29 | { |
| 30 | return get_iface_desc(chip->ctrl_intf)->bInterfaceNumber; |
| 31 | } |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 32 | |
| 33 | #endif /* __USBAUDIO_HELPER_H */ |