xref: /aosp_15_r20/external/libusb/libusb/os/windows_usbdk.h (revision 86b64dcb59b3a0b37502ecd56e119234366a6f7e)
1 /*
2 * windows UsbDk backend for libusb 1.0
3 * Copyright © 2014 Red Hat, Inc.
4 
5 * Authors:
6 * Dmitry Fleytman <[email protected]>
7 * Pavel Gurvich <[email protected]>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 
24 #ifndef LIBUSB_WINDOWS_USBDK_H
25 #define LIBUSB_WINDOWS_USBDK_H
26 
27 #include "windows_common.h"
28 
29 typedef struct USB_DK_CONFIG_DESCRIPTOR_REQUEST {
30 	USB_DK_DEVICE_ID ID;
31 	ULONG64 Index;
32 } USB_DK_CONFIG_DESCRIPTOR_REQUEST, *PUSB_DK_CONFIG_DESCRIPTOR_REQUEST;
33 
34 typedef enum {
35 	TransferFailure = 0,
36 	TransferSuccess,
37 	TransferSuccessAsync
38 } TransferResult;
39 
40 typedef enum {
41 	NoSpeed = 0,
42 	LowSpeed,
43 	FullSpeed,
44 	HighSpeed,
45 	SuperSpeed
46 } USB_DK_DEVICE_SPEED;
47 
48 typedef enum {
49 	ControlTransferType,
50 	BulkTransferType,
51 	InterruptTransferType,
52 	IsochronousTransferType
53 } USB_DK_TRANSFER_TYPE;
54 
55 typedef BOOL (__cdecl *USBDK_GET_DEVICES_LIST)(
56 	PUSB_DK_DEVICE_INFO *DeviceInfo,
57 	PULONG DeviceNumber
58 );
59 typedef void (__cdecl *USBDK_RELEASE_DEVICES_LIST)(
60 	PUSB_DK_DEVICE_INFO DeviceInfo
61 );
62 typedef HANDLE (__cdecl *USBDK_START_REDIRECT)(
63 	PUSB_DK_DEVICE_ID DeviceId
64 );
65 typedef BOOL (__cdecl *USBDK_STOP_REDIRECT)(
66 	HANDLE DeviceHandle
67 );
68 typedef BOOL (__cdecl *USBDK_GET_CONFIGURATION_DESCRIPTOR)(
69 	PUSB_DK_CONFIG_DESCRIPTOR_REQUEST Request,
70 	PUSB_CONFIGURATION_DESCRIPTOR *Descriptor,
71 	PULONG Length
72 );
73 typedef void (__cdecl *USBDK_RELEASE_CONFIGURATION_DESCRIPTOR)(
74 	PUSB_CONFIGURATION_DESCRIPTOR Descriptor
75 );
76 typedef TransferResult (__cdecl *USBDK_WRITE_PIPE)(
77 	HANDLE DeviceHandle,
78 	PUSB_DK_TRANSFER_REQUEST Request,
79 	LPOVERLAPPED lpOverlapped
80 );
81 typedef TransferResult (__cdecl *USBDK_READ_PIPE)(
82 	HANDLE DeviceHandle,
83 	PUSB_DK_TRANSFER_REQUEST Request,
84 	LPOVERLAPPED lpOverlapped
85 );
86 typedef BOOL (__cdecl *USBDK_ABORT_PIPE)(
87 	HANDLE DeviceHandle,
88 	ULONG64 PipeAddress
89 );
90 typedef BOOL (__cdecl *USBDK_RESET_PIPE)(
91 	HANDLE DeviceHandle,
92 	ULONG64 PipeAddress
93 );
94 typedef BOOL (__cdecl *USBDK_SET_ALTSETTING)(
95 	HANDLE DeviceHandle,
96 	ULONG64 InterfaceIdx,
97 	ULONG64 AltSettingIdx
98 );
99 typedef BOOL (__cdecl *USBDK_RESET_DEVICE)(
100 	HANDLE DeviceHandle
101 );
102 typedef HANDLE (__cdecl *USBDK_GET_REDIRECTOR_SYSTEM_HANDLE)(
103 	HANDLE DeviceHandle
104 );
105 
106 #endif
107