+
+typedef struct
+{
+ void* dwPort; // IO port for transfer or kernel memory address.
+ uint32_t cmdTrans; // Transfer command WD_TRANSFER_CMD.
+
+ // Parameters used for string transfers:
+ uint32_t dwBytes; // For string transfer.
+ uint32_t fAutoinc; // Transfer from one port/address
+ // or use incremental range of addresses.
+ uint32_t dwOptions; // Must be 0.
+ union
+ {
+ uint8_t Byte; // Use for 8 bit transfer.
+ uint16_t Word; // Use for 16 bit transfer.
+ uint32_t Dword; // Use for 32 bit transfer.
+ uint64_t Qword; // Use for 64 bit transfer.
+ void* pBuffer; // Use for string transfer.
+ } Data;
+} WD_TRANSFER, WD_TRANSFER_V61;
+
+typedef struct
+{
+ uint32_t hKernelPlugIn;
+ uint32_t dwMessage;
+ void* pData;
+ uint32_t dwResult;
+} WD_KERNEL_PLUGIN_CALL, WD_KERNEL_PLUGIN_CALL_V40;
+
+
+struct interrupt
+{
+ uint32_t hInterrupt; // Handle of interrupt.
+ uint32_t dwOptions; // Interrupt options: can be INTERRUPT_CMD_COPY
+
+ WD_TRANSFER *Cmd; // Commands to do on interrupt.
+ uint32_t dwCmds; // Number of commands.
+
+ // For WD_IntEnable():
+ WD_KERNEL_PLUGIN_CALL kpCall; // Kernel PlugIn call.
+ uint32_t fEnableOk; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
+
+ // For WD_IntWait() and WD_IntCount():
+ uint32_t dwCounter; // Number of interrupts received.
+ uint32_t dwLost; // Number of interrupts not yet dealt with.
+ uint32_t fStopped; // Was interrupt disabled during wait.
+};
+
+struct usb_set_interface
+{
+ uint32_t dwUniqueID;
+ uint32_t dwInterfaceNum;
+ uint32_t dwAlternateSetting;
+ uint32_t dwOptions;
+};
+
+struct usb_get_device_data
+{
+ uint32_t dwUniqueID;
+ void* pBuf;
+ uint32_t dwBytes;
+ uint32_t dwOptions;
+};
+
+#define WD_USB_MAX_INTERFACES 30
+
+typedef struct
+{
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t bInterfaceNumber;
+ uint8_t bAlternateSetting;
+ uint8_t bNumEndpoints;
+ uint8_t bInterfaceClass;
+ uint8_t bInterfaceSubClass;
+ uint8_t bInterfaceProtocol;
+ uint8_t iInterface;
+} WDU_INTERFACE_DESCRIPTOR;
+
+typedef struct
+{
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t bEndpointAddress;
+ uint8_t bmAttributes;
+ uint16_t wMaxPacketSize;
+ uint8_t bInterval;
+} WDU_ENDPOINT_DESCRIPTOR;
+
+typedef struct
+{
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t wTotalLength;
+ uint8_t bNumInterfaces;
+ uint8_t bConfigurationValue;
+ uint8_t iConfiguration;
+ uint8_t bmAttributes;
+ uint8_t MaxPower;
+} WDU_CONFIGURATION_DESCRIPTOR;
+
+typedef struct
+{
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t bcdUSB;
+ uint8_t bDeviceClass;
+ uint8_t bDeviceSubClass;
+ uint8_t bDeviceProtocol;
+ uint8_t bMaxPacketSize0;
+
+ uint16_t idVendor;
+ uint16_t idProduct;
+ uint16_t bcdDevice;
+ uint8_t iManufacturer;
+ uint8_t iProduct;
+ uint8_t iSerialNumber;
+ uint8_t bNumConfigurations;
+} WDU_DEVICE_DESCRIPTOR;
+
+typedef struct
+{
+ WDU_INTERFACE_DESCRIPTOR Descriptor;
+ WDU_ENDPOINT_DESCRIPTOR *pEndpointDescriptors;
+ WDU_PIPE_INFO *pPipes;
+} WDU_ALTERNATE_SETTING;
+
+typedef struct
+{
+ WDU_ALTERNATE_SETTING *pAlternateSettings;
+ uint32_t dwNumAltSettings;
+ WDU_ALTERNATE_SETTING *pActiveAltSetting;
+} WDU_INTERFACE;
+
+typedef struct
+{
+ WDU_CONFIGURATION_DESCRIPTOR Descriptor;
+ uint32_t dwNumInterfaces;
+ WDU_INTERFACE *pInterfaces;
+} WDU_CONFIGURATION;
+
+struct usb_device_info {
+ WDU_DEVICE_DESCRIPTOR Descriptor;
+ WDU_PIPE_INFO Pipe0;
+ WDU_CONFIGURATION *pConfigs;
+ WDU_CONFIGURATION *pActiveConfig;
+ WDU_INTERFACE *pActiveInterface[WD_USB_MAX_INTERFACES];
+};
+
+typedef enum {
+ WDU_DIR_IN = 1,
+ WDU_DIR_OUT = 2,
+ WDU_DIR_IN_OUT = 3
+} WDU_DIR;
+
+typedef enum {
+ PIPE_TYPE_CONTROL = 0,
+ PIPE_TYPE_ISOCHRONOUS = 1,
+ PIPE_TYPE_BULK = 2,
+ PIPE_TYPE_INTERRUPT = 3
+} USB_PIPE_TYPE;