?? bulkloop.h
字號:
//main.h
typedef enum _ENDPOINT_SELECT {
FIRSTPAIR,
SELECTPAIR,
OUTONLY,
INONLY
} ENDPOINT_SELECT;
typedef enum _DATA_PATTERN {
INCREMENTINGBYTE,
RANDOMBYTE,
INCREMENTINGDWORD,
CONSTANTBYTE
} DATA_PATTERN;
#define bmVERBOSE 0x01
#define bmSTOPONERROR 0x02
#define bmVERIFYDATA 0x04
#define bmINCPACKET 0x08
typedef struct _THREAD_CONTROL
{
HANDLE hDevice;
DWORD Ioctl;
PVOID InBuffer;
DWORD InBufferSize;
PVOID OutBuffer;
DWORD OutBufferSize;
DWORD BytesReturned;
HANDLE completionEvent;
BOOL status;
} THREAD_CONTROL, *PTHREAD_CONTROL;
#define MAX_DRIVER_NAME 64
#define DEVICE_DESCRIPTOR_SIZE 32 /* bigger than we need */
#define MAX_ITEMS_IN_LB 1024
#define MAX_BUFFER_SIZE 512
// Clear out the first entry in the output box if the box has too many entries
#define MAINTAIN_OUTPUT_BOX(hO, nI) \
nI = SendMessage (hO, LB_GETCOUNT, 0, 0); \
while (nI >= MAX_ITEMS_IN_LB) { \
SendMessage (hO, LB_DELETESTRING, 0, 0); \
nI = SendMessage (hO, LB_GETCOUNT, 0, 0); \
}
#define GET_CONFIG_DESCRIPTOR_LENGTH(pv) \
((pUsb_Configuration_Descriptor)pv)->wTotalLength
typedef struct __usb_Dev_Descriptor__ {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT bcdUSB;
UCHAR bDeviceClass;
UCHAR bDeviceSubClass;
UCHAR bDeviceProtocol;
UCHAR bMaxPacketSize0;
USHORT idVendor;
USHORT idProduct;
USHORT bcdDevice;
UCHAR iManufacturer;
UCHAR iProduct;
UCHAR iSerialNumber;
UCHAR bNumConfigurations;
} Usb_Device_Descriptor, *pUsb_Device_Descriptor;
typedef struct __usb_Config_Descriptor__ {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT wTotalLength;
UCHAR bNumInterfaces;
UCHAR bConfigurationValue;
UCHAR iConfiguration;
UCHAR bmAttributes;
UCHAR MaxPower;
} Usb_Configuration_Descriptor, *pUsb_Configuration_Descriptor;
typedef struct _USB_INTERFACE_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bInterfaceNumber;
UCHAR bAlternateSetting;
UCHAR bNumEndpoints;
UCHAR bInterfaceClass;
UCHAR bInterfaceSubClass;
UCHAR bInterfaceProtocol;
UCHAR iInterface;
} Usb_Interface_Descriptor, *pUsb_Interface_Descriptor;
typedef struct _USB_ENDPOINT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bEndpointAddress;
UCHAR bmAttributes;
USHORT wMaxPacketSize;
UCHAR bInterval;
} Usb_Endpoint_Descriptor, *pUsb_Endpoint_Descriptor;
BOOLEAN
bOpenDriver (HANDLE * phDeviceHandle, PCHAR devname);
//
// Stuff copied fro USBDI.H
//
typedef PVOID USBD_PIPE_HANDLE;
typedef PVOID USBD_CONFIGURATION_HANDLE;
typedef PVOID USBD_INTERFACE_HANDLE;
typedef enum _USBD_PIPE_TYPE {
UsbdPipeTypeControl,
UsbdPipeTypeIsochronous,
UsbdPipeTypeBulk,
UsbdPipeTypeInterrupt
} USBD_PIPE_TYPE;
char PIPE_TYPE_STRINGS[4][4] =
{
"CTL",
"ISO",
"BLK",
"INT"
};
char PIPE_DIRECTION[2][4] =
{
"OUT",
"IN"
};
typedef struct _USBD_PIPE_INFORMATION {
//
// OUTPUT
// These fields are filled in by USBD
//
USHORT MaximumPacketSize; // Maximum packet size for this pipe
UCHAR EndpointAddress; // 8 bit USB endpoint address (includes direction)
// taken from endpoint descriptor
UCHAR Interval; // Polling interval in ms if interrupt pipe
USBD_PIPE_TYPE PipeType; // PipeType identifies type of transfer valid for this pipe
USBD_PIPE_HANDLE PipeHandle;
//
// INPUT
// These fields are filled in by the client driver
//
ULONG MaximumTransferSize; // Maximum size for a single request
// in bytes.
ULONG PipeFlags;
} USBD_PIPE_INFORMATION, *PUSBD_PIPE_INFORMATION;
typedef struct _USBD_INTERFACE_INFORMATION {
USHORT Length; // Length of this structure, including
// all pipe information structures that
// follow.
//
// INPUT
//
// Interface number and Alternate setting this
// structure is associated with
//
UCHAR InterfaceNumber;
UCHAR AlternateSetting;
//
// OUTPUT
// These fields are filled in by USBD
//
UCHAR Class;
UCHAR SubClass;
UCHAR Protocol;
UCHAR Reserved;
USBD_INTERFACE_HANDLE InterfaceHandle;
ULONG NumberOfPipes;
//
// INPUT/OUPUT
// see PIPE_INFORMATION
USBD_PIPE_INFORMATION Pipes[0];
} USBD_INTERFACE_INFORMATION, *PUSBD_INTERFACE_INFORMATION;
typedef LONG USBD_STATUS;
typedef struct _USBD_ISO_PACKET_DESCRIPTOR {
ULONG Offset; // INPUT Offset of the packet from the begining of the
// buffer.
ULONG Length; // OUTPUT length of data received (for in).
// OUTPUT 0 for OUT.
USBD_STATUS Status; // status code for this packet.
} USBD_ISO_PACKET_DESCRIPTOR, *PUSBD_ISO_PACKET_DESCRIPTOR;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -