]> git.zerfleddert.de Git - usb-driver/blob - usb-driver.h
9ff9cbd51e37360b20f852fcc52fd9015ea85675
[usb-driver] / usb-driver.h
1 #define VERSION 0x910
2 #define LICENSE 0x952
3 #define TRANSFER 0x98c
4 #define USB_TRANSFER 0x983
5 #define EVENT_UNREGISTER 0x987
6 #define INT_DISABLE 0x91f
7 #define INT_WAIT 0x94b
8 #define CARD_REGISTER 0x9a4
9 #define EVENT_REGISTER 0x9a5
10 #define CARD_UNREGISTER 0x92b
11 #define USB_GET_DEVICE_DATA 0x9a7
12 #define INT_ENABLE 0x98e
13 #define EVENT_PULL 0x988
14 #define USB_SET_INTERFACE 0x981
15
16 #define MAGIC 0xa410b413UL
17
18 struct header_struct {
19 unsigned long magic;
20 void* data;
21 unsigned long size;
22 };
23
24 struct version_struct {
25 unsigned long versionul;
26 char version[128];
27 };
28
29 struct license_struct {
30 char cLicense[128]; // Buffer with license string to put.
31 // If empty string then get current license setting
32 // into dwLicense.
33 unsigned long dwLicense; // Returns license settings: LICENSE_DEMO, LICENSE_WD
34 // etc..., or 0 for invalid license.
35 unsigned long dwLicense2; // Returns additional license settings, if dwLicense
36 // could not hold all the information.
37 // Then dwLicense will return 0.
38 };
39
40 typedef struct
41 {
42 unsigned long dwVendorId;
43 unsigned long dwDeviceId;
44 } WD_PCI_ID;
45
46 typedef struct
47 {
48 unsigned long dwBus;
49 unsigned long dwSlot;
50 unsigned long dwFunction;
51 } WD_PCI_SLOT;
52
53 typedef struct
54 {
55 unsigned long dwVendorId;
56 unsigned long dwProductId;
57 } WD_USB_ID;
58
59 typedef struct
60 {
61 unsigned short VendorId;
62 unsigned short ProductId;
63 unsigned char bDeviceClass;
64 unsigned char bDeviceSubClass;
65 unsigned char bInterfaceClass;
66 unsigned char bInterfaceSubClass;
67 unsigned char bInterfaceProtocol;
68 } WDU_MATCH_TABLE;
69
70 typedef struct
71 {
72 unsigned long dwNumber; // Pipe 0 is the default pipe
73 unsigned long dwMaximumPacketSize;
74 unsigned long type; // USB_PIPE_TYPE
75 unsigned long direction; // WDU_DIR
76 // Isochronous, Bulk, Interrupt are either USB_DIR_IN or USB_DIR_OUT
77 // Control are USB_DIR_IN_OUT
78 unsigned long dwInterval; // interval in ms relevant to Interrupt pipes
79 } WD_USB_PIPE_INFO, WD_USB_PIPE_INFO_V43, WDU_PIPE_INFO;
80
81 #define WD_USB_MAX_PIPE_NUMBER 32
82
83 typedef struct
84 {
85 unsigned long dwPipes;
86 WD_USB_PIPE_INFO Pipe[WD_USB_MAX_PIPE_NUMBER];
87 } WD_USB_DEVICE_INFO, WD_USB_DEVICE_INFO_V43;
88
89 struct usb_transfer
90 {
91 unsigned long dwUniqueID;
92 unsigned long dwPipeNum; // Pipe number on device.
93 unsigned long fRead; // TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
94 unsigned long dwOptions; // USB_TRANSFER options:
95 // USB_ISOCH_FULL_PACKETS_ONLY - For isochronous
96 // transfers only. If set, only full packets will be
97 // transmitted and the transfer function will return
98 // when the amount of bytes left to transfer is less
99 // than the maximum packet size for the pipe (the
100 // function will return without transmitting the
101 // remaining bytes).
102 void* pBuffer; // Pointer to buffer to read/write.
103 unsigned long dwBufferSize; // Amount of bytes to transfer.
104 unsigned long dwBytesTransferred; // Returns the number of bytes actually read/written
105 unsigned char SetupPacket[8]; // Setup packet for control pipe transfer.
106 unsigned long dwTimeout; // Timeout for the transfer in milliseconds. Set to 0 for infinite wait.
107 };
108
109
110
111
112 struct event {
113 unsigned long handle;
114 unsigned long dwAction; // WD_EVENT_ACTION
115 unsigned long dwStatus; // EVENT_STATUS
116 unsigned long dwEventId;
117 unsigned long dwCardType; //WD_BUS_PCI, WD_BUS_USB, WD_BUS_PCMCIA
118 unsigned long hKernelPlugIn;
119 unsigned long dwOptions; // WD_EVENT_OPTION
120 union
121 {
122 struct
123 {
124 WD_PCI_ID cardId;
125 WD_PCI_SLOT pciSlot;
126 } Pci;
127 struct
128 {
129 WD_USB_ID deviceId;
130 unsigned long dwUniqueID;
131 } Usb;
132 } u;
133 unsigned long dwEventVer;
134 unsigned long dwNumMatchTables;
135 WDU_MATCH_TABLE matchTables[1];
136 };
137
138 typedef struct
139 {
140 unsigned long dwBusType; // Bus Type: ISA, EISA, PCI, PCMCIA.
141 unsigned long dwBusNum; // Bus number.
142 unsigned long dwSlotFunc; // Slot number on Bus.
143 } WD_BUS, WD_BUS_V30;
144
145 typedef struct
146 {
147 unsigned long item; // ITEM_TYPE
148 unsigned long fNotSharable;
149 unsigned long dwReserved; // Reserved for internal use
150 unsigned long dwOptions; // WD_ITEM_OPTIONS
151 union
152 {
153 struct
154 { // ITEM_MEMORY
155 unsigned long dwPhysicalAddr; // Physical address on card.
156 unsigned long dwBytes; // Address range.
157 void* dwTransAddr; // Returns the address to pass on to transfer commands.
158 void* dwUserDirectAddr; // Returns the address for direct user read/write.
159 unsigned long dwCpuPhysicalAddr; // Returns the CPU physical address
160 unsigned long dwBar; // Base Address Register number of PCI card.
161 } Mem;
162 struct
163 { // ITEM_IO
164 void* dwAddr; // Beginning of io address.
165 unsigned long dwBytes; // IO range.
166 unsigned long dwBar; // Base Address Register number of PCI card.
167 } IO;
168 struct
169 { // ITEM_INTERRUPT
170 unsigned long dwInterrupt; // Number of interrupt to install.
171 unsigned long dwOptions; // Interrupt options. For level sensitive
172 // interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
173 unsigned long hInterrupt; // Returns the handle of the interrupt installed.
174 } Int;
175 WD_BUS Bus; // ITEM_BUS
176 struct
177 {
178 unsigned long dw1, dw2, dw3, dw4; // Reserved for internal use
179 void* dw5; // Reserved for internal use
180 } Val;
181 } I;
182 } WD_ITEMS, WD_ITEMS_V30;
183
184 #define WD_CARD_ITEMS 20
185
186 typedef struct
187 {
188 unsigned long dwItems;
189 WD_ITEMS Item[WD_CARD_ITEMS];
190 } WD_CARD, WD_CARD_V30;
191
192 enum { CARD_VX_NO_MMU_INIT = 0x4000000 };
193
194 struct card_register
195 {
196 WD_CARD Card; // Card to register.
197 unsigned long fCheckLockOnly; // Only check if card is lockable, return hCard=1 if OK.
198 unsigned long hCard; // Handle of card.
199 unsigned long dwOptions; // Should be zero.
200 char cName[32]; // Name of card.
201 char cDescription[100]; // Description.
202 };
Impressum, Datenschutz