1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef AUDIO_USB_VALIDATE_DESC_H
10 #define AUDIO_USB_VALIDATE_DESC_H
11 
12 #include <linux/usb.h>
13 
14 struct AudioUsbCtlMsgParam {
15     uint32_t pipe;
16     uint8_t request;
17     uint8_t requestType;
18     uint16_t value;
19     uint16_t index;
20 };
21 uint32_t AudioUsbCombineTriple(uint8_t *bytes);
22 struct usb_interface_descriptor *AudioUsbGetIfaceDesc(struct usb_host_interface *interface);
23 struct usb_endpoint_descriptor *AudioEndpointDescriptor(struct usb_host_interface *alts, uint32_t epIndex);
24 enum usb_device_speed AudioUsbGetSpeed(struct usb_device *dev);
25 
26 uint32_t AudioUsbCombineBytes(uint8_t *bytes, int32_t size);
27 void *AudioUsbFindDesc(void *descStart, int32_t descLen, void *after, uint8_t dtype);
28 void *AudioUsbFindCsintDesc(void *buf, int32_t bufLen, void *after, uint8_t dsubType);
29 int32_t AudioUsbCtlMsg(struct usb_device *dev, struct AudioUsbCtlMsgParam *usbCtlMsgParam, void *data, uint16_t size);
30 uint8_t AudioUsbParseDataInterval(struct usb_device *usbDev, struct usb_host_interface *alts);
31 bool AudioUsbValidateAudioDesc(void *ptr, int32_t protocol);
32 
33 #endif
34