]> cvs.zerfleddert.de Git - usb-driver/blame - usb-driver.h
impact requests ECP addresses, even when ECP is not available. Ignore
[usb-driver] / usb-driver.h
CommitLineData
da3ba95a 1#define VERSION 0x910
2#define LICENSE 0x952
3#define TRANSFER 0x98c
576995a8 4#define MULTI_TRANSFER 0x98d
da3ba95a 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
54357994 21#define MULTI_TRANSFER_OLD 0x904
da3ba95a 22
23#define MAGIC 0xa410b413UL
24
b72b86b4 25#define WDU_GET_MAX_PACKET_SIZE(x) ((unsigned short) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
795992ad 26
9c9fd67c 27/* http://www.jungo.com/support/documentation/windriver/811/wdusb_man_mhtml/node78.html#SECTION001734000000000000000 */
28
da3ba95a 29struct header_struct {
b72b86b4 30 unsigned long magic;
da3ba95a 31 void* data;
b72b86b4 32 unsigned long size;
da3ba95a 33};
34
35struct version_struct {
b72b86b4 36 unsigned long versionul;
da3ba95a 37 char version[128];
38};
39
40struct license_struct {
41 char cLicense[128]; // Buffer with license string to put.
42 // If empty string then get current license setting
43 // into dwLicense.
b72b86b4 44 unsigned long dwLicense; // Returns license settings: LICENSE_DEMO, LICENSE_WD
da3ba95a 45 // etc..., or 0 for invalid license.
b72b86b4 46 unsigned long dwLicense2; // Returns additional license settings, if dwLicense
da3ba95a 47 // could not hold all the information.
48 // Then dwLicense will return 0.
49};
50
51typedef struct
52{
b72b86b4 53 unsigned long dwVendorId;
54 unsigned long dwDeviceId;
da3ba95a 55} WD_PCI_ID;
56
57typedef struct
58{
b72b86b4 59 unsigned long dwBus;
60 unsigned long dwSlot;
61 unsigned long dwFunction;
da3ba95a 62} WD_PCI_SLOT;
63
64typedef struct
65{
b72b86b4 66 unsigned long dwVendorId;
67 unsigned long dwProductId;
da3ba95a 68} WD_USB_ID;
69
70typedef struct
71{
b72b86b4 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;
da3ba95a 79} WDU_MATCH_TABLE;
80
81typedef struct
82{
b72b86b4 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
da3ba95a 87 // Isochronous, Bulk, Interrupt are either USB_DIR_IN or USB_DIR_OUT
88 // Control are USB_DIR_IN_OUT
b72b86b4 89 unsigned long dwInterval; // interval in ms relevant to Interrupt pipes
da3ba95a 90} WD_USB_PIPE_INFO, WD_USB_PIPE_INFO_V43, WDU_PIPE_INFO;
91
92#define WD_USB_MAX_PIPE_NUMBER 32
93
94typedef struct
95{
b72b86b4 96 unsigned long dwPipes;
da3ba95a 97 WD_USB_PIPE_INFO Pipe[WD_USB_MAX_PIPE_NUMBER];
98} WD_USB_DEVICE_INFO, WD_USB_DEVICE_INFO_V43;
99
100struct usb_transfer
101{
b72b86b4 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:
da3ba95a 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
112 // remaining bytes).
113 void* pBuffer; // Pointer to buffer to read/write.
b72b86b4 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.
da3ba95a 118};
119
120
121
122
123struct event {
b72b86b4 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
da3ba95a 131 union
132 {
133 struct
134 {
135 WD_PCI_ID cardId;
136 WD_PCI_SLOT pciSlot;
137 } Pci;
138 struct
139 {
140 WD_USB_ID deviceId;
b72b86b4 141 unsigned long dwUniqueID;
da3ba95a 142 } Usb;
143 } u;
b72b86b4 144 unsigned long dwEventVer;
145 unsigned long dwNumMatchTables;
da3ba95a 146 WDU_MATCH_TABLE matchTables[1];
147};
148
149typedef struct
150{
b72b86b4 151 unsigned long dwBusType; // Bus Type: ISA, EISA, PCI, PCMCIA.
152 unsigned long dwBusNum; // Bus number.
153 unsigned long dwSlotFunc; // Slot number on Bus.
da3ba95a 154} WD_BUS, WD_BUS_V30;
155
156typedef struct
157{
b72b86b4 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
da3ba95a 162 union
163 {
164 struct
165 { // ITEM_MEMORY
b72b86b4 166 unsigned long dwPhysicalAddr; // Physical address on card.
167 unsigned long dwBytes; // Address range.
da3ba95a 168 void* dwTransAddr; // Returns the address to pass on to transfer commands.
169 void* dwUserDirectAddr; // Returns the address for direct user read/write.
b72b86b4 170 unsigned long dwCpuPhysicalAddr; // Returns the CPU physical address
171 unsigned long dwBar; // Base Address Register number of PCI card.
da3ba95a 172 } Mem;
173 struct
174 { // ITEM_IO
175 void* dwAddr; // Beginning of io address.
b72b86b4 176 unsigned long dwBytes; // IO range.
177 unsigned long dwBar; // Base Address Register number of PCI card.
da3ba95a 178 } IO;
179 struct
180 { // ITEM_INTERRUPT
b72b86b4 181 unsigned long dwInterrupt; // Number of interrupt to install.
182 unsigned long dwOptions; // Interrupt options. For level sensitive
da3ba95a 183 // interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
b72b86b4 184 unsigned long hInterrupt; // Returns the handle of the interrupt installed.
da3ba95a 185 } Int;
186 WD_BUS Bus; // ITEM_BUS
187 struct
188 {
b72b86b4 189 unsigned long dw1, dw2, dw3, dw4; // Reserved for internal use
da3ba95a 190 void* dw5; // Reserved for internal use
191 } Val;
192 } I;
193} WD_ITEMS, WD_ITEMS_V30;
194
195#define WD_CARD_ITEMS 20
196
197typedef struct
198{
b72b86b4 199 unsigned long dwItems;
da3ba95a 200 WD_ITEMS Item[WD_CARD_ITEMS];
201} WD_CARD, WD_CARD_V30;
202
203enum { CARD_VX_NO_MMU_INIT = 0x4000000 };
204
205struct card_register
206{
207 WD_CARD Card; // Card to register.
b72b86b4 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.
da3ba95a 211 char cName[32]; // Name of card.
212 char cDescription[100]; // Description.
213};
9c9fd67c 214
215typedef struct
216{
217 void* dwPort; // IO port for transfer or kernel memory address.
b72b86b4 218 unsigned long cmdTrans; // Transfer command WD_TRANSFER_CMD.
9c9fd67c 219
220 // Parameters used for string transfers:
b72b86b4 221 unsigned long dwBytes; // For string transfer.
222 unsigned long fAutoinc; // Transfer from one port/address
9c9fd67c 223 // or use incremental range of addresses.
b72b86b4 224 unsigned long dwOptions; // Must be 0.
9c9fd67c 225 union
226 {
b72b86b4 227 unsigned char Byte; // Use for 8 bit transfer.
228 unsigned short Word; // Use for 16 bit transfer.
11d01742 229 uint32_t Dword; // Use for 32 bit transfer.
230 uint64_t Qword; // Use for 64 bit transfer.
9c9fd67c 231 void* pBuffer; // Use for string transfer.
232 } Data;
233} WD_TRANSFER, WD_TRANSFER_V61;
234
235typedef struct
236{
b72b86b4 237 unsigned long hKernelPlugIn;
238 unsigned long dwMessage;
9c9fd67c 239 void* pData;
b72b86b4 240 unsigned long dwResult;
9c9fd67c 241} WD_KERNEL_PLUGIN_CALL, WD_KERNEL_PLUGIN_CALL_V40;
242
243
244struct interrupt
245{
b72b86b4 246 unsigned long hInterrupt; // Handle of interrupt.
247 unsigned long dwOptions; // Interrupt options: can be INTERRUPT_CMD_COPY
9c9fd67c 248
249 WD_TRANSFER *Cmd; // Commands to do on interrupt.
b72b86b4 250 unsigned long dwCmds; // Number of commands.
9c9fd67c 251
252 // For WD_IntEnable():
253 WD_KERNEL_PLUGIN_CALL kpCall; // Kernel PlugIn call.
b72b86b4 254 unsigned long fEnableOk; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
9c9fd67c 255
256 // For WD_IntWait() and WD_IntCount():
b72b86b4 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.
9c9fd67c 260};
261
262struct usb_set_interface
263{
b72b86b4 264 unsigned long dwUniqueID;
265 unsigned long dwInterfaceNum;
266 unsigned long dwAlternateSetting;
267 unsigned long dwOptions;
9c9fd67c 268};
269
270struct usb_get_device_data
271{
b72b86b4 272 unsigned long dwUniqueID;
9c9fd67c 273 void* pBuf;
b72b86b4 274 unsigned long dwBytes;
275 unsigned long dwOptions;
9c9fd67c 276};
277
278#define WD_USB_MAX_INTERFACES 30
279
280typedef struct
281{
b72b86b4 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;
9c9fd67c 291} WDU_INTERFACE_DESCRIPTOR;
292
293typedef struct
294{
b72b86b4 295 unsigned char bLength;
296 unsigned char bDescriptorType;
297 unsigned char bEndpointAddress;
298 unsigned char bmAttributes;
299 unsigned short wMaxPacketSize;
300 unsigned char bInterval;
9c9fd67c 301} WDU_ENDPOINT_DESCRIPTOR;
302
303typedef struct
304{
b72b86b4 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;
9c9fd67c 313} WDU_CONFIGURATION_DESCRIPTOR;
314
315typedef struct
316{
b72b86b4 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;
324
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;
9c9fd67c 332} WDU_DEVICE_DESCRIPTOR;
333
334typedef struct
335{
336 WDU_INTERFACE_DESCRIPTOR Descriptor;
337 WDU_ENDPOINT_DESCRIPTOR *pEndpointDescriptors;
338 WDU_PIPE_INFO *pPipes;
339} WDU_ALTERNATE_SETTING;
340
341typedef struct
342{
343 WDU_ALTERNATE_SETTING *pAlternateSettings;
b72b86b4 344 unsigned long dwNumAltSettings;
9c9fd67c 345 WDU_ALTERNATE_SETTING *pActiveAltSetting;
346} WDU_INTERFACE;
347
348typedef struct
349{
350 WDU_CONFIGURATION_DESCRIPTOR Descriptor;
b72b86b4 351 unsigned long dwNumInterfaces;
9c9fd67c 352 WDU_INTERFACE *pInterfaces;
353} WDU_CONFIGURATION;
354
e71b6bf3 355struct usb_device_info {
9c9fd67c 356 WDU_DEVICE_DESCRIPTOR Descriptor;
357 WDU_PIPE_INFO Pipe0;
358 WDU_CONFIGURATION *pConfigs;
359 WDU_CONFIGURATION *pActiveConfig;
360 WDU_INTERFACE *pActiveInterface[WD_USB_MAX_INTERFACES];
361};
3be69a94 362
f95f1d2e 363typedef enum {
364 WDU_DIR_IN = 1,
365 WDU_DIR_OUT = 2,
366 WDU_DIR_IN_OUT = 3
367} WDU_DIR;
368
369typedef enum {
370 PIPE_TYPE_CONTROL = 0,
371 PIPE_TYPE_ISOCHRONOUS = 1,
372 PIPE_TYPE_BULK = 2,
373 PIPE_TYPE_INTERRUPT = 3
374} USB_PIPE_TYPE;
Impressum, Datenschutz