• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef USB_HOST_NO_SDK_SPEED_H
17 #define USB_HOST_NO_SDK_SPEED_H
18 #include <stdint.h>
19 #define USB_ADAPTER_URB_TYPE_ISO              0
20 #define USB_ADAPTER_URB_TYPE_INTERRUPT        1
21 #define USB_ADAPTER_URB_TYPE_CONTROL          2
22 #define USB_ADAPTER_URB_TYPE_BULK             3
23 #define USB_ADAPTER_URB_SHORT_NOT_OK          0x01
24 #define USB_ADAPTER_URB_ISO_ASAP              0x02
25 #define USB_ADAPTER_URB_BULK_CONTINUATION     0x04
26 #define USB_ADAPTER_URB_QUEUE_BULK            0x10
27 #define USB_ADAPTER_URB_ZERO_PACKET           0x40
28 #define USB_ADAPTER_CAP_ZERO_PACKET           0x01
29 #define USB_ADAPTER_CAP_BULK_CONTINUATION     0x02
30 #define USB_ADAPTER_CAP_NO_PACKET_SIZE_LIM    0x04
31 #define USB_ADAPTER_CAP_BULK_SCATTER_GATHER   0x08
32 #define USB_ADAPTER_CAP_REAP_AFTER_DISCONNECT 0x10
33 
34 #define USBDEVFS_CLAIMINTERFACE   _IOR('U', 15, unsigned int)
35 #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
36 #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
37 #define USBDEVFS_SETINTERFACE     _IOR('U', 4, struct UsbSetInterface)
38 #define USBDEVFS_ALLOC_STREAMS    _IOR('U', 28, struct UsbAdapterStreams)
39 #define USBDEVFS_FREE_STREAMS     _IOR('U', 29, struct UsbAdapterStreams)
40 #define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
41 #define USBDEVFS_CLEAR_HALT       _IOR('U', 21, unsigned int)
42 #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
43 #define USBDEVFS_RESET            _IO('U', 20)
44 #define USBDEVFS_CONTROL          _IOWR('U', 0, struct UsbCtrltransfer)
45 #define USBDEVFS_DISCARDURB       _IO('U', 11)
46 #define USBDEVFS_REAPURB          _IOW('U', 12, void *)
47 #define USBDEVFS_SUBMITURB        _IOR('U', 10, struct UsbAdapterUrb)
48 #define USBDEVFS_REAPURBNDELAY    _IOW('U', 13, void *)
49 
50 struct UsbIsoPacketDesc {
51     unsigned int length;
52     unsigned int actualLength;
53     unsigned int status;
54 };
55 
56 struct UsbAdapterUrb {
57     unsigned char type;
58     unsigned char endPoint;
59     int32_t status;
60     unsigned int flags;
61     void *buffer;
62     int32_t bufferLength;
63     int32_t actualLength;
64     int32_t startFrame;
65     union {
66         int32_t numberOfPackets;
67         unsigned int streamId;
68     };
69     int32_t errorCount;
70     unsigned int signr;
71     void *userContext;
72     struct UsbIsoPacketDesc isoFrameDesc[0];
73 };
74 
75 struct UsbAdapterUrbs {
76     struct UsbAdapterUrb *urb;
77     int32_t inUse;
78     int32_t urbNum;
79 };
80 
81 #endif /* USB_HOST_NO_SDK_SPEED_H */
82