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
34 #define WDU_GET_MAX_PACKET_SIZE(x) ((unsigned short) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
42 /* http://www.jungo.com/support/documentation/windriver/811/wdusb_man_mhtml/node78.html#SECTION001734000000000000000 */
44 struct header_struct
{
50 struct version_struct
{
51 unsigned long versionul
;
55 struct license_struct
{
56 char cLicense
[128]; // Buffer with license string to put.
57 // If empty string then get current license setting
59 unsigned long dwLicense
; // Returns license settings: LICENSE_DEMO, LICENSE_WD
60 // etc..., or 0 for invalid license.
61 unsigned long dwLicense2
; // Returns additional license settings, if dwLicense
62 // could not hold all the information.
63 // Then dwLicense will return 0.
68 unsigned long dwVendorId
;
69 unsigned long dwDeviceId
;
76 unsigned long dwFunction
;
81 unsigned long dwVendorId
;
82 unsigned long dwProductId
;
87 unsigned short VendorId
;
88 unsigned short ProductId
;
89 unsigned char bDeviceClass
;
90 unsigned char bDeviceSubClass
;
91 unsigned char bInterfaceClass
;
92 unsigned char bInterfaceSubClass
;
93 unsigned char bInterfaceProtocol
;
98 unsigned long dwNumber
; // Pipe 0 is the default pipe
99 unsigned long dwMaximumPacketSize
;
100 unsigned long type
; // USB_PIPE_TYPE
101 unsigned long direction
; // WDU_DIR
102 // Isochronous, Bulk, Interrupt are either USB_DIR_IN or USB_DIR_OUT
103 // Control are USB_DIR_IN_OUT
104 unsigned long dwInterval
; // interval in ms relevant to Interrupt pipes
105 } WD_USB_PIPE_INFO
, WD_USB_PIPE_INFO_V43
, WDU_PIPE_INFO
;
107 #define WD_USB_MAX_PIPE_NUMBER 32
111 unsigned long dwPipes
;
112 WD_USB_PIPE_INFO Pipe
[WD_USB_MAX_PIPE_NUMBER
];
113 } WD_USB_DEVICE_INFO
, WD_USB_DEVICE_INFO_V43
;
117 unsigned long dwUniqueID
;
118 unsigned long dwPipeNum
; // Pipe number on device.
119 unsigned long fRead
; // TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
120 unsigned long dwOptions
; // USB_TRANSFER options:
121 // USB_ISOCH_FULL_PACKETS_ONLY - For isochronous
122 // transfers only. If set, only full packets will be
123 // transmitted and the transfer function will return
124 // when the amount of bytes left to transfer is less
125 // than the maximum packet size for the pipe (the
126 // function will return without transmitting the
128 void* pBuffer
; // Pointer to buffer to read/write.
129 unsigned long dwBufferSize
; // Amount of bytes to transfer.
130 unsigned long dwBytesTransferred
; // Returns the number of bytes actually read/written
131 unsigned char SetupPacket
[8]; // Setup packet for control pipe transfer.
132 unsigned long dwTimeout
; // Timeout for the transfer in milliseconds. Set to 0 for infinite wait.
139 unsigned long handle
;
140 unsigned long dwAction
; // WD_EVENT_ACTION
141 unsigned long dwStatus
; // EVENT_STATUS
142 unsigned long dwEventId
;
143 unsigned long dwCardType
; //WD_BUS_PCI, WD_BUS_USB, WD_BUS_PCMCIA
144 unsigned long hKernelPlugIn
;
145 unsigned long dwOptions
; // WD_EVENT_OPTION
156 unsigned long dwUniqueID
;
159 unsigned long dwEventVer
;
160 unsigned long dwNumMatchTables
;
161 WDU_MATCH_TABLE matchTables
[1];
166 unsigned long dwBusType
; // Bus Type: ISA, EISA, PCI, PCMCIA.
167 unsigned long dwBusNum
; // Bus number.
168 unsigned long dwSlotFunc
; // Slot number on Bus.
169 } WD_BUS
, WD_BUS_V30
;
173 unsigned long item
; // ITEM_TYPE
174 unsigned long fNotSharable
;
175 unsigned long dwReserved
; // Reserved for internal use
176 unsigned long dwOptions
; // WD_ITEM_OPTIONS
181 unsigned long dwPhysicalAddr
; // Physical address on card.
182 unsigned long dwBytes
; // Address range.
183 void* dwTransAddr
; // Returns the address to pass on to transfer commands.
184 void* dwUserDirectAddr
; // Returns the address for direct user read/write.
185 unsigned long dwCpuPhysicalAddr
; // Returns the CPU physical address
186 unsigned long dwBar
; // Base Address Register number of PCI card.
190 void* dwAddr
; // Beginning of io address.
191 unsigned long dwBytes
; // IO range.
192 unsigned long dwBar
; // Base Address Register number of PCI card.
196 unsigned long dwInterrupt
; // Number of interrupt to install.
197 unsigned long dwOptions
; // Interrupt options. For level sensitive
198 // interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
199 unsigned long hInterrupt
; // Returns the handle of the interrupt installed.
201 WD_BUS Bus
; // ITEM_BUS
204 unsigned long dw1
, dw2
, dw3
, dw4
; // Reserved for internal use
205 void* dw5
; // Reserved for internal use
208 } WD_ITEMS
, WD_ITEMS_V30
;
210 #define WD_CARD_ITEMS 20
214 unsigned long dwItems
;
215 WD_ITEMS Item
[WD_CARD_ITEMS
];
216 } WD_CARD
, WD_CARD_V30
;
218 enum { CARD_VX_NO_MMU_INIT
= 0x4000000 };
222 WD_CARD Card
; // Card to register.
223 unsigned long fCheckLockOnly
; // Only check if card is lockable, return hCard=1 if OK.
224 unsigned long hCard
; // Handle of card.
225 unsigned long dwOptions
; // Should be zero.
226 char cName
[32]; // Name of card.
227 char cDescription
[100]; // Description.
232 void* dwPort
; // IO port for transfer or kernel memory address.
233 unsigned long cmdTrans
; // Transfer command WD_TRANSFER_CMD.
235 // Parameters used for string transfers:
236 unsigned long dwBytes
; // For string transfer.
237 unsigned long fAutoinc
; // Transfer from one port/address
238 // or use incremental range of addresses.
239 unsigned long dwOptions
; // Must be 0.
242 unsigned char Byte
; // Use for 8 bit transfer.
243 unsigned short Word
; // Use for 16 bit transfer.
244 uint32_t Dword
; // Use for 32 bit transfer.
245 uint64_t Qword
; // Use for 64 bit transfer.
246 void* pBuffer
; // Use for string transfer.
248 } WD_TRANSFER
, WD_TRANSFER_V61
;
252 unsigned long hKernelPlugIn
;
253 unsigned long dwMessage
;
255 unsigned long dwResult
;
256 } WD_KERNEL_PLUGIN_CALL
, WD_KERNEL_PLUGIN_CALL_V40
;
261 unsigned long hInterrupt
; // Handle of interrupt.
262 unsigned long dwOptions
; // Interrupt options: can be INTERRUPT_CMD_COPY
264 WD_TRANSFER
*Cmd
; // Commands to do on interrupt.
265 unsigned long dwCmds
; // Number of commands.
267 // For WD_IntEnable():
268 WD_KERNEL_PLUGIN_CALL kpCall
; // Kernel PlugIn call.
269 unsigned long fEnableOk
; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
271 // For WD_IntWait() and WD_IntCount():
272 unsigned long dwCounter
; // Number of interrupts received.
273 unsigned long dwLost
; // Number of interrupts not yet dealt with.
274 unsigned long fStopped
; // Was interrupt disabled during wait.
277 struct usb_set_interface
279 unsigned long dwUniqueID
;
280 unsigned long dwInterfaceNum
;
281 unsigned long dwAlternateSetting
;
282 unsigned long dwOptions
;
285 struct usb_get_device_data
287 unsigned long dwUniqueID
;
289 unsigned long dwBytes
;
290 unsigned long dwOptions
;
293 #define WD_USB_MAX_INTERFACES 30
297 unsigned char bLength
;
298 unsigned char bDescriptorType
;
299 unsigned char bInterfaceNumber
;
300 unsigned char bAlternateSetting
;
301 unsigned char bNumEndpoints
;
302 unsigned char bInterfaceClass
;
303 unsigned char bInterfaceSubClass
;
304 unsigned char bInterfaceProtocol
;
305 unsigned char iInterface
;
306 } WDU_INTERFACE_DESCRIPTOR
;
310 unsigned char bLength
;
311 unsigned char bDescriptorType
;
312 unsigned char bEndpointAddress
;
313 unsigned char bmAttributes
;
314 unsigned short wMaxPacketSize
;
315 unsigned char bInterval
;
316 } WDU_ENDPOINT_DESCRIPTOR
;
320 unsigned char bLength
;
321 unsigned char bDescriptorType
;
322 unsigned short wTotalLength
;
323 unsigned char bNumInterfaces
;
324 unsigned char bConfigurationValue
;
325 unsigned char iConfiguration
;
326 unsigned char bmAttributes
;
327 unsigned char MaxPower
;
328 } WDU_CONFIGURATION_DESCRIPTOR
;
332 unsigned char bLength
;
333 unsigned char bDescriptorType
;
334 unsigned short bcdUSB
;
335 unsigned char bDeviceClass
;
336 unsigned char bDeviceSubClass
;
337 unsigned char bDeviceProtocol
;
338 unsigned char bMaxPacketSize0
;
340 unsigned short idVendor
;
341 unsigned short idProduct
;
342 unsigned short bcdDevice
;
343 unsigned char iManufacturer
;
344 unsigned char iProduct
;
345 unsigned char iSerialNumber
;
346 unsigned char bNumConfigurations
;
347 } WDU_DEVICE_DESCRIPTOR
;
351 WDU_INTERFACE_DESCRIPTOR Descriptor
;
352 WDU_ENDPOINT_DESCRIPTOR
*pEndpointDescriptors
;
353 WDU_PIPE_INFO
*pPipes
;
354 } WDU_ALTERNATE_SETTING
;
358 WDU_ALTERNATE_SETTING
*pAlternateSettings
;
359 unsigned long dwNumAltSettings
;
360 WDU_ALTERNATE_SETTING
*pActiveAltSetting
;
365 WDU_CONFIGURATION_DESCRIPTOR Descriptor
;
366 unsigned long dwNumInterfaces
;
367 WDU_INTERFACE
*pInterfaces
;
370 struct usb_device_info
{
371 WDU_DEVICE_DESCRIPTOR Descriptor
;
373 WDU_CONFIGURATION
*pConfigs
;
374 WDU_CONFIGURATION
*pActiveConfig
;
375 WDU_INTERFACE
*pActiveInterface
[WD_USB_MAX_INTERFACES
];
385 PIPE_TYPE_CONTROL
= 0,
386 PIPE_TYPE_ISOCHRONOUS
= 1,
388 PIPE_TYPE_INTERRUPT
= 3