18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __USBAUDIO_HELPER_H 38c2ecf20Sopenharmony_ci#define __USBAUDIO_HELPER_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciunsigned int snd_usb_combine_bytes(unsigned char *bytes, int size); 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_civoid *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype); 88c2ecf20Sopenharmony_civoid *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype); 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciint snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, 118c2ecf20Sopenharmony_ci __u8 request, __u8 requesttype, __u16 value, __u16 index, 128c2ecf20Sopenharmony_ci void *data, __u16 size); 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciunsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip, 158c2ecf20Sopenharmony_ci struct usb_host_interface *alts); 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* 188c2ecf20Sopenharmony_ci * retrieve usb_interface descriptor from the host interface 198c2ecf20Sopenharmony_ci * (conditional for compatibility with the older API) 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_ci#define get_iface_desc(iface) (&(iface)->desc) 228c2ecf20Sopenharmony_ci#define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc) 238c2ecf20Sopenharmony_ci#define get_ep_desc(ep) (&(ep)->desc) 248c2ecf20Sopenharmony_ci#define get_cfg_desc(cfg) (&(cfg)->desc) 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define snd_usb_get_speed(dev) ((dev)->speed) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic inline int snd_usb_ctrl_intf(struct snd_usb_audio *chip) 298c2ecf20Sopenharmony_ci{ 308c2ecf20Sopenharmony_ci return get_iface_desc(chip->ctrl_intf)->bInterfaceNumber; 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* in validate.c */ 348c2ecf20Sopenharmony_cibool snd_usb_validate_audio_desc(void *p, int protocol); 358c2ecf20Sopenharmony_cibool snd_usb_validate_midi_desc(void *p); 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#endif /* __USBAUDIO_HELPER_H */ 38