4 #define MULTI_TRANSFER 0x98d
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
16 #define CARD_REGISTER_OLD 0x97d
17 #define INT_ENABLE_OLD 0x91e
18 #define USB_GET_DEVICE_DATA_OLD 0x980
19 #define EVENT_REGISTER_OLD 0x986
20 #define TRANSFER_OLD 0x903
21 #define MULTI_TRANSFER_OLD 0x904
23 #define MAGIC 0xa410b413UL
25 #define WDU_GET_MAX_PACKET_SIZE(x) ((unsigned short) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
27 /* http://www.jungo.com/support/documentation/windriver/811/wdusb_man_mhtml/node78.html#SECTION001734000000000000000 */
29 struct header_struct
{
35 struct version_struct
{
36 unsigned long versionul
;
40 struct license_struct
{
41 char cLicense
[128]; // Buffer with license string to put.
42 // If empty string then get current license setting
44 unsigned long dwLicense
; // Returns license settings: LICENSE_DEMO, LICENSE_WD
45 // etc..., or 0 for invalid license.
46 unsigned long dwLicense2
; // Returns additional license settings, if dwLicense
47 // could not hold all the information.
48 // Then dwLicense will return 0.
53 unsigned long dwVendorId
;
54 unsigned long dwDeviceId
;
61 unsigned long dwFunction
;
66 unsigned long dwVendorId
;
67 unsigned long dwProductId
;
72 unsigned short VendorId
;
73 unsigned short ProductId
;
74 unsigned char bDeviceClass
;
75 unsigned char bDeviceSubClass
;
76 unsigned char bInterfaceClass
;
77 unsigned char bInterfaceSubClass
;
78 unsigned char bInterfaceProtocol
;
83 unsigned long dwNumber
; // Pipe 0 is the default pipe
84 unsigned long dwMaximumPacketSize
;
85 unsigned long type
; // USB_PIPE_TYPE
86 unsigned long direction
; // WDU_DIR
87 // Isochronous, Bulk, Interrupt are either USB_DIR_IN or USB_DIR_OUT
88 // Control are USB_DIR_IN_OUT
89 unsigned long dwInterval
; // interval in ms relevant to Interrupt pipes
90 } WD_USB_PIPE_INFO
, WD_USB_PIPE_INFO_V43
, WDU_PIPE_INFO
;
92 #define WD_USB_MAX_PIPE_NUMBER 32
96 unsigned long dwPipes
;
97 WD_USB_PIPE_INFO Pipe
[WD_USB_MAX_PIPE_NUMBER
];
98 } WD_USB_DEVICE_INFO
, WD_USB_DEVICE_INFO_V43
;
102 unsigned long dwUniqueID
;
103 unsigned long dwPipeNum
; // Pipe number on device.
104 unsigned long fRead
; // TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
105 unsigned long dwOptions
; // USB_TRANSFER options:
106 // USB_ISOCH_FULL_PACKETS_ONLY - For isochronous
107 // transfers only. If set, only full packets will be
108 // transmitted and the transfer function will return
109 // when the amount of bytes left to transfer is less
110 // than the maximum packet size for the pipe (the
111 // function will return without transmitting the
113 void* pBuffer
; // Pointer to buffer to read/write.
114 unsigned long dwBufferSize
; // Amount of bytes to transfer.
115 unsigned long dwBytesTransferred
; // Returns the number of bytes actually read/written
116 unsigned char SetupPacket
[8]; // Setup packet for control pipe transfer.
117 unsigned long dwTimeout
; // Timeout for the transfer in milliseconds. Set to 0 for infinite wait.
124 unsigned long handle
;
125 unsigned long dwAction
; // WD_EVENT_ACTION
126 unsigned long dwStatus
; // EVENT_STATUS
127 unsigned long dwEventId
;
128 unsigned long dwCardType
; //WD_BUS_PCI, WD_BUS_USB, WD_BUS_PCMCIA
129 unsigned long hKernelPlugIn
;
130 unsigned long dwOptions
; // WD_EVENT_OPTION
141 unsigned long dwUniqueID
;
144 unsigned long dwEventVer
;
145 unsigned long dwNumMatchTables
;
146 WDU_MATCH_TABLE matchTables
[1];
151 unsigned long dwBusType
; // Bus Type: ISA, EISA, PCI, PCMCIA.
152 unsigned long dwBusNum
; // Bus number.
153 unsigned long dwSlotFunc
; // Slot number on Bus.
154 } WD_BUS
, WD_BUS_V30
;
158 unsigned long item
; // ITEM_TYPE
159 unsigned long fNotSharable
;
160 unsigned long dwReserved
; // Reserved for internal use
161 unsigned long dwOptions
; // WD_ITEM_OPTIONS
166 unsigned long dwPhysicalAddr
; // Physical address on card.
167 unsigned long dwBytes
; // Address range.
168 void* dwTransAddr
; // Returns the address to pass on to transfer commands.
169 void* dwUserDirectAddr
; // Returns the address for direct user read/write.
170 unsigned long dwCpuPhysicalAddr
; // Returns the CPU physical address
171 unsigned long dwBar
; // Base Address Register number of PCI card.
175 void* dwAddr
; // Beginning of io address.
176 unsigned long dwBytes
; // IO range.
177 unsigned long dwBar
; // Base Address Register number of PCI card.
181 unsigned long dwInterrupt
; // Number of interrupt to install.
182 unsigned long dwOptions
; // Interrupt options. For level sensitive
183 // interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
184 unsigned long hInterrupt
; // Returns the handle of the interrupt installed.
186 WD_BUS Bus
; // ITEM_BUS
189 unsigned long dw1
, dw2
, dw3
, dw4
; // Reserved for internal use
190 void* dw5
; // Reserved for internal use
193 } WD_ITEMS
, WD_ITEMS_V30
;
195 #define WD_CARD_ITEMS 20
199 unsigned long dwItems
;
200 WD_ITEMS Item
[WD_CARD_ITEMS
];
201 } WD_CARD
, WD_CARD_V30
;
203 enum { CARD_VX_NO_MMU_INIT
= 0x4000000 };
207 WD_CARD Card
; // Card to register.
208 unsigned long fCheckLockOnly
; // Only check if card is lockable, return hCard=1 if OK.
209 unsigned long hCard
; // Handle of card.
210 unsigned long dwOptions
; // Should be zero.
211 char cName
[32]; // Name of card.
212 char cDescription
[100]; // Description.
217 void* dwPort
; // IO port for transfer or kernel memory address.
218 unsigned long cmdTrans
; // Transfer command WD_TRANSFER_CMD.
220 // Parameters used for string transfers:
221 unsigned long dwBytes
; // For string transfer.
222 unsigned long fAutoinc
; // Transfer from one port/address
223 // or use incremental range of addresses.
224 unsigned long dwOptions
; // Must be 0.
227 unsigned char Byte
; // Use for 8 bit transfer.
228 unsigned short Word
; // Use for 16 bit transfer.
229 uint32_t Dword
; // Use for 32 bit transfer.
230 uint64_t Qword
; // Use for 64 bit transfer.
231 void* pBuffer
; // Use for string transfer.
233 } WD_TRANSFER
, WD_TRANSFER_V61
;
237 unsigned long hKernelPlugIn
;
238 unsigned long dwMessage
;
240 unsigned long dwResult
;
241 } WD_KERNEL_PLUGIN_CALL
, WD_KERNEL_PLUGIN_CALL_V40
;
246 unsigned long hInterrupt
; // Handle of interrupt.
247 unsigned long dwOptions
; // Interrupt options: can be INTERRUPT_CMD_COPY
249 WD_TRANSFER
*Cmd
; // Commands to do on interrupt.
250 unsigned long dwCmds
; // Number of commands.
252 // For WD_IntEnable():
253 WD_KERNEL_PLUGIN_CALL kpCall
; // Kernel PlugIn call.
254 unsigned long fEnableOk
; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
256 // For WD_IntWait() and WD_IntCount():
257 unsigned long dwCounter
; // Number of interrupts received.
258 unsigned long dwLost
; // Number of interrupts not yet dealt with.
259 unsigned long fStopped
; // Was interrupt disabled during wait.
262 struct usb_set_interface
264 unsigned long dwUniqueID
;
265 unsigned long dwInterfaceNum
;
266 unsigned long dwAlternateSetting
;
267 unsigned long dwOptions
;
270 struct usb_get_device_data
272 unsigned long dwUniqueID
;
274 unsigned long dwBytes
;
275 unsigned long dwOptions
;
278 #define WD_USB_MAX_INTERFACES 30
282 unsigned char bLength
;
283 unsigned char bDescriptorType
;
284 unsigned char bInterfaceNumber
;
285 unsigned char bAlternateSetting
;
286 unsigned char bNumEndpoints
;
287 unsigned char bInterfaceClass
;
288 unsigned char bInterfaceSubClass
;
289 unsigned char bInterfaceProtocol
;
290 unsigned char iInterface
;
291 } WDU_INTERFACE_DESCRIPTOR
;
295 unsigned char bLength
;
296 unsigned char bDescriptorType
;
297 unsigned char bEndpointAddress
;
298 unsigned char bmAttributes
;
299 unsigned short wMaxPacketSize
;
300 unsigned char bInterval
;
301 } WDU_ENDPOINT_DESCRIPTOR
;
305 unsigned char bLength
;
306 unsigned char bDescriptorType
;
307 unsigned short wTotalLength
;
308 unsigned char bNumInterfaces
;
309 unsigned char bConfigurationValue
;
310 unsigned char iConfiguration
;
311 unsigned char bmAttributes
;
312 unsigned char MaxPower
;
313 } WDU_CONFIGURATION_DESCRIPTOR
;
317 unsigned char bLength
;
318 unsigned char bDescriptorType
;
319 unsigned short bcdUSB
;
320 unsigned char bDeviceClass
;
321 unsigned char bDeviceSubClass
;
322 unsigned char bDeviceProtocol
;
323 unsigned char bMaxPacketSize0
;
325 unsigned short idVendor
;
326 unsigned short idProduct
;
327 unsigned short bcdDevice
;
328 unsigned char iManufacturer
;
329 unsigned char iProduct
;
330 unsigned char iSerialNumber
;
331 unsigned char bNumConfigurations
;
332 } WDU_DEVICE_DESCRIPTOR
;
336 WDU_INTERFACE_DESCRIPTOR Descriptor
;
337 WDU_ENDPOINT_DESCRIPTOR
*pEndpointDescriptors
;
338 WDU_PIPE_INFO
*pPipes
;
339 } WDU_ALTERNATE_SETTING
;
343 WDU_ALTERNATE_SETTING
*pAlternateSettings
;
344 unsigned long dwNumAltSettings
;
345 WDU_ALTERNATE_SETTING
*pActiveAltSetting
;
350 WDU_CONFIGURATION_DESCRIPTOR Descriptor
;
351 unsigned long dwNumInterfaces
;
352 WDU_INTERFACE
*pInterfaces
;
355 struct usb_device_info
{
356 WDU_DEVICE_DESCRIPTOR Descriptor
;
358 WDU_CONFIGURATION
*pConfigs
;
359 WDU_CONFIGURATION
*pActiveConfig
;
360 WDU_INTERFACE
*pActiveInterface
[WD_USB_MAX_INTERFACES
];
370 PIPE_TYPE_CONTROL
= 0,
371 PIPE_TYPE_ISOCHRONOUS
= 1,
373 PIPE_TYPE_INTERRUPT
= 3