4 #define USB_TRANSFER 0x983
5 #define EVENT_UNREGISTER 0x987
6 #define INT_DISABLE 0x91f
8 #define CARD_REGISTER 0x9a4
9 #define EVENT_REGISTER 0x9a5
10 #define CARD_UNREGISTER 0x92b
11 #define USB_GET_DEVICE_DATA 0x9a7
12 #define INT_ENABLE 0x98e
13 #define EVENT_PULL 0x988
14 #define USB_SET_INTERFACE 0x981
16 #define MAGIC 0xa410b413UL
18 /* http://www.jungo.com/support/documentation/windriver/811/wdusb_man_mhtml/node78.html#SECTION001734000000000000000 */
20 struct header_struct
{
26 struct version_struct
{
27 unsigned long versionul
;
31 struct license_struct
{
32 char cLicense
[128]; // Buffer with license string to put.
33 // If empty string then get current license setting
35 unsigned long dwLicense
; // Returns license settings: LICENSE_DEMO, LICENSE_WD
36 // etc..., or 0 for invalid license.
37 unsigned long dwLicense2
; // Returns additional license settings, if dwLicense
38 // could not hold all the information.
39 // Then dwLicense will return 0.
44 unsigned long dwVendorId
;
45 unsigned long dwDeviceId
;
52 unsigned long dwFunction
;
57 unsigned long dwVendorId
;
58 unsigned long dwProductId
;
63 unsigned short VendorId
;
64 unsigned short ProductId
;
65 unsigned char bDeviceClass
;
66 unsigned char bDeviceSubClass
;
67 unsigned char bInterfaceClass
;
68 unsigned char bInterfaceSubClass
;
69 unsigned char bInterfaceProtocol
;
74 unsigned long dwNumber
; // Pipe 0 is the default pipe
75 unsigned long dwMaximumPacketSize
;
76 unsigned long type
; // USB_PIPE_TYPE
77 unsigned long direction
; // WDU_DIR
78 // Isochronous, Bulk, Interrupt are either USB_DIR_IN or USB_DIR_OUT
79 // Control are USB_DIR_IN_OUT
80 unsigned long dwInterval
; // interval in ms relevant to Interrupt pipes
81 } WD_USB_PIPE_INFO
, WD_USB_PIPE_INFO_V43
, WDU_PIPE_INFO
;
83 #define WD_USB_MAX_PIPE_NUMBER 32
87 unsigned long dwPipes
;
88 WD_USB_PIPE_INFO Pipe
[WD_USB_MAX_PIPE_NUMBER
];
89 } WD_USB_DEVICE_INFO
, WD_USB_DEVICE_INFO_V43
;
93 unsigned long dwUniqueID
;
94 unsigned long dwPipeNum
; // Pipe number on device.
95 unsigned long fRead
; // TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
96 unsigned long dwOptions
; // USB_TRANSFER options:
97 // USB_ISOCH_FULL_PACKETS_ONLY - For isochronous
98 // transfers only. If set, only full packets will be
99 // transmitted and the transfer function will return
100 // when the amount of bytes left to transfer is less
101 // than the maximum packet size for the pipe (the
102 // function will return without transmitting the
104 void* pBuffer
; // Pointer to buffer to read/write.
105 unsigned long dwBufferSize
; // Amount of bytes to transfer.
106 unsigned long dwBytesTransferred
; // Returns the number of bytes actually read/written
107 unsigned char SetupPacket
[8]; // Setup packet for control pipe transfer.
108 unsigned long dwTimeout
; // Timeout for the transfer in milliseconds. Set to 0 for infinite wait.
115 unsigned long handle
;
116 unsigned long dwAction
; // WD_EVENT_ACTION
117 unsigned long dwStatus
; // EVENT_STATUS
118 unsigned long dwEventId
;
119 unsigned long dwCardType
; //WD_BUS_PCI, WD_BUS_USB, WD_BUS_PCMCIA
120 unsigned long hKernelPlugIn
;
121 unsigned long dwOptions
; // WD_EVENT_OPTION
132 unsigned long dwUniqueID
;
135 unsigned long dwEventVer
;
136 unsigned long dwNumMatchTables
;
137 WDU_MATCH_TABLE matchTables
[1];
142 unsigned long dwBusType
; // Bus Type: ISA, EISA, PCI, PCMCIA.
143 unsigned long dwBusNum
; // Bus number.
144 unsigned long dwSlotFunc
; // Slot number on Bus.
145 } WD_BUS
, WD_BUS_V30
;
149 unsigned long item
; // ITEM_TYPE
150 unsigned long fNotSharable
;
151 unsigned long dwReserved
; // Reserved for internal use
152 unsigned long dwOptions
; // WD_ITEM_OPTIONS
157 unsigned long dwPhysicalAddr
; // Physical address on card.
158 unsigned long dwBytes
; // Address range.
159 void* dwTransAddr
; // Returns the address to pass on to transfer commands.
160 void* dwUserDirectAddr
; // Returns the address for direct user read/write.
161 unsigned long dwCpuPhysicalAddr
; // Returns the CPU physical address
162 unsigned long dwBar
; // Base Address Register number of PCI card.
166 void* dwAddr
; // Beginning of io address.
167 unsigned long dwBytes
; // IO range.
168 unsigned long dwBar
; // Base Address Register number of PCI card.
172 unsigned long dwInterrupt
; // Number of interrupt to install.
173 unsigned long dwOptions
; // Interrupt options. For level sensitive
174 // interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
175 unsigned long hInterrupt
; // Returns the handle of the interrupt installed.
177 WD_BUS Bus
; // ITEM_BUS
180 unsigned long dw1
, dw2
, dw3
, dw4
; // Reserved for internal use
181 void* dw5
; // Reserved for internal use
184 } WD_ITEMS
, WD_ITEMS_V30
;
186 #define WD_CARD_ITEMS 20
190 unsigned long dwItems
;
191 WD_ITEMS Item
[WD_CARD_ITEMS
];
192 } WD_CARD
, WD_CARD_V30
;
194 enum { CARD_VX_NO_MMU_INIT
= 0x4000000 };
198 WD_CARD Card
; // Card to register.
199 unsigned long fCheckLockOnly
; // Only check if card is lockable, return hCard=1 if OK.
200 unsigned long hCard
; // Handle of card.
201 unsigned long dwOptions
; // Should be zero.
202 char cName
[32]; // Name of card.
203 char cDescription
[100]; // Description.
208 void* dwPort
; // IO port for transfer or kernel memory address.
209 unsigned long cmdTrans
; // Transfer command WD_TRANSFER_CMD.
211 // Parameters used for string transfers:
212 unsigned long dwBytes
; // For string transfer.
213 unsigned long fAutoinc
; // Transfer from one port/address
214 // or use incremental range of addresses.
215 unsigned long dwOptions
; // Must be 0.
218 unsigned char Byte
; // Use for 8 bit transfer.
219 unsigned short Word
; // Use for 16 bit transfer.
220 unsigned int Dword
; // Use for 32 bit transfer.
221 unsigned long long Qword
; // Use for 64 bit transfer.
222 void* pBuffer
; // Use for string transfer.
224 } WD_TRANSFER
, WD_TRANSFER_V61
;
228 unsigned long hKernelPlugIn
;
229 unsigned long dwMessage
;
231 unsigned long dwResult
;
232 } WD_KERNEL_PLUGIN_CALL
, WD_KERNEL_PLUGIN_CALL_V40
;
237 unsigned long hInterrupt
; // Handle of interrupt.
238 unsigned long dwOptions
; // Interrupt options: can be INTERRUPT_CMD_COPY
240 WD_TRANSFER
*Cmd
; // Commands to do on interrupt.
241 unsigned long dwCmds
; // Number of commands.
243 // For WD_IntEnable():
244 WD_KERNEL_PLUGIN_CALL kpCall
; // Kernel PlugIn call.
245 unsigned long fEnableOk
; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
247 // For WD_IntWait() and WD_IntCount():
248 unsigned long dwCounter
; // Number of interrupts received.
249 unsigned long dwLost
; // Number of interrupts not yet dealt with.
250 unsigned long fStopped
; // Was interrupt disabled during wait.
253 struct usb_set_interface
255 unsigned long dwUniqueID
;
256 unsigned long dwInterfaceNum
;
257 unsigned long dwAlternateSetting
;
258 unsigned long dwOptions
;
261 struct usb_get_device_data
263 unsigned long dwUniqueID
;
265 unsigned long dwBytes
;
266 unsigned long dwOptions
;
269 #define WD_USB_MAX_INTERFACES 30
273 unsigned char bLength
;
274 unsigned char bDescriptorType
;
275 unsigned char bInterfaceNumber
;
276 unsigned char bAlternateSetting
;
277 unsigned char bNumEndpoints
;
278 unsigned char bInterfaceClass
;
279 unsigned char bInterfaceSubClass
;
280 unsigned char bInterfaceProtocol
;
281 unsigned char iInterface
;
282 } WDU_INTERFACE_DESCRIPTOR
;
286 unsigned char bLength
;
287 unsigned char bDescriptorType
;
288 unsigned char bEndpointAddress
;
289 unsigned char bmAttributes
;
290 unsigned short wMaxPacketSize
;
291 unsigned char bInterval
;
292 } WDU_ENDPOINT_DESCRIPTOR
;
296 unsigned char bLength
;
297 unsigned char bDescriptorType
;
298 unsigned short wTotalLength
;
299 unsigned char bNumInterfaces
;
300 unsigned char bConfigurationValue
;
301 unsigned char iConfiguration
;
302 unsigned char bmAttributes
;
303 unsigned char MaxPower
;
304 } WDU_CONFIGURATION_DESCRIPTOR
;
308 unsigned char bLength
;
309 unsigned char bDescriptorType
;
310 unsigned short bcdUSB
;
311 unsigned char bDeviceClass
;
312 unsigned char bDeviceSubClass
;
313 unsigned char bDeviceProtocol
;
314 unsigned char bMaxPacketSize0
;
316 unsigned short idVendor
;
317 unsigned short idProduct
;
318 unsigned short bcdDevice
;
319 unsigned char iManufacturer
;
320 unsigned char iProduct
;
321 unsigned char iSerialNumber
;
322 unsigned char bNumConfigurations
;
323 } WDU_DEVICE_DESCRIPTOR
;
327 WDU_INTERFACE_DESCRIPTOR Descriptor
;
328 WDU_ENDPOINT_DESCRIPTOR
*pEndpointDescriptors
;
329 WDU_PIPE_INFO
*pPipes
;
330 } WDU_ALTERNATE_SETTING
;
334 WDU_ALTERNATE_SETTING
*pAlternateSettings
;
335 unsigned long dwNumAltSettings
;
336 WDU_ALTERNATE_SETTING
*pActiveAltSetting
;
341 WDU_CONFIGURATION_DESCRIPTOR Descriptor
;
342 unsigned long dwNumInterfaces
;
343 WDU_INTERFACE
*pInterfaces
;
346 struct usb_device_info
{
347 WDU_DEVICE_DESCRIPTOR Descriptor
;
349 WDU_CONFIGURATION
*pConfigs
;
350 WDU_CONFIGURATION
*pActiveConfig
;
351 WDU_INTERFACE
*pActiveInterface
[WD_USB_MAX_INTERFACES
];