Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- v6: - Add ddk/winusbio dependent prototypes. --- include/Makefile.in | 1 + include/winusb.h | 101 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 include/winusb.h
diff --git a/include/Makefile.in b/include/Makefile.in index 58bf7db1e13..89356d2a6ee 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -845,6 +845,7 @@ SOURCES = \ wintabx.h \ winternl.h \ wintrust.h \ + winusb.h \ winuser.h \ winuser.rh \ winver.h \ diff --git a/include/winusb.h b/include/winusb.h new file mode 100644 index 00000000000..d30c83db85c --- /dev/null +++ b/include/winusb.h @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2022 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _WINUSB_H_ +#define _WINUSB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ddk/winusbio.h" + +typedef PVOID WINUSB_INTERFACE_HANDLE, *PWINUSB_INTERFACE_HANDLE; +typedef PVOID WINUSB_ISOCH_BUFFER_HANDLE, *PWINUSB_ISOCH_BUFFER_HANDLE; + +typedef struct _WINUSB_SETUP_PACKET { + UCHAR RequestType; + UCHAR Request; + USHORT Value; + USHORT Index; + USHORT Length; +} WINUSB_SETUP_PACKET, *PWINUSB_SETUP_PACKET; + +typedef struct _USB_START_TRACKING_FOR_TIME_SYNC_INFORMATION { + HANDLE TimeTrackingHandle; + BOOLEAN IsStartupDelayTolerable; +} USB_START_TRACKING_FOR_TIME_SYNC_INFORMATION, *PUSB_START_TRACKING_FOR_TIME_SYNC_INFORMATION; + +typedef struct _USB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION { + HANDLE TimeTrackingHandle; +} USB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION, *PUSB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION; + +typedef struct _USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION { + HANDLE TimeTrackingHandle; + ULONG InputFrameNumber; + ULONG InputMicroFrameNumber; + LARGE_INTEGER QueryPerformanceCounterAtInputFrameOrMicroFrame; + LARGE_INTEGER QueryPerformanceCounterFrequency; + ULONG PredictedAccuracyInMicroSeconds; + ULONG CurrentGenerationID; + LARGE_INTEGER CurrentQueryPerformanceCounter; + ULONG CurrentHardwareFrameNumber; + ULONG CurrentHardwareMicroFrameNumber; + ULONG CurrentUSBFrameNumber; +} USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION, *PUSB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION; + +BOOL WINAPI WinUsb_AbortPipe(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_ControlTransfer(WINUSB_INTERFACE_HANDLE,WINUSB_SETUP_PACKET,PUCHAR,ULONG,PULONG,LPOVERLAPPED); +BOOL WINAPI WinUsb_FlushPipe(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_Free(WINUSB_INTERFACE_HANDLE); +BOOL WINAPI WinUsb_GetAdjustedFrameNumber(PULONG,LARGE_INTEGER); +BOOL WINAPI WinUsb_GetAssociatedInterface(WINUSB_INTERFACE_HANDLE,UCHAR,PWINUSB_INTERFACE_HANDLE); +BOOL WINAPI WinUsb_GetCurrentAlternateSetting(WINUSB_INTERFACE_HANDLE,PUCHAR); +BOOL WINAPI WinUsb_GetCurrentFrameNumber(WINUSB_INTERFACE_HANDLE,PULONG,LARGE_INTEGER*); +BOOL WINAPI WinUsb_GetCurrentFrameNumberAndQpc(WINUSB_INTERFACE_HANDLE,PUSB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION); +BOOL WINAPI WinUsb_GetDescriptor(WINUSB_INTERFACE_HANDLE,UCHAR,UCHAR,USHORT,PUCHAR,ULONG,PULONG); +BOOL WINAPI WinUsb_GetOverlappedResult(WINUSB_INTERFACE_HANDLE,LPOVERLAPPED,LPDWORD,BOOL); +BOOL WINAPI WinUsb_GetPipePolicy(WINUSB_INTERFACE_HANDLE,UCHAR,ULONG,PULONG,PVOID); +BOOL WINAPI WinUsb_GetPowerPolicy(WINUSB_INTERFACE_HANDLE,ULONG,PULONG,PVOID); +BOOL WINAPI WinUsb_Initialize(HANDLE,PWINUSB_INTERFACE_HANDLE); +PUSB_INTERFACE_DESCRIPTOR WINAPI WinUsb_ParseConfigurationDescriptor(PUSB_CONFIGURATION_DESCRIPTOR,PVOID,LONG,LONG,LONG,LONG,LONG); +PUSB_COMMON_DESCRIPTOR WINAPI WinUsb_ParseDescriptors(PVOID,ULONG,PVOID,LONG); +BOOL WINAPI WinUsb_QueryDeviceInformation(WINUSB_INTERFACE_HANDLE,ULONG,PULONG,PVOID); +BOOL WINAPI WinUsb_QueryInterfaceSettings(WINUSB_INTERFACE_HANDLE,UCHAR,PUSB_INTERFACE_DESCRIPTOR); +BOOL WINAPI WinUsb_QueryPipe(WINUSB_INTERFACE_HANDLE,UCHAR,UCHAR,PWINUSB_PIPE_INFORMATION); +BOOL WINAPI WinUsb_QueryPipeEx(WINUSB_INTERFACE_HANDLE,UCHAR,UCHAR,PWINUSB_PIPE_INFORMATION_EX); +BOOL WINAPI WinUsb_ReadIsochPipe(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,PULONG,ULONG,PUSBD_ISO_PACKET_DESCRIPTOR,LPOVERLAPPED); +BOOL WINAPI WinUsb_ReadIsochPipeAsap(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,BOOL,ULONG,PUSBD_ISO_PACKET_DESCRIPTOR,LPOVERLAPPED); +BOOL WINAPI WinUsb_ReadPipe(WINUSB_INTERFACE_HANDLE,UCHAR,PUCHAR,ULONG,PULONG,LPOVERLAPPED); +BOOL WINAPI WinUsb_RegisterIsochBuffer(WINUSB_INTERFACE_HANDLE,UCHAR,PUCHAR,ULONG,PWINUSB_ISOCH_BUFFER_HANDLE); +BOOL WINAPI WinUsb_ResetPipe(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_SetCurrentAlternateSetting(WINUSB_INTERFACE_HANDLE,UCHAR); +BOOL WINAPI WinUsb_SetPipePolicy(WINUSB_INTERFACE_HANDLE,UCHAR,ULONG,ULONG,PVOID); +BOOL WINAPI WinUsb_SetPowerPolicy(WINUSB_INTERFACE_HANDLE,ULONG,ULONG,PVOID); +BOOL WINAPI WinUsb_StartTrackingForTimeSync(WINUSB_INTERFACE_HANDLE,PUSB_START_TRACKING_FOR_TIME_SYNC_INFORMATION); +BOOL WINAPI WinUsb_StopTrackingForTimeSync(WINUSB_INTERFACE_HANDLE,PUSB_STOP_TRACKING_FOR_TIME_SYNC_INFORMATION); +BOOL WINAPI WinUsb_UnregisterIsochBuffer(WINUSB_ISOCH_BUFFER_HANDLE); +BOOL WINAPI WinUsb_WriteIsochPipe(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,PULONG,LPOVERLAPPED); +BOOL WINAPI WinUsb_WriteIsochPipeAsap(WINUSB_ISOCH_BUFFER_HANDLE,ULONG,ULONG,BOOL,LPOVERLAPPED); +BOOL WINAPI WinUsb_WritePipe(WINUSB_INTERFACE_HANDLE,UCHAR,PUCHAR,ULONG,PULONG,LPOVERLAPPED); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINUSB_H_ */