5 #define USB_TRANSFER 0x983
6 #define EVENT_UNREGISTER 0x987
7 #define INT_DISABLE 0x91f
9 #define CARD_REGISTER 0x9a4
10 #define EVENT_REGISTER 0x9a5
11 #define CARD_UNREGISTER 0x92b
12 #define USB_GET_DEVICE_DATA 0x9a7
13 #define INT_ENABLE 0x98e
14 #define EVENT_PULL 0x988
15 #define USB_SET_INTERFACE 0x981
17 #define VERSION 0xc0000910
18 #define LICENSE 0xc0000952
19 #define TRANSFER 0xc000098c
20 #define USB_TRANSFER 0xc0000983
21 #define EVENT_UNREGISTER 0xc0000987
22 #define INT_DISABLE 0xc000091f
23 #define INT_WAIT 0xc000094b
24 #define CARD_REGISTER 0xc00009a4
25 #define EVENT_REGISTER 0xc00009a5
26 #define CARD_UNREGISTER 0xc000092b
27 #define USB_GET_DEVICE_DATA 0xc00009a7
28 #define INT_ENABLE 0xc000098e
29 #define EVENT_PULL 0xc0000988
30 #define USB_SET_INTERFACE 0xc0000981
33 #define MAGIC 0xa410b413UL
35 #define WDU_GET_MAX_PACKET_SIZE(x) ((unsigned short) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
37 /* http://www.jungo.com/support/documentation/windriver/811/wdusb_man_mhtml/node78.html#SECTION001734000000000000000 */
39 struct header_struct
{
45 struct version_struct
{
46 unsigned long versionul
;
50 struct license_struct
{
51 char cLicense
[128]; // Buffer with license string to put.
52 // If empty string then get current license setting
54 unsigned long dwLicense
; // Returns license settings: LICENSE_DEMO, LICENSE_WD
55 // etc..., or 0 for invalid license.
56 unsigned long dwLicense2
; // Returns additional license settings, if dwLicense
57 // could not hold all the information.
58 // Then dwLicense will return 0.
63 unsigned long dwVendorId
;
64 unsigned long dwDeviceId
;
71 unsigned long dwFunction
;
76 unsigned long dwVendorId
;
77 unsigned long dwProductId
;
82 unsigned short VendorId
;
83 unsigned short ProductId
;
84 unsigned char bDeviceClass
;
85 unsigned char bDeviceSubClass
;
86 unsigned char bInterfaceClass
;
87 unsigned char bInterfaceSubClass
;
88 unsigned char bInterfaceProtocol
;
93 unsigned long dwNumber
; // Pipe 0 is the default pipe
94 unsigned long dwMaximumPacketSize
;
95 unsigned long type
; // USB_PIPE_TYPE
96 unsigned long direction
; // WDU_DIR
97 // Isochronous, Bulk, Interrupt are either USB_DIR_IN or USB_DIR_OUT
98 // Control are USB_DIR_IN_OUT
99 unsigned long dwInterval
; // interval in ms relevant to Interrupt pipes
100 } WD_USB_PIPE_INFO
, WD_USB_PIPE_INFO_V43
, WDU_PIPE_INFO
;
102 #define WD_USB_MAX_PIPE_NUMBER 32
106 unsigned long dwPipes
;
107 WD_USB_PIPE_INFO Pipe
[WD_USB_MAX_PIPE_NUMBER
];
108 } WD_USB_DEVICE_INFO
, WD_USB_DEVICE_INFO_V43
;
112 unsigned long dwUniqueID
;
113 unsigned long dwPipeNum
; // Pipe number on device.
114 unsigned long fRead
; // TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
115 unsigned long dwOptions
; // USB_TRANSFER options:
116 // USB_ISOCH_FULL_PACKETS_ONLY - For isochronous
117 // transfers only. If set, only full packets will be
118 // transmitted and the transfer function will return
119 // when the amount of bytes left to transfer is less
120 // than the maximum packet size for the pipe (the
121 // function will return without transmitting the
123 void* pBuffer
; // Pointer to buffer to read/write.
124 unsigned long dwBufferSize
; // Amount of bytes to transfer.
125 unsigned long dwBytesTransferred
; // Returns the number of bytes actually read/written
126 unsigned char SetupPacket
[8]; // Setup packet for control pipe transfer.
127 unsigned long dwTimeout
; // Timeout for the transfer in milliseconds. Set to 0 for infinite wait.
134 unsigned long handle
;
135 unsigned long dwAction
; // WD_EVENT_ACTION
136 unsigned long dwStatus
; // EVENT_STATUS
137 unsigned long dwEventId
;
138 unsigned long dwCardType
; //WD_BUS_PCI, WD_BUS_USB, WD_BUS_PCMCIA
139 unsigned long hKernelPlugIn
;
140 unsigned long dwOptions
; // WD_EVENT_OPTION
151 unsigned long dwUniqueID
;
154 unsigned long dwEventVer
;
155 unsigned long dwNumMatchTables
;
156 WDU_MATCH_TABLE matchTables
[1];
161 unsigned long dwBusType
; // Bus Type: ISA, EISA, PCI, PCMCIA.
162 unsigned long dwBusNum
; // Bus number.
163 unsigned long dwSlotFunc
; // Slot number on Bus.
164 } WD_BUS
, WD_BUS_V30
;
168 unsigned long item
; // ITEM_TYPE
169 unsigned long fNotSharable
;
170 unsigned long dwReserved
; // Reserved for internal use
171 unsigned long dwOptions
; // WD_ITEM_OPTIONS
176 unsigned long dwPhysicalAddr
; // Physical address on card.
177 unsigned long dwBytes
; // Address range.
178 void* dwTransAddr
; // Returns the address to pass on to transfer commands.
179 void* dwUserDirectAddr
; // Returns the address for direct user read/write.
180 unsigned long dwCpuPhysicalAddr
; // Returns the CPU physical address
181 unsigned long dwBar
; // Base Address Register number of PCI card.
185 void* dwAddr
; // Beginning of io address.
186 unsigned long dwBytes
; // IO range.
187 unsigned long dwBar
; // Base Address Register number of PCI card.
191 unsigned long dwInterrupt
; // Number of interrupt to install.
192 unsigned long dwOptions
; // Interrupt options. For level sensitive
193 // interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
194 unsigned long hInterrupt
; // Returns the handle of the interrupt installed.
196 WD_BUS Bus
; // ITEM_BUS
199 unsigned long dw1
, dw2
, dw3
, dw4
; // Reserved for internal use
200 void* dw5
; // Reserved for internal use
203 } WD_ITEMS
, WD_ITEMS_V30
;
205 #define WD_CARD_ITEMS 20
209 unsigned long dwItems
;
210 WD_ITEMS Item
[WD_CARD_ITEMS
];
211 } WD_CARD
, WD_CARD_V30
;
213 enum { CARD_VX_NO_MMU_INIT
= 0x4000000 };
217 WD_CARD Card
; // Card to register.
218 unsigned long fCheckLockOnly
; // Only check if card is lockable, return hCard=1 if OK.
219 unsigned long hCard
; // Handle of card.
220 unsigned long dwOptions
; // Should be zero.
221 char cName
[32]; // Name of card.
222 char cDescription
[100]; // Description.
227 void* dwPort
; // IO port for transfer or kernel memory address.
228 unsigned long cmdTrans
; // Transfer command WD_TRANSFER_CMD.
230 // Parameters used for string transfers:
231 unsigned long dwBytes
; // For string transfer.
232 unsigned long fAutoinc
; // Transfer from one port/address
233 // or use incremental range of addresses.
234 unsigned long dwOptions
; // Must be 0.
237 unsigned char Byte
; // Use for 8 bit transfer.
238 unsigned short Word
; // Use for 16 bit transfer.
239 uint32_t Dword
; // Use for 32 bit transfer.
240 uint64_t Qword
; // Use for 64 bit transfer.
241 void* pBuffer
; // Use for string transfer.
243 } WD_TRANSFER
, WD_TRANSFER_V61
;
247 unsigned long hKernelPlugIn
;
248 unsigned long dwMessage
;
250 unsigned long dwResult
;
251 } WD_KERNEL_PLUGIN_CALL
, WD_KERNEL_PLUGIN_CALL_V40
;
256 unsigned long hInterrupt
; // Handle of interrupt.
257 unsigned long dwOptions
; // Interrupt options: can be INTERRUPT_CMD_COPY
259 WD_TRANSFER
*Cmd
; // Commands to do on interrupt.
260 unsigned long dwCmds
; // Number of commands.
262 // For WD_IntEnable():
263 WD_KERNEL_PLUGIN_CALL kpCall
; // Kernel PlugIn call.
264 unsigned long fEnableOk
; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
266 // For WD_IntWait() and WD_IntCount():
267 unsigned long dwCounter
; // Number of interrupts received.
268 unsigned long dwLost
; // Number of interrupts not yet dealt with.
269 unsigned long fStopped
; // Was interrupt disabled during wait.
272 struct usb_set_interface
274 unsigned long dwUniqueID
;
275 unsigned long dwInterfaceNum
;
276 unsigned long dwAlternateSetting
;
277 unsigned long dwOptions
;
280 struct usb_get_device_data
282 unsigned long dwUniqueID
;
284 unsigned long dwBytes
;
285 unsigned long dwOptions
;
288 #define WD_USB_MAX_INTERFACES 30
292 unsigned char bLength
;
293 unsigned char bDescriptorType
;
294 unsigned char bInterfaceNumber
;
295 unsigned char bAlternateSetting
;
296 unsigned char bNumEndpoints
;
297 unsigned char bInterfaceClass
;
298 unsigned char bInterfaceSubClass
;
299 unsigned char bInterfaceProtocol
;
300 unsigned char iInterface
;
301 } WDU_INTERFACE_DESCRIPTOR
;
305 unsigned char bLength
;
306 unsigned char bDescriptorType
;
307 unsigned char bEndpointAddress
;
308 unsigned char bmAttributes
;
309 unsigned short wMaxPacketSize
;
310 unsigned char bInterval
;
311 } WDU_ENDPOINT_DESCRIPTOR
;
315 unsigned char bLength
;
316 unsigned char bDescriptorType
;
317 unsigned short wTotalLength
;
318 unsigned char bNumInterfaces
;
319 unsigned char bConfigurationValue
;
320 unsigned char iConfiguration
;
321 unsigned char bmAttributes
;
322 unsigned char MaxPower
;
323 } WDU_CONFIGURATION_DESCRIPTOR
;
327 unsigned char bLength
;
328 unsigned char bDescriptorType
;
329 unsigned short bcdUSB
;
330 unsigned char bDeviceClass
;
331 unsigned char bDeviceSubClass
;
332 unsigned char bDeviceProtocol
;
333 unsigned char bMaxPacketSize0
;
335 unsigned short idVendor
;
336 unsigned short idProduct
;
337 unsigned short bcdDevice
;
338 unsigned char iManufacturer
;
339 unsigned char iProduct
;
340 unsigned char iSerialNumber
;
341 unsigned char bNumConfigurations
;
342 } WDU_DEVICE_DESCRIPTOR
;
346 WDU_INTERFACE_DESCRIPTOR Descriptor
;
347 WDU_ENDPOINT_DESCRIPTOR
*pEndpointDescriptors
;
348 WDU_PIPE_INFO
*pPipes
;
349 } WDU_ALTERNATE_SETTING
;
353 WDU_ALTERNATE_SETTING
*pAlternateSettings
;
354 unsigned long dwNumAltSettings
;
355 WDU_ALTERNATE_SETTING
*pActiveAltSetting
;
360 WDU_CONFIGURATION_DESCRIPTOR Descriptor
;
361 unsigned long dwNumInterfaces
;
362 WDU_INTERFACE
*pInterfaces
;
365 struct usb_device_info
{
366 WDU_DEVICE_DESCRIPTOR Descriptor
;
368 WDU_CONFIGURATION
*pConfigs
;
369 WDU_CONFIGURATION
*pActiveConfig
;
370 WDU_INTERFACE
*pActiveInterface
[WD_USB_MAX_INTERFACES
];
380 PIPE_TYPE_CONTROL
= 0,
381 PIPE_TYPE_ISOCHRONOUS
= 1,
383 PIPE_TYPE_INTERRUPT
= 3