Jungo WinDriver  
Official Documentation
windrvr_usb.h
Go to the documentation of this file.
1/* @JUNGO_COPYRIGHT@ */
2
3/* @JUNGO_COPYRIGHT_GPL@ */
4
5/* @JUNGO_COPYRIGHT_GPL_OTHER_OS@ */
6
7#if !defined(_WINDRVR_USB_H_)
8#define _WINDRVR_USB_H_
9
10/* Use it to pad struct size to 64 bit, when using 32 on 64 bit application */
11#ifndef PAD_TO_64
12#if defined (i386) && defined(x86_64)
13#define PAD_TO_64(pName) DWORD dwPad_##pName;
14#else
15#define PAD_TO_64(pName)
16#endif
17#endif
18
19#if defined (i386) && defined(x86_64)
20#define PAD_TO_64_PTR_ARR(pName,size) PVOID ptPad_##pName[size];
21#else
22#define PAD_TO_64_PTR_ARR(pName, size)
23#endif
24
25#if defined(LINUX)
26 #if !defined(__P_TYPES__)
27 #define __P_TYPES__
28 #include <wd_types.h>
29 typedef void VOID;
30 typedef unsigned char UCHAR;
31 typedef unsigned short USHORT;
32 typedef unsigned int UINT;
33 typedef unsigned long ULONG;
34 typedef u32 BOOL;
35 typedef void *PVOID;
36 typedef unsigned char *PBYTE;
37 typedef char CHAR;
38 typedef char *PCHAR;
39 typedef unsigned short *PWORD;
40 typedef u32 DWORD, *PDWORD;
41 typedef int PRCHANDLE;
42 typedef PVOID HANDLE;
43 typedef long LONG;
44 #endif
45 #if !defined(TRUE)
46 #define TRUE 1
47 #endif
48 #if !defined(FALSE)
49 #define FALSE 0
50 #endif
51#endif
52
59
60#define WD_USB_MAX_PIPE_NUMBER 32
61#define WD_USB_MAX_ENDPOINTS WD_USB_MAX_PIPE_NUMBER
62#define WD_USB_MAX_INTERFACES 30
63#define WD_USB_MAX_ALT_SETTINGS 255
64
65typedef enum {
70
71/* USB TRANSFER options */
72enum {
75 /* Windows only, ignored on other OS: */
78 USB_BULK_INT_URB_SIZE_OVERRIDE_128K = 0x100, /* Force a 128KB maximum
79 URB size */
80 /* All OS */
82
83 /* The following flags are no longer used beginning with v6.0: */
87 USB_ISOCH_ASAP = 0x8
88};
89
91
92/* Descriptor types */
93#define WDU_DEVICE_DESC_TYPE 0x01
94#define WDU_CONFIG_DESC_TYPE 0x02
95#define WDU_STRING_DESC_STRING 0x03
96#define WDU_INTERFACE_DESC_TYPE 0x04
97#define WDU_ENDPOINT_DESC_TYPE 0x05
98
99/* Endpoint descriptor fields */
100#define WDU_ENDPOINT_TYPE_MASK 0x03
101#define WDU_ENDPOINT_DIRECTION_MASK 0x80
102#define WDU_ENDPOINT_ADDRESS_MASK 0x0f
103/* test direction bit in the bEndpointAddress field of an endpoint
104 * descriptor. */
105#define WDU_ENDPOINT_DIRECTION_OUT(addr) \
106 (!((addr) & WDU_ENDPOINT_DIRECTION_MASK))
107#define WDU_ENDPOINT_DIRECTION_IN(addr) \
108 ((addr) & WDU_ENDPOINT_DIRECTION_MASK)
109#define WDU_GET_MAX_PACKET_SIZE(x) \
110 ((USHORT) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
111
112#ifndef LINUX
113typedef enum {
118#endif
119
120typedef struct
121{
122 DWORD dwNumber;
125 DWORD type;
126 DWORD direction;
133
150
170
187
208
209typedef struct
210{
213 PAD_TO_64(Descriptor)
214 WDU_ENDPOINT_DESCRIPTOR *pEndpointDescriptors;
220 PAD_TO_64(pEndpointDescriptors)
224 PAD_TO_64(pPipes)
226
227typedef struct
228{
234 PAD_TO_64(pAlternateSettings)
235 DWORD dwNumAltSettings;
238 PAD_TO_64(dwNumAltSettings)
239 WDU_ALTERNATE_SETTING *pActiveAltSetting;
243 PAD_TO_64(pActiveAltSetting)
245
257
288
289/* Note: Any devices found matching this table will be controlled */
307
308typedef struct
309{
311 PAD_TO_64(dwUniqueID)
312 PVOID pBuf;
313 PAD_TO_64(pBuf)
314 DWORD dwBytes;
315 DWORD dwOptions;
317
318/* these enum values can be used as dwProperty values, see structure
319 * WD_GET_DEVICE_PROPERTY below. */
365
366typedef struct
367{
373
374typedef struct
375{
379 PAD_TO_64(dwOptions)
381
386
391
392typedef struct
393{
397 PAD_TO_64(dwOptions)
399
400typedef struct
401{
404} WDU_WAKEUP;
405
406typedef struct
407{
411
412typedef struct
413{
417
418typedef struct
419{
421 DWORD dwPipeNum;
422 DWORD fRead;
424 DWORD dwOptions;
432 PVOID pBuffer;
433 PAD_TO_64(pBuffer)
434 DWORD dwBufferSize;
435 DWORD dwBytesTransferred;
437 UCHAR SetupPacket[8];
438 DWORD dwTimeout;
440 PAD_TO_64(dwTimeout)
442
443typedef struct
444{
446 UCHAR bType;
447 UCHAR bIndex;
448 USHORT wLength;
449 PVOID pBuffer;
450 PAD_TO_64(pBuffer)
451 USHORT wLanguage;
453
454typedef struct
455{
460 DWORD dwRxSize;
464} WDU_STREAM;
465
466typedef struct
467{
475
476#endif /* _WINDRVR_USB_H_ */
477
WDU_INTERFACE_DESCRIPTOR Descriptor
Interface descriptor information structure.
UCHAR bDescriptorType
Configuration descriptor (0x02)
USHORT wTotalLength
Total length, in bytes, of data returned.
UCHAR bConfigurationValue
Configuration number.
UCHAR bLength
Size, in bytes, of the descriptor.
UCHAR bNumInterfaces
Number of interfaces.
UCHAR bmAttributes
Power settings for this configuration:
UCHAR iConfiguration
Index of string descriptor that describes this configuration.
WDU_INTERFACE * pInterfaces
Pointer to the beginning of an array of interface information structures for the configuration's inte...
DWORD dwNumInterfaces
Number of interfaces supported by this configuration.
WDU_CONFIGURATION_DESCRIPTOR Descriptor
Configuration descriptor information structure.
UCHAR bDescriptorType
Device descriptor (0x01)
UCHAR iManufacturer
Index of manufacturer string descriptor.
UCHAR bMaxPacketSize0
Maximum size of transferred packets.
UCHAR bNumConfigurations
Number of possible configurations.
USHORT idVendor
Vendor ID, as assigned by USB-IF.
UCHAR bDeviceSubClass
The device's sub-class.
UCHAR bLength
Size, in bytes, of the descriptor (18 bytes)
UCHAR iProduct
Index of product string descriptor.
USHORT idProduct
Product ID, as assigned by the product manufacturer.
UCHAR bDeviceClass
The device's class.
USHORT bcdDevice
Device release numbe.
UCHAR iSerialNumber
Index of serial number string descriptor.
UCHAR bDeviceProtocol
The device's protocol.
USHORT bcdUSB
Number of the USB specification with which the device complies.
WDU_CONFIGURATION * pConfigs
Pointer to the beginning of an array of configuration information structures describing the device's ...
WDU_DEVICE_DESCRIPTOR Descriptor
CDevice descriptor information structure.
WDU_PIPE_INFO Pipe0
Pipe information structure for the device's default control pipe (pipe 0)
UCHAR bInterval
Interval, in frame counts, for polling endpoint data transfers.
UCHAR bDescriptorType
Endpoint descriptor (0x05)
UCHAR bmAttributes
Specifies the transfer type for this endpoint (control, interrupt, isochronous or bulk).
USHORT wMaxPacketSize
Maximum size of packets this endpoint can send or receive.
UCHAR bLength
Size, in bytes, of the descriptor (7 bytes)
UCHAR bEndpointAddress
Endpoint address: Use bits 0–3 for endpoint number, set bits 4–6 to zero (0), and set bit 7 to zero (...
UCHAR bLength
Size, in bytes, of the descriptor (9 bytes)
UCHAR bInterfaceProtocol
The interface's protocol code, as assigned by USB-IF.
UCHAR bAlternateSetting
Alternate setting number.
UCHAR bInterfaceSubClass
The interface's sub-class code, as assigned by USB-IF.
UCHAR bInterfaceNumber
Interface number.
UCHAR bDescriptorType
Interface descriptor (0x04)
UCHAR bInterfaceClass
The interface's class code, as assigned by USB-IF.
UCHAR bNumEndpoints
Number of endpoints used by this interface.
UCHAR iInterface
Index of string descriptor that describes this interface.
WDU_ALTERNATE_SETTING * pAlternateSettings
Pointer to the beginning of an array of alternate setting information structures for the interface's ...
UCHAR bInterfaceProtocol
The interface's protocol code, as assigned by USB-IF (*)
UCHAR bInterfaceClass
The interface's class code, as assigned by USB-IF (*)
USHORT wProductId
Required USB Product ID to detect, as assigned by the product manufacturer (*)
UCHAR bDeviceSubClass
The device's sub-class code, as assigned by USB-IF (*)
USHORT wVendorId
Required USB Vendor ID to detect, as assigned by USB-IF (*)
UCHAR bInterfaceSubClass
The interface's sub-class code, as assigned by USB-IF (*)
UCHAR bDeviceClass
The device's class code, as assigned by USB-IF (*)
DWORD dwMaximumPacketSize
Maximum size of packets that can be transferred using this pipe.
DWORD type
Transfer type for this pipe.
DWORD dwInterval
Interval in milliseconds.
DWORD direction
Direction of the transfer:
DWORD dwNumber
Pipe number; zero for the default control pipe.
DWORD dwReserved
DWORD dwRxSize
DWORD dwBufferSize
DWORD dwPipeNum
DWORD dwOptions
DWORD dwRxTxTimeout
DWORD dwUniqueID
DWORD dwOptions
USB_TRANSFER options: USB_ISOCH_FULL_PACKETS_ONLY - For isochronous transfers only.
PVOID pBuffer
Pointer to buffer to read/write.
DWORD fRead
TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
DWORD dwPipeNum
Pipe number on device.
DWORD dwOptions
DWORD dwUniqueID
unsigned int u32
Definition wd_types.h:10
USB_DIR
@ USB_DIR_OUT
@ USB_DIR_IN
@ USB_DIR_IN_OUT
USB_PIPE_TYPE
Definition windrvr_usb.h:53
@ PIPE_TYPE_INTERRUPT
Definition windrvr_usb.h:57
@ PIPE_TYPE_ISOCHRONOUS
Definition windrvr_usb.h:55
@ PIPE_TYPE_CONTROL
Definition windrvr_usb.h:54
@ PIPE_TYPE_BULK
Definition windrvr_usb.h:56
WD_DEVICE_REGISTRY_PROPERTY
@ WdDevicePropertyInstallState
The device's installation state.
@ WdDevicePropertyHardwareID
The device's hardware IDs.
@ WdDevicePropertyEnumeratorName
The name of the device's enumerator (e.g., "PCI" or "root")
@ WdDevicePropertyCompatibleIDs
The device's compatible IDs.
@ WdDevicePropertyLegacyBusType
The bus type (e.g., PCIBus)
@ WdDevicePropertyFriendlyName
Friendly device name (typically defined by the class installer), which can be used to distinguish bet...
@ WdDevicePropertyClassName
The name of the device's setup class, in text format.
@ WdDevicePropertyBootConfigurationTranslated
The hardware resources assigned to the device by the firmware, in translated form.
@ WdDevicePropertyBusNumber
The legacy bus number of the bus to which the device is connected.
@ WdDevicePropertyManufacturer
Device manufacturer string.
@ WdDevicePropertyUINumber
A number associated with the device that can be displayed in the user interface.
@ WdDevicePropertyBootConfiguration
The hardware resources assigned to the device by the firmware, in raw data form.
@ WdDevicePropertyClassGuid
The GUID for the device's setup class (string format)
@ WdDevicePropertyLocationInformation
Information about the device's Location on the bus (string format).
@ WdDevicePropertyDeviceDescription
Device description.
@ WdDevicePropertyAddress
The device's bus address.
@ WdDevicePropertyRemovalPolicy
The device's current removal policy (Windows)
@ WdDevicePropertyBusTypeGuid
The GUID for the bus to which the device is connected.
@ WdDevicePropertyPhysicalDeviceObjectName
The name of the Physical Device Object (PDO) for the device.
@ WdDevicePropertyDriverKeyName
The name of the driver-specific registry key.
WDU_SELECTIVE_SUSPEND_OPTIONS
@ WDU_SELECTIVE_SUSPEND_SUBMIT
@ WDU_SELECTIVE_SUSPEND_CANCEL
#define PAD_TO_64(pName)
Definition windrvr_usb.h:15
WDU_WAKEUP_OPTIONS
@ WDU_WAKEUP_ENABLE
@ WDU_WAKEUP_DISABLE
@ USB_ISOCH_RESET
Definition windrvr_usb.h:73
@ USB_STREAM_OVERWRITE_BUFFER_WHEN_FULL
Definition windrvr_usb.h:81
@ USB_SHORT_TRANSFER
Definition windrvr_usb.h:85
@ USB_ISOCH_ASAP
Definition windrvr_usb.h:87
@ USB_TRANSFER_HALT
Definition windrvr_usb.h:84
@ USB_ISOCH_FULL_PACKETS_ONLY
Definition windrvr_usb.h:74
@ USB_FULL_TRANSFER
Definition windrvr_usb.h:86
@ USB_ABORT_PIPE
Definition windrvr_usb.h:76
@ USB_ISOCH_NOASAP
Definition windrvr_usb.h:77
@ USB_BULK_INT_URB_SIZE_OVERRIDE_128K
Definition windrvr_usb.h:78
PVOID WDU_REGISTER_DEVICES_HANDLE
Definition windrvr_usb.h:90
#define PAD_TO_64_PTR_ARR(pName, size)
Definition windrvr_usb.h:22
WDU_DIR
Definition windrvr_usb.h:65
@ WDU_DIR_IN_OUT
Definition windrvr_usb.h:68
@ WDU_DIR_OUT
Definition windrvr_usb.h:67
@ WDU_DIR_IN
Definition windrvr_usb.h:66
#define WD_USB_MAX_INTERFACES
Definition windrvr_usb.h:62