Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef __USBAUDIO_HELPER_H
 3#define __USBAUDIO_HELPER_H
 4
 5unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size);
 6
 7void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype);
 8void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype);
 9
10int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe,
11		    __u8 request, __u8 requesttype, __u16 value, __u16 index,
12		    void *data, __u16 size);
13
14unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip,
15					 struct usb_host_interface *alts);
16
17struct usb_host_interface *
18snd_usb_get_host_interface(struct snd_usb_audio *chip, int ifnum, int altsetting);
19
20int snd_usb_add_ctrl_interface_link(struct snd_usb_audio *chip, int ifnum,
21		int ctrlif);
22
23struct usb_host_interface *snd_usb_find_ctrl_interface(struct snd_usb_audio *chip,
24								int ifnum);
25
26/*
27 * retrieve usb_interface descriptor from the host interface
28 * (conditional for compatibility with the older API)
29 */
 
30#define get_iface_desc(iface)	(&(iface)->desc)
31#define get_endpoint(alt,ep)	(&(alt)->endpoint[ep].desc)
32#define get_ep_desc(ep)		(&(ep)->desc)
33#define get_cfg_desc(cfg)	(&(cfg)->desc)
 
34
 
35#define snd_usb_get_speed(dev) ((dev)->speed)
 
36
37static inline int snd_usb_ctrl_intf(struct usb_host_interface *ctrl_intf)
38{
39	return get_iface_desc(ctrl_intf)->bInterfaceNumber;
40}
41
42/* in validate.c */
43bool snd_usb_validate_audio_desc(void *p, int protocol);
44bool snd_usb_validate_midi_desc(void *p);
45
46#endif /* __USBAUDIO_HELPER_H */
v4.6
 
 1#ifndef __USBAUDIO_HELPER_H
 2#define __USBAUDIO_HELPER_H
 3
 4unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size);
 5
 6void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype);
 7void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype);
 8
 9int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe,
10		    __u8 request, __u8 requesttype, __u16 value, __u16 index,
11		    void *data, __u16 size);
12
13unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip,
14					 struct usb_host_interface *alts);
15
 
 
 
 
 
 
 
 
 
16/*
17 * retrieve usb_interface descriptor from the host interface
18 * (conditional for compatibility with the older API)
19 */
20#ifndef get_iface_desc
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)
25#endif
26
27#ifndef snd_usb_get_speed
28#define snd_usb_get_speed(dev) ((dev)->speed)
29#endif
30
31static inline int snd_usb_ctrl_intf(struct snd_usb_audio *chip)
32{
33	return get_iface_desc(chip->ctrl_intf)->bInterfaceNumber;
34}
 
 
 
 
35
36#endif /* __USBAUDIO_HELPER_H */