]> git.zerfleddert.de Git - usb-driver/blame - usb-driver.h
add support for ise 8.1i
[usb-driver] / usb-driver.h
CommitLineData
7216ce6c 1#if __WORDSIZE == 32
da3ba95a 2#define VERSION 0x910
3#define LICENSE 0x952
4#define TRANSFER 0x98c
5#define USB_TRANSFER 0x983
6#define EVENT_UNREGISTER 0x987
7#define INT_DISABLE 0x91f
8#define INT_WAIT 0x94b
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
f152c048 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
7216ce6c 21#else
22#define VERSION 0xc0000910
23#define LICENSE 0xc0000952
24#define TRANSFER 0xc000098c
25#define USB_TRANSFER 0xc0000983
26#define EVENT_UNREGISTER 0xc0000987
27#define INT_DISABLE 0xc000091f
28#define INT_WAIT 0xc000094b
29#define CARD_REGISTER 0xc00009a4
30#define EVENT_REGISTER 0xc00009a5
31#define CARD_UNREGISTER 0xc000092b
32#define USB_GET_DEVICE_DATA 0xc00009a7
33#define INT_ENABLE 0xc000098e
34#define EVENT_PULL 0xc0000988
35#define USB_SET_INTERFACE 0xc0000981
f152c048 36#define CARD_REGISTER_OLD 0xc000097d
37#define INT_ENABLE_OLD 0xc000091e
38#define USB_GET_DEVICE_DATA_OLD 0xc0000980
39#define EVENT_REGISTER_OLD 0xc0000986
40#define TRANSFER_OLD 0xc0000903
7216ce6c 41#endif
da3ba95a 42
43#define MAGIC 0xa410b413UL
44
b72b86b4 45#define WDU_GET_MAX_PACKET_SIZE(x) ((unsigned short) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
795992ad 46
9c9fd67c 47/* http://www.jungo.com/support/documentation/windriver/811/wdusb_man_mhtml/node78.html#SECTION001734000000000000000 */
48
da3ba95a 49struct header_struct {
b72b86b4 50 unsigned long magic;
da3ba95a 51 void* data;
b72b86b4 52 unsigned long size;
da3ba95a 53};
54
55struct version_struct {
b72b86b4 56 unsigned long versionul;
da3ba95a 57 char version[128];
58};
59
60struct license_struct {
61 char cLicense[128]; // Buffer with license string to put.
62 // If empty string then get current license setting
63 // into dwLicense.
b72b86b4 64 unsigned long dwLicense; // Returns license settings: LICENSE_DEMO, LICENSE_WD
da3ba95a 65 // etc..., or 0 for invalid license.
b72b86b4 66 unsigned long dwLicense2; // Returns additional license settings, if dwLicense
da3ba95a 67 // could not hold all the information.
68 // Then dwLicense will return 0.
69};
70
71typedef struct
72{
b72b86b4 73 unsigned long dwVendorId;
74 unsigned long dwDeviceId;
da3ba95a 75} WD_PCI_ID;
76
77typedef struct
78{
b72b86b4 79 unsigned long dwBus;
80 unsigned long dwSlot;
81 unsigned long dwFunction;
da3ba95a 82} WD_PCI_SLOT;
83
84typedef struct
85{
b72b86b4 86 unsigned long dwVendorId;
87 unsigned long dwProductId;
da3ba95a 88} WD_USB_ID;
89
90typedef struct
91{
b72b86b4 92 unsigned short VendorId;
93 unsigned short ProductId;
94 unsigned char bDeviceClass;
95 unsigned char bDeviceSubClass;
96 unsigned char bInterfaceClass;
97 unsigned char bInterfaceSubClass;
98 unsigned char bInterfaceProtocol;
da3ba95a 99} WDU_MATCH_TABLE;
100
101typedef struct
102{
b72b86b4 103 unsigned long dwNumber; // Pipe 0 is the default pipe
104 unsigned long dwMaximumPacketSize;
105 unsigned long type; // USB_PIPE_TYPE
106 unsigned long direction; // WDU_DIR
da3ba95a 107 // Isochronous, Bulk, Interrupt are either USB_DIR_IN or USB_DIR_OUT
108 // Control are USB_DIR_IN_OUT
b72b86b4 109 unsigned long dwInterval; // interval in ms relevant to Interrupt pipes
da3ba95a 110} WD_USB_PIPE_INFO, WD_USB_PIPE_INFO_V43, WDU_PIPE_INFO;
111
112#define WD_USB_MAX_PIPE_NUMBER 32
113
114typedef struct
115{
b72b86b4 116 unsigned long dwPipes;
da3ba95a 117 WD_USB_PIPE_INFO Pipe[WD_USB_MAX_PIPE_NUMBER];
118} WD_USB_DEVICE_INFO, WD_USB_DEVICE_INFO_V43;
119
120struct usb_transfer
121{
b72b86b4 122 unsigned long dwUniqueID;
123 unsigned long dwPipeNum; // Pipe number on device.
124 unsigned long fRead; // TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
125 unsigned long dwOptions; // USB_TRANSFER options:
da3ba95a 126 // USB_ISOCH_FULL_PACKETS_ONLY - For isochronous
127 // transfers only. If set, only full packets will be
128 // transmitted and the transfer function will return
129 // when the amount of bytes left to transfer is less
130 // than the maximum packet size for the pipe (the
131 // function will return without transmitting the
132 // remaining bytes).
133 void* pBuffer; // Pointer to buffer to read/write.
b72b86b4 134 unsigned long dwBufferSize; // Amount of bytes to transfer.
135 unsigned long dwBytesTransferred; // Returns the number of bytes actually read/written
136 unsigned char SetupPacket[8]; // Setup packet for control pipe transfer.
137 unsigned long dwTimeout; // Timeout for the transfer in milliseconds. Set to 0 for infinite wait.
da3ba95a 138};
139
140
141
142
143struct event {
b72b86b4 144 unsigned long handle;
145 unsigned long dwAction; // WD_EVENT_ACTION
146 unsigned long dwStatus; // EVENT_STATUS
147 unsigned long dwEventId;
148 unsigned long dwCardType; //WD_BUS_PCI, WD_BUS_USB, WD_BUS_PCMCIA
149 unsigned long hKernelPlugIn;
150 unsigned long dwOptions; // WD_EVENT_OPTION
da3ba95a 151 union
152 {
153 struct
154 {
155 WD_PCI_ID cardId;
156 WD_PCI_SLOT pciSlot;
157 } Pci;
158 struct
159 {
160 WD_USB_ID deviceId;
b72b86b4 161 unsigned long dwUniqueID;
da3ba95a 162 } Usb;
163 } u;
b72b86b4 164 unsigned long dwEventVer;
165 unsigned long dwNumMatchTables;
da3ba95a 166 WDU_MATCH_TABLE matchTables[1];
167};
168
169typedef struct
170{
b72b86b4 171 unsigned long dwBusType; // Bus Type: ISA, EISA, PCI, PCMCIA.
172 unsigned long dwBusNum; // Bus number.
173 unsigned long dwSlotFunc; // Slot number on Bus.
da3ba95a 174} WD_BUS, WD_BUS_V30;
175
176typedef struct
177{
b72b86b4 178 unsigned long item; // ITEM_TYPE
179 unsigned long fNotSharable;
180 unsigned long dwReserved; // Reserved for internal use
181 unsigned long dwOptions; // WD_ITEM_OPTIONS
da3ba95a 182 union
183 {
184 struct
185 { // ITEM_MEMORY
b72b86b4 186 unsigned long dwPhysicalAddr; // Physical address on card.
187 unsigned long dwBytes; // Address range.
da3ba95a 188 void* dwTransAddr; // Returns the address to pass on to transfer commands.
189 void* dwUserDirectAddr; // Returns the address for direct user read/write.
b72b86b4 190 unsigned long dwCpuPhysicalAddr; // Returns the CPU physical address
191 unsigned long dwBar; // Base Address Register number of PCI card.
da3ba95a 192 } Mem;
193 struct
194 { // ITEM_IO
195 void* dwAddr; // Beginning of io address.
b72b86b4 196 unsigned long dwBytes; // IO range.
197 unsigned long dwBar; // Base Address Register number of PCI card.
da3ba95a 198 } IO;
199 struct
200 { // ITEM_INTERRUPT
b72b86b4 201 unsigned long dwInterrupt; // Number of interrupt to install.
202 unsigned long dwOptions; // Interrupt options. For level sensitive
da3ba95a 203 // interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
b72b86b4 204 unsigned long hInterrupt; // Returns the handle of the interrupt installed.
da3ba95a 205 } Int;
206 WD_BUS Bus; // ITEM_BUS
207 struct
208 {
b72b86b4 209 unsigned long dw1, dw2, dw3, dw4; // Reserved for internal use
da3ba95a 210 void* dw5; // Reserved for internal use
211 } Val;
212 } I;
213} WD_ITEMS, WD_ITEMS_V30;
214
215#define WD_CARD_ITEMS 20
216
217typedef struct
218{
b72b86b4 219 unsigned long dwItems;
da3ba95a 220 WD_ITEMS Item[WD_CARD_ITEMS];
221} WD_CARD, WD_CARD_V30;
222
223enum { CARD_VX_NO_MMU_INIT = 0x4000000 };
224
225struct card_register
226{
227 WD_CARD Card; // Card to register.
b72b86b4 228 unsigned long fCheckLockOnly; // Only check if card is lockable, return hCard=1 if OK.
229 unsigned long hCard; // Handle of card.
230 unsigned long dwOptions; // Should be zero.
da3ba95a 231 char cName[32]; // Name of card.
232 char cDescription[100]; // Description.
233};
9c9fd67c 234
235typedef struct
236{
237 void* dwPort; // IO port for transfer or kernel memory address.
b72b86b4 238 unsigned long cmdTrans; // Transfer command WD_TRANSFER_CMD.
9c9fd67c 239
240 // Parameters used for string transfers:
b72b86b4 241 unsigned long dwBytes; // For string transfer.
242 unsigned long fAutoinc; // Transfer from one port/address
9c9fd67c 243 // or use incremental range of addresses.
b72b86b4 244 unsigned long dwOptions; // Must be 0.
9c9fd67c 245 union
246 {
b72b86b4 247 unsigned char Byte; // Use for 8 bit transfer.
248 unsigned short Word; // Use for 16 bit transfer.
11d01742 249 uint32_t Dword; // Use for 32 bit transfer.
250 uint64_t Qword; // Use for 64 bit transfer.
9c9fd67c 251 void* pBuffer; // Use for string transfer.
252 } Data;
253} WD_TRANSFER, WD_TRANSFER_V61;
254
255typedef struct
256{
b72b86b4 257 unsigned long hKernelPlugIn;
258 unsigned long dwMessage;
9c9fd67c 259 void* pData;
b72b86b4 260 unsigned long dwResult;
9c9fd67c 261} WD_KERNEL_PLUGIN_CALL, WD_KERNEL_PLUGIN_CALL_V40;
262
263
264struct interrupt
265{
b72b86b4 266 unsigned long hInterrupt; // Handle of interrupt.
267 unsigned long dwOptions; // Interrupt options: can be INTERRUPT_CMD_COPY
9c9fd67c 268
269 WD_TRANSFER *Cmd; // Commands to do on interrupt.
b72b86b4 270 unsigned long dwCmds; // Number of commands.
9c9fd67c 271
272 // For WD_IntEnable():
273 WD_KERNEL_PLUGIN_CALL kpCall; // Kernel PlugIn call.
b72b86b4 274 unsigned long fEnableOk; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
9c9fd67c 275
276 // For WD_IntWait() and WD_IntCount():
b72b86b4 277 unsigned long dwCounter; // Number of interrupts received.
278 unsigned long dwLost; // Number of interrupts not yet dealt with.
279 unsigned long fStopped; // Was interrupt disabled during wait.
9c9fd67c 280};
281
282struct usb_set_interface
283{
b72b86b4 284 unsigned long dwUniqueID;
285 unsigned long dwInterfaceNum;
286 unsigned long dwAlternateSetting;
287 unsigned long dwOptions;
9c9fd67c 288};
289
290struct usb_get_device_data
291{
b72b86b4 292 unsigned long dwUniqueID;
9c9fd67c 293 void* pBuf;
b72b86b4 294 unsigned long dwBytes;
295 unsigned long dwOptions;
9c9fd67c 296};
297
298#define WD_USB_MAX_INTERFACES 30
299
300typedef struct
301{
b72b86b4 302 unsigned char bLength;
303 unsigned char bDescriptorType;
304 unsigned char bInterfaceNumber;
305 unsigned char bAlternateSetting;
306 unsigned char bNumEndpoints;
307 unsigned char bInterfaceClass;
308 unsigned char bInterfaceSubClass;
309 unsigned char bInterfaceProtocol;
310 unsigned char iInterface;
9c9fd67c 311} WDU_INTERFACE_DESCRIPTOR;
312
313typedef struct
314{
b72b86b4 315 unsigned char bLength;
316 unsigned char bDescriptorType;
317 unsigned char bEndpointAddress;
318 unsigned char bmAttributes;
319 unsigned short wMaxPacketSize;
320 unsigned char bInterval;
9c9fd67c 321} WDU_ENDPOINT_DESCRIPTOR;
322
323typedef struct
324{
b72b86b4 325 unsigned char bLength;
326 unsigned char bDescriptorType;
327 unsigned short wTotalLength;
328 unsigned char bNumInterfaces;
329 unsigned char bConfigurationValue;
330 unsigned char iConfiguration;
331 unsigned char bmAttributes;
332 unsigned char MaxPower;
9c9fd67c 333} WDU_CONFIGURATION_DESCRIPTOR;
334
335typedef struct
336{
b72b86b4 337 unsigned char bLength;
338 unsigned char bDescriptorType;
339 unsigned short bcdUSB;
340 unsigned char bDeviceClass;
341 unsigned char bDeviceSubClass;
342 unsigned char bDeviceProtocol;
343 unsigned char bMaxPacketSize0;
344
345 unsigned short idVendor;
346 unsigned short idProduct;
347 unsigned short bcdDevice;
348 unsigned char iManufacturer;
349 unsigned char iProduct;
350 unsigned char iSerialNumber;
351 unsigned char bNumConfigurations;
9c9fd67c 352} WDU_DEVICE_DESCRIPTOR;
353
354typedef struct
355{
356 WDU_INTERFACE_DESCRIPTOR Descriptor;
357 WDU_ENDPOINT_DESCRIPTOR *pEndpointDescriptors;
358 WDU_PIPE_INFO *pPipes;
359} WDU_ALTERNATE_SETTING;
360
361typedef struct
362{
363 WDU_ALTERNATE_SETTING *pAlternateSettings;
b72b86b4 364 unsigned long dwNumAltSettings;
9c9fd67c 365 WDU_ALTERNATE_SETTING *pActiveAltSetting;
366} WDU_INTERFACE;
367
368typedef struct
369{
370 WDU_CONFIGURATION_DESCRIPTOR Descriptor;
b72b86b4 371 unsigned long dwNumInterfaces;
9c9fd67c 372 WDU_INTERFACE *pInterfaces;
373} WDU_CONFIGURATION;
374
e71b6bf3 375struct usb_device_info {
9c9fd67c 376 WDU_DEVICE_DESCRIPTOR Descriptor;
377 WDU_PIPE_INFO Pipe0;
378 WDU_CONFIGURATION *pConfigs;
379 WDU_CONFIGURATION *pActiveConfig;
380 WDU_INTERFACE *pActiveInterface[WD_USB_MAX_INTERFACES];
381};
3be69a94 382
f95f1d2e 383typedef enum {
384 WDU_DIR_IN = 1,
385 WDU_DIR_OUT = 2,
386 WDU_DIR_IN_OUT = 3
387} WDU_DIR;
388
389typedef enum {
390 PIPE_TYPE_CONTROL = 0,
391 PIPE_TYPE_ISOCHRONOUS = 1,
392 PIPE_TYPE_BULK = 2,
393 PIPE_TYPE_INTERRUPT = 3
394} USB_PIPE_TYPE;
Impressum, Datenschutz