Rev Author Line No. Line
4530 kaklik 1 /*++
2  
3 Copyright © 2001-2011 Future Technology Devices International Limited
4  
5 THIS SOFTWARE IS PROVIDED BY FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED "AS IS"
6 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
8 FUTURE TECHNOLOGY DEVICES INTERNATIONAL LIMITED BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
10 OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
11 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
12 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
13 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  
15 FTDI DRIVERS MAY BE USED ONLY IN CONJUNCTION WITH PRODUCTS BASED ON FTDI PARTS.
16  
17 FTDI DRIVERS MAY BE DISTRIBUTED IN ANY FORM AS LONG AS LICENSE INFORMATION IS NOT MODIFIED.
18  
19 IF A CUSTOM VENDOR ID AND/OR PRODUCT ID OR DESCRIPTION STRING ARE USED, IT IS THE
20 RESPONSIBILITY OF THE PRODUCT MANUFACTURER TO MAINTAIN ANY CHANGES AND SUBSEQUENT WHQL
21 RE-CERTIFICATION AS A RESULT OF MAKING THESE CHANGES.
22  
23  
24 Module Name:
25  
26 ftd2xx.h
27  
28 Abstract:
29  
30 Native USB device driver for FTDI FT232x, FT245x, FT2232x and FT4232x devices
31 FTD2XX library definitions
32  
33 Environment:
34  
35 kernel & user mode
36  
37  
38 --*/
39  
40  
41 #ifndef FTD2XX_H
42 #define FTD2XX_H
43  
44 #ifdef _WIN32
45 // Compiling on Windows
46 #include <windows.h>
47  
48 // The following ifdef block is the standard way of creating macros
49 // which make exporting from a DLL simpler. All files within this DLL
50 // are compiled with the FTD2XX_EXPORTS symbol defined on the command line.
51 // This symbol should not be defined on any project that uses this DLL.
52 // This way any other project whose source files include this file see
53 // FTD2XX_API functions as being imported from a DLL, whereas this DLL
54 // sees symbols defined with this macro as being exported.
55  
56 #ifdef FTD2XX_EXPORTS
57 #define FTD2XX_API __declspec(dllexport)
58 #elif defined(FTD2XX_STATIC)
59 // Avoid decorations when linking statically to D2XX.
60 #define FTD2XX_API
61 #else
62 #define FTD2XX_API __declspec(dllimport)
63 #endif
64  
65 #else // _WIN32
66 // Compiling on non-Windows platform.
67 #include "WinTypes.h"
68 // No decorations needed.
69 #define FTD2XX_API
70  
71 #endif // _WIN32
72  
73 typedef PVOID FT_HANDLE;
74 typedef ULONG FT_STATUS;
75  
76 //
77 // Device status
78 //
79 enum {
80 FT_OK,
81 FT_INVALID_HANDLE,
82 FT_DEVICE_NOT_FOUND,
83 FT_DEVICE_NOT_OPENED,
84 FT_IO_ERROR,
85 FT_INSUFFICIENT_RESOURCES,
86 FT_INVALID_PARAMETER,
87 FT_INVALID_BAUD_RATE,
88  
89 FT_DEVICE_NOT_OPENED_FOR_ERASE,
90 FT_DEVICE_NOT_OPENED_FOR_WRITE,
91 FT_FAILED_TO_WRITE_DEVICE,
92 FT_EEPROM_READ_FAILED,
93 FT_EEPROM_WRITE_FAILED,
94 FT_EEPROM_ERASE_FAILED,
95 FT_EEPROM_NOT_PRESENT,
96 FT_EEPROM_NOT_PROGRAMMED,
97 FT_INVALID_ARGS,
98 FT_NOT_SUPPORTED,
99 FT_OTHER_ERROR,
100 FT_DEVICE_LIST_NOT_READY,
101 };
102  
103  
104 #define FT_SUCCESS(status) ((status) == FT_OK)
105  
106 //
107 // FT_OpenEx Flags
108 //
109  
110 #define FT_OPEN_BY_SERIAL_NUMBER 1
111 #define FT_OPEN_BY_DESCRIPTION 2
112 #define FT_OPEN_BY_LOCATION 4
113  
114 #define FT_OPEN_MASK (FT_OPEN_BY_SERIAL_NUMBER | \
115 FT_OPEN_BY_DESCRIPTION | \
116 FT_OPEN_BY_LOCATION)
117  
118 //
119 // FT_ListDevices Flags (used in conjunction with FT_OpenEx Flags
120 //
121  
122 #define FT_LIST_NUMBER_ONLY 0x80000000
123 #define FT_LIST_BY_INDEX 0x40000000
124 #define FT_LIST_ALL 0x20000000
125  
126 #define FT_LIST_MASK (FT_LIST_NUMBER_ONLY|FT_LIST_BY_INDEX|FT_LIST_ALL)
127  
128 //
129 // Baud Rates
130 //
131  
132 #define FT_BAUD_300 300
133 #define FT_BAUD_600 600
134 #define FT_BAUD_1200 1200
135 #define FT_BAUD_2400 2400
136 #define FT_BAUD_4800 4800
137 #define FT_BAUD_9600 9600
138 #define FT_BAUD_14400 14400
139 #define FT_BAUD_19200 19200
140 #define FT_BAUD_38400 38400
141 #define FT_BAUD_57600 57600
142 #define FT_BAUD_115200 115200
143 #define FT_BAUD_230400 230400
144 #define FT_BAUD_460800 460800
145 #define FT_BAUD_921600 921600
146  
147 //
148 // Word Lengths
149 //
150  
151 #define FT_BITS_8 (UCHAR) 8
152 #define FT_BITS_7 (UCHAR) 7
153  
154 //
155 // Stop Bits
156 //
157  
158 #define FT_STOP_BITS_1 (UCHAR) 0
159 #define FT_STOP_BITS_2 (UCHAR) 2
160  
161 //
162 // Parity
163 //
164  
165 #define FT_PARITY_NONE (UCHAR) 0
166 #define FT_PARITY_ODD (UCHAR) 1
167 #define FT_PARITY_EVEN (UCHAR) 2
168 #define FT_PARITY_MARK (UCHAR) 3
169 #define FT_PARITY_SPACE (UCHAR) 4
170  
171 //
172 // Flow Control
173 //
174  
175 #define FT_FLOW_NONE 0x0000
176 #define FT_FLOW_RTS_CTS 0x0100
177 #define FT_FLOW_DTR_DSR 0x0200
178 #define FT_FLOW_XON_XOFF 0x0400
179  
180 //
181 // Purge rx and tx buffers
182 //
183 #define FT_PURGE_RX 1
184 #define FT_PURGE_TX 2
185  
186 //
187 // Events
188 //
189  
190 typedef void (*PFT_EVENT_HANDLER)(DWORD,DWORD);
191  
192 #define FT_EVENT_RXCHAR 1
193 #define FT_EVENT_MODEM_STATUS 2
194 #define FT_EVENT_LINE_STATUS 4
195  
196 //
197 // Timeouts
198 //
199  
200 #define FT_DEFAULT_RX_TIMEOUT 300
201 #define FT_DEFAULT_TX_TIMEOUT 300
202  
203 //
204 // Device types
205 //
206  
207 typedef ULONG FT_DEVICE;
208  
209 enum {
210 FT_DEVICE_BM,
211 FT_DEVICE_AM,
212 FT_DEVICE_100AX,
213 FT_DEVICE_UNKNOWN,
214 FT_DEVICE_2232C,
215 FT_DEVICE_232R,
216 FT_DEVICE_2232H,
217 FT_DEVICE_4232H,
218 FT_DEVICE_232H,
219 FT_DEVICE_X_SERIES,
220 FT_DEVICE_4222H_0,
221 FT_DEVICE_4222H_1_2,
222 FT_DEVICE_4222H_3,
223 FT_DEVICE_4222_PROG,
224 };
225  
226 //
227 // Bit Modes
228 //
229  
230 #define FT_BITMODE_RESET 0x00
231 #define FT_BITMODE_ASYNC_BITBANG 0x01
232 #define FT_BITMODE_MPSSE 0x02
233 #define FT_BITMODE_SYNC_BITBANG 0x04
234 #define FT_BITMODE_MCU_HOST 0x08
235 #define FT_BITMODE_FAST_SERIAL 0x10
236 #define FT_BITMODE_CBUS_BITBANG 0x20
237 #define FT_BITMODE_SYNC_FIFO 0x40
238  
239 //
240 // FT232R CBUS Options EEPROM values
241 //
242  
243 #define FT_232R_CBUS_TXDEN 0x00 // Tx Data Enable
244 #define FT_232R_CBUS_PWRON 0x01 // Power On
245 #define FT_232R_CBUS_RXLED 0x02 // Rx LED
246 #define FT_232R_CBUS_TXLED 0x03 // Tx LED
247 #define FT_232R_CBUS_TXRXLED 0x04 // Tx and Rx LED
248 #define FT_232R_CBUS_SLEEP 0x05 // Sleep
249 #define FT_232R_CBUS_CLK48 0x06 // 48MHz clock
250 #define FT_232R_CBUS_CLK24 0x07 // 24MHz clock
251 #define FT_232R_CBUS_CLK12 0x08 // 12MHz clock
252 #define FT_232R_CBUS_CLK6 0x09 // 6MHz clock
253 #define FT_232R_CBUS_IOMODE 0x0A // IO Mode for CBUS bit-bang
254 #define FT_232R_CBUS_BITBANG_WR 0x0B // Bit-bang write strobe
255 #define FT_232R_CBUS_BITBANG_RD 0x0C // Bit-bang read strobe
256  
257 //
258 // FT232H CBUS Options EEPROM values
259 //
260  
261 #define FT_232H_CBUS_TRISTATE 0x00 // Tristate
262 #define FT_232H_CBUS_TXLED 0x01 // Tx LED
263 #define FT_232H_CBUS_RXLED 0x02 // Rx LED
264 #define FT_232H_CBUS_TXRXLED 0x03 // Tx and Rx LED
265 #define FT_232H_CBUS_PWREN 0x04 // Power Enable
266 #define FT_232H_CBUS_SLEEP 0x05 // Sleep
267 #define FT_232H_CBUS_DRIVE_0 0x06 // Drive pin to logic 0
268 #define FT_232H_CBUS_DRIVE_1 0x07 // Drive pin to logic 1
269 #define FT_232H_CBUS_IOMODE 0x08 // IO Mode for CBUS bit-bang
270 #define FT_232H_CBUS_TXDEN 0x09 // Tx Data Enable
271 #define FT_232H_CBUS_CLK30 0x0A // 30MHz clock
272 #define FT_232H_CBUS_CLK15 0x0B // 15MHz clock
273 #define FT_232H_CBUS_CLK7_5 0x0C // 7.5MHz clock
274  
275 //
276 // FT X Series CBUS Options EEPROM values
277 //
278  
279 #define FT_X_SERIES_CBUS_TRISTATE 0x00 // Tristate
280 #define FT_X_SERIES_CBUS_TXLED 0x01 // Tx LED
281 #define FT_X_SERIES_CBUS_RXLED 0x02 // Rx LED
282 #define FT_X_SERIES_CBUS_TXRXLED 0x03 // Tx and Rx LED
283 #define FT_X_SERIES_CBUS_PWREN 0x04 // Power Enable
284 #define FT_X_SERIES_CBUS_SLEEP 0x05 // Sleep
285 #define FT_X_SERIES_CBUS_DRIVE_0 0x06 // Drive pin to logic 0
286 #define FT_X_SERIES_CBUS_DRIVE_1 0x07 // Drive pin to logic 1
287 #define FT_X_SERIES_CBUS_IOMODE 0x08 // IO Mode for CBUS bit-bang
288 #define FT_X_SERIES_CBUS_TXDEN 0x09 // Tx Data Enable
289 #define FT_X_SERIES_CBUS_CLK24 0x0A // 24MHz clock
290 #define FT_X_SERIES_CBUS_CLK12 0x0B // 12MHz clock
291 #define FT_X_SERIES_CBUS_CLK6 0x0C // 6MHz clock
292 #define FT_X_SERIES_CBUS_BCD_CHARGER 0x0D // Battery charger detected
293 #define FT_X_SERIES_CBUS_BCD_CHARGER_N 0x0E // Battery charger detected inverted
294 #define FT_X_SERIES_CBUS_I2C_TXE 0x0F // I2C Tx empty
295 #define FT_X_SERIES_CBUS_I2C_RXF 0x10 // I2C Rx full
296 #define FT_X_SERIES_CBUS_VBUS_SENSE 0x11 // Detect VBUS
297 #define FT_X_SERIES_CBUS_BITBANG_WR 0x12 // Bit-bang write strobe
298 #define FT_X_SERIES_CBUS_BITBANG_RD 0x13 // Bit-bang read strobe
299 #define FT_X_SERIES_CBUS_TIMESTAMP 0x14 // Toggle output when a USB SOF token is received
300 #define FT_X_SERIES_CBUS_KEEP_AWAKE 0x15 //
301  
302  
303 // Driver types
304 #define FT_DRIVER_TYPE_D2XX 0
305 #define FT_DRIVER_TYPE_VCP 1
306  
307  
308  
309 #ifdef __cplusplus
310 extern "C" {
311 #endif
312  
313  
314 FTD2XX_API
315 FT_STATUS WINAPI FT_Open(
316 int deviceNumber,
317 FT_HANDLE *pHandle
318 );
319  
320 FTD2XX_API
321 FT_STATUS WINAPI FT_OpenEx(
322 PVOID pArg1,
323 DWORD Flags,
324 FT_HANDLE *pHandle
325 );
326  
327 FTD2XX_API
328 FT_STATUS WINAPI FT_ListDevices(
329 PVOID pArg1,
330 PVOID pArg2,
331 DWORD Flags
332 );
333  
334 FTD2XX_API
335 FT_STATUS WINAPI FT_Close(
336 FT_HANDLE ftHandle
337 );
338  
339 FTD2XX_API
340 FT_STATUS WINAPI FT_Read(
341 FT_HANDLE ftHandle,
342 LPVOID lpBuffer,
343 DWORD dwBytesToRead,
344 LPDWORD lpBytesReturned
345 );
346  
347 FTD2XX_API
348 FT_STATUS WINAPI FT_Write(
349 FT_HANDLE ftHandle,
350 LPVOID lpBuffer,
351 DWORD dwBytesToWrite,
352 LPDWORD lpBytesWritten
353 );
354  
355 FTD2XX_API
356 FT_STATUS WINAPI FT_IoCtl(
357 FT_HANDLE ftHandle,
358 DWORD dwIoControlCode,
359 LPVOID lpInBuf,
360 DWORD nInBufSize,
361 LPVOID lpOutBuf,
362 DWORD nOutBufSize,
363 LPDWORD lpBytesReturned,
364 LPOVERLAPPED lpOverlapped
365 );
366  
367 FTD2XX_API
368 FT_STATUS WINAPI FT_SetBaudRate(
369 FT_HANDLE ftHandle,
370 ULONG BaudRate
371 );
372  
373 FTD2XX_API
374 FT_STATUS WINAPI FT_SetDivisor(
375 FT_HANDLE ftHandle,
376 USHORT Divisor
377 );
378  
379 FTD2XX_API
380 FT_STATUS WINAPI FT_SetDataCharacteristics(
381 FT_HANDLE ftHandle,
382 UCHAR WordLength,
383 UCHAR StopBits,
384 UCHAR Parity
385 );
386  
387 FTD2XX_API
388 FT_STATUS WINAPI FT_SetFlowControl(
389 FT_HANDLE ftHandle,
390 USHORT FlowControl,
391 UCHAR XonChar,
392 UCHAR XoffChar
393 );
394  
395 FTD2XX_API
396 FT_STATUS WINAPI FT_ResetDevice(
397 FT_HANDLE ftHandle
398 );
399  
400 FTD2XX_API
401 FT_STATUS WINAPI FT_SetDtr(
402 FT_HANDLE ftHandle
403 );
404  
405 FTD2XX_API
406 FT_STATUS WINAPI FT_ClrDtr(
407 FT_HANDLE ftHandle
408 );
409  
410 FTD2XX_API
411 FT_STATUS WINAPI FT_SetRts(
412 FT_HANDLE ftHandle
413 );
414  
415 FTD2XX_API
416 FT_STATUS WINAPI FT_ClrRts(
417 FT_HANDLE ftHandle
418 );
419  
420 FTD2XX_API
421 FT_STATUS WINAPI FT_GetModemStatus(
422 FT_HANDLE ftHandle,
423 ULONG *pModemStatus
424 );
425  
426 FTD2XX_API
427 FT_STATUS WINAPI FT_SetChars(
428 FT_HANDLE ftHandle,
429 UCHAR EventChar,
430 UCHAR EventCharEnabled,
431 UCHAR ErrorChar,
432 UCHAR ErrorCharEnabled
433 );
434  
435 FTD2XX_API
436 FT_STATUS WINAPI FT_Purge(
437 FT_HANDLE ftHandle,
438 ULONG Mask
439 );
440  
441 FTD2XX_API
442 FT_STATUS WINAPI FT_SetTimeouts(
443 FT_HANDLE ftHandle,
444 ULONG ReadTimeout,
445 ULONG WriteTimeout
446 );
447  
448 FTD2XX_API
449 FT_STATUS WINAPI FT_GetQueueStatus(
450 FT_HANDLE ftHandle,
451 DWORD *dwRxBytes
452 );
453  
454 FTD2XX_API
455 FT_STATUS WINAPI FT_SetEventNotification(
456 FT_HANDLE ftHandle,
457 DWORD Mask,
458 PVOID Param
459 );
460  
461 FTD2XX_API
462 FT_STATUS WINAPI FT_GetStatus(
463 FT_HANDLE ftHandle,
464 DWORD *dwRxBytes,
465 DWORD *dwTxBytes,
466 DWORD *dwEventDWord
467 );
468  
469 FTD2XX_API
470 FT_STATUS WINAPI FT_SetBreakOn(
471 FT_HANDLE ftHandle
472 );
473  
474 FTD2XX_API
475 FT_STATUS WINAPI FT_SetBreakOff(
476 FT_HANDLE ftHandle
477 );
478  
479 FTD2XX_API
480 FT_STATUS WINAPI FT_SetWaitMask(
481 FT_HANDLE ftHandle,
482 DWORD Mask
483 );
484  
485 FTD2XX_API
486 FT_STATUS WINAPI FT_WaitOnMask(
487 FT_HANDLE ftHandle,
488 DWORD *Mask
489 );
490  
491 FTD2XX_API
492 FT_STATUS WINAPI FT_GetEventStatus(
493 FT_HANDLE ftHandle,
494 DWORD *dwEventDWord
495 );
496  
497 FTD2XX_API
498 FT_STATUS WINAPI FT_ReadEE(
499 FT_HANDLE ftHandle,
500 DWORD dwWordOffset,
501 LPWORD lpwValue
502 );
503  
504 FTD2XX_API
505 FT_STATUS WINAPI FT_WriteEE(
506 FT_HANDLE ftHandle,
507 DWORD dwWordOffset,
508 WORD wValue
509 );
510  
511 FTD2XX_API
512 FT_STATUS WINAPI FT_EraseEE(
513 FT_HANDLE ftHandle
514 );
515  
516 //
517 // structure to hold program data for FT_EE_Program, FT_EE_ProgramEx, FT_EE_Read
518 // and FT_EE_ReadEx functions
519 //
520 typedef struct ft_program_data {
521  
522 DWORD Signature1; // Header - must be 0x00000000
523 DWORD Signature2; // Header - must be 0xffffffff
524 DWORD Version; // Header - FT_PROGRAM_DATA version
525 // 0 = original
526 // 1 = FT2232 extensions
527 // 2 = FT232R extensions
528 // 3 = FT2232H extensions
529 // 4 = FT4232H extensions
530 // 5 = FT232H extensions
531  
532 WORD VendorId; // 0x0403
533 WORD ProductId; // 0x6001
534 char *Manufacturer; // "FTDI"
535 char *ManufacturerId; // "FT"
536 char *Description; // "USB HS Serial Converter"
537 char *SerialNumber; // "FT000001" if fixed, or NULL
538 WORD MaxPower; // 0 < MaxPower <= 500
539 WORD PnP; // 0 = disabled, 1 = enabled
540 WORD SelfPowered; // 0 = bus powered, 1 = self powered
541 WORD RemoteWakeup; // 0 = not capable, 1 = capable
542 //
543 // Rev4 (FT232B) extensions
544 //
545 UCHAR Rev4; // non-zero if Rev4 chip, zero otherwise
546 UCHAR IsoIn; // non-zero if in endpoint is isochronous
547 UCHAR IsoOut; // non-zero if out endpoint is isochronous
548 UCHAR PullDownEnable; // non-zero if pull down enabled
549 UCHAR SerNumEnable; // non-zero if serial number to be used
550 UCHAR USBVersionEnable; // non-zero if chip uses USBVersion
551 WORD USBVersion; // BCD (0x0200 => USB2)
552 //
553 // Rev 5 (FT2232) extensions
554 //
555 UCHAR Rev5; // non-zero if Rev5 chip, zero otherwise
556 UCHAR IsoInA; // non-zero if in endpoint is isochronous
557 UCHAR IsoInB; // non-zero if in endpoint is isochronous
558 UCHAR IsoOutA; // non-zero if out endpoint is isochronous
559 UCHAR IsoOutB; // non-zero if out endpoint is isochronous
560 UCHAR PullDownEnable5; // non-zero if pull down enabled
561 UCHAR SerNumEnable5; // non-zero if serial number to be used
562 UCHAR USBVersionEnable5; // non-zero if chip uses USBVersion
563 WORD USBVersion5; // BCD (0x0200 => USB2)
564 UCHAR AIsHighCurrent; // non-zero if interface is high current
565 UCHAR BIsHighCurrent; // non-zero if interface is high current
566 UCHAR IFAIsFifo; // non-zero if interface is 245 FIFO
567 UCHAR IFAIsFifoTar; // non-zero if interface is 245 FIFO CPU target
568 UCHAR IFAIsFastSer; // non-zero if interface is Fast serial
569 UCHAR AIsVCP; // non-zero if interface is to use VCP drivers
570 UCHAR IFBIsFifo; // non-zero if interface is 245 FIFO
571 UCHAR IFBIsFifoTar; // non-zero if interface is 245 FIFO CPU target
572 UCHAR IFBIsFastSer; // non-zero if interface is Fast serial
573 UCHAR BIsVCP; // non-zero if interface is to use VCP drivers
574 //
575 // Rev 6 (FT232R) extensions
576 //
577 UCHAR UseExtOsc; // Use External Oscillator
578 UCHAR HighDriveIOs; // High Drive I/Os
579 UCHAR EndpointSize; // Endpoint size
580 UCHAR PullDownEnableR; // non-zero if pull down enabled
581 UCHAR SerNumEnableR; // non-zero if serial number to be used
582 UCHAR InvertTXD; // non-zero if invert TXD
583 UCHAR InvertRXD; // non-zero if invert RXD
584 UCHAR InvertRTS; // non-zero if invert RTS
585 UCHAR InvertCTS; // non-zero if invert CTS
586 UCHAR InvertDTR; // non-zero if invert DTR
587 UCHAR InvertDSR; // non-zero if invert DSR
588 UCHAR InvertDCD; // non-zero if invert DCD
589 UCHAR InvertRI; // non-zero if invert RI
590 UCHAR Cbus0; // Cbus Mux control
591 UCHAR Cbus1; // Cbus Mux control
592 UCHAR Cbus2; // Cbus Mux control
593 UCHAR Cbus3; // Cbus Mux control
594 UCHAR Cbus4; // Cbus Mux control
595 UCHAR RIsD2XX; // non-zero if using D2XX driver
596 //
597 // Rev 7 (FT2232H) Extensions
598 //
599 UCHAR PullDownEnable7; // non-zero if pull down enabled
600 UCHAR SerNumEnable7; // non-zero if serial number to be used
601 UCHAR ALSlowSlew; // non-zero if AL pins have slow slew
602 UCHAR ALSchmittInput; // non-zero if AL pins are Schmitt input
603 UCHAR ALDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
604 UCHAR AHSlowSlew; // non-zero if AH pins have slow slew
605 UCHAR AHSchmittInput; // non-zero if AH pins are Schmitt input
606 UCHAR AHDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
607 UCHAR BLSlowSlew; // non-zero if BL pins have slow slew
608 UCHAR BLSchmittInput; // non-zero if BL pins are Schmitt input
609 UCHAR BLDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
610 UCHAR BHSlowSlew; // non-zero if BH pins have slow slew
611 UCHAR BHSchmittInput; // non-zero if BH pins are Schmitt input
612 UCHAR BHDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
613 UCHAR IFAIsFifo7; // non-zero if interface is 245 FIFO
614 UCHAR IFAIsFifoTar7; // non-zero if interface is 245 FIFO CPU target
615 UCHAR IFAIsFastSer7; // non-zero if interface is Fast serial
616 UCHAR AIsVCP7; // non-zero if interface is to use VCP drivers
617 UCHAR IFBIsFifo7; // non-zero if interface is 245 FIFO
618 UCHAR IFBIsFifoTar7; // non-zero if interface is 245 FIFO CPU target
619 UCHAR IFBIsFastSer7; // non-zero if interface is Fast serial
620 UCHAR BIsVCP7; // non-zero if interface is to use VCP drivers
621 UCHAR PowerSaveEnable; // non-zero if using BCBUS7 to save power for self-powered designs
622 //
623 // Rev 8 (FT4232H) Extensions
624 //
625 UCHAR PullDownEnable8; // non-zero if pull down enabled
626 UCHAR SerNumEnable8; // non-zero if serial number to be used
627 UCHAR ASlowSlew; // non-zero if A pins have slow slew
628 UCHAR ASchmittInput; // non-zero if A pins are Schmitt input
629 UCHAR ADriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
630 UCHAR BSlowSlew; // non-zero if B pins have slow slew
631 UCHAR BSchmittInput; // non-zero if B pins are Schmitt input
632 UCHAR BDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
633 UCHAR CSlowSlew; // non-zero if C pins have slow slew
634 UCHAR CSchmittInput; // non-zero if C pins are Schmitt input
635 UCHAR CDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
636 UCHAR DSlowSlew; // non-zero if D pins have slow slew
637 UCHAR DSchmittInput; // non-zero if D pins are Schmitt input
638 UCHAR DDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
639 UCHAR ARIIsTXDEN; // non-zero if port A uses RI as RS485 TXDEN
640 UCHAR BRIIsTXDEN; // non-zero if port B uses RI as RS485 TXDEN
641 UCHAR CRIIsTXDEN; // non-zero if port C uses RI as RS485 TXDEN
642 UCHAR DRIIsTXDEN; // non-zero if port D uses RI as RS485 TXDEN
643 UCHAR AIsVCP8; // non-zero if interface is to use VCP drivers
644 UCHAR BIsVCP8; // non-zero if interface is to use VCP drivers
645 UCHAR CIsVCP8; // non-zero if interface is to use VCP drivers
646 UCHAR DIsVCP8; // non-zero if interface is to use VCP drivers
647 //
648 // Rev 9 (FT232H) Extensions
649 //
650 UCHAR PullDownEnableH; // non-zero if pull down enabled
651 UCHAR SerNumEnableH; // non-zero if serial number to be used
652 UCHAR ACSlowSlewH; // non-zero if AC pins have slow slew
653 UCHAR ACSchmittInputH; // non-zero if AC pins are Schmitt input
654 UCHAR ACDriveCurrentH; // valid values are 4mA, 8mA, 12mA, 16mA
655 UCHAR ADSlowSlewH; // non-zero if AD pins have slow slew
656 UCHAR ADSchmittInputH; // non-zero if AD pins are Schmitt input
657 UCHAR ADDriveCurrentH; // valid values are 4mA, 8mA, 12mA, 16mA
658 UCHAR Cbus0H; // Cbus Mux control
659 UCHAR Cbus1H; // Cbus Mux control
660 UCHAR Cbus2H; // Cbus Mux control
661 UCHAR Cbus3H; // Cbus Mux control
662 UCHAR Cbus4H; // Cbus Mux control
663 UCHAR Cbus5H; // Cbus Mux control
664 UCHAR Cbus6H; // Cbus Mux control
665 UCHAR Cbus7H; // Cbus Mux control
666 UCHAR Cbus8H; // Cbus Mux control
667 UCHAR Cbus9H; // Cbus Mux control
668 UCHAR IsFifoH; // non-zero if interface is 245 FIFO
669 UCHAR IsFifoTarH; // non-zero if interface is 245 FIFO CPU target
670 UCHAR IsFastSerH; // non-zero if interface is Fast serial
671 UCHAR IsFT1248H; // non-zero if interface is FT1248
672 UCHAR FT1248CpolH; // FT1248 clock polarity - clock idle high (1) or clock idle low (0)
673 UCHAR FT1248LsbH; // FT1248 data is LSB (1) or MSB (0)
674 UCHAR FT1248FlowControlH; // FT1248 flow control enable
675 UCHAR IsVCPH; // non-zero if interface is to use VCP drivers
676 UCHAR PowerSaveEnableH; // non-zero if using ACBUS7 to save power for self-powered designs
677  
678 } FT_PROGRAM_DATA, *PFT_PROGRAM_DATA;
679  
680 FTD2XX_API
681 FT_STATUS WINAPI FT_EE_Program(
682 FT_HANDLE ftHandle,
683 PFT_PROGRAM_DATA pData
684 );
685  
686 FTD2XX_API
687 FT_STATUS WINAPI FT_EE_ProgramEx(
688 FT_HANDLE ftHandle,
689 PFT_PROGRAM_DATA pData,
690 char *Manufacturer,
691 char *ManufacturerId,
692 char *Description,
693 char *SerialNumber
694 );
695  
696 FTD2XX_API
697 FT_STATUS WINAPI FT_EE_Read(
698 FT_HANDLE ftHandle,
699 PFT_PROGRAM_DATA pData
700 );
701  
702 FTD2XX_API
703 FT_STATUS WINAPI FT_EE_ReadEx(
704 FT_HANDLE ftHandle,
705 PFT_PROGRAM_DATA pData,
706 char *Manufacturer,
707 char *ManufacturerId,
708 char *Description,
709 char *SerialNumber
710 );
711  
712 FTD2XX_API
713 FT_STATUS WINAPI FT_EE_UASize(
714 FT_HANDLE ftHandle,
715 LPDWORD lpdwSize
716 );
717  
718 FTD2XX_API
719 FT_STATUS WINAPI FT_EE_UAWrite(
720 FT_HANDLE ftHandle,
721 PUCHAR pucData,
722 DWORD dwDataLen
723 );
724  
725 FTD2XX_API
726 FT_STATUS WINAPI FT_EE_UARead(
727 FT_HANDLE ftHandle,
728 PUCHAR pucData,
729 DWORD dwDataLen,
730 LPDWORD lpdwBytesRead
731 );
732  
733  
734 typedef struct ft_eeprom_header {
735 FT_DEVICE deviceType; // FTxxxx device type to be programmed
736 // Device descriptor options
737 WORD VendorId; // 0x0403
738 WORD ProductId; // 0x6001
739 UCHAR SerNumEnable; // non-zero if serial number to be used
740 // Config descriptor options
741 WORD MaxPower; // 0 < MaxPower <= 500
742 UCHAR SelfPowered; // 0 = bus powered, 1 = self powered
743 UCHAR RemoteWakeup; // 0 = not capable, 1 = capable
744 // Hardware options
745 UCHAR PullDownEnable; // non-zero if pull down in suspend enabled
746 } FT_EEPROM_HEADER, *PFT_EEPROM_HEADER;
747  
748  
749 // FT232B EEPROM structure for use with FT_EEPROM_Read and FT_EEPROM_Program
750 typedef struct ft_eeprom_232b {
751 // Common header
752 FT_EEPROM_HEADER common; // common elements for all device EEPROMs
753 } FT_EEPROM_232B, *PFT_EEPROM_232B;
754  
755  
756 // FT2232 EEPROM structure for use with FT_EEPROM_Read and FT_EEPROM_Program
757 typedef struct ft_eeprom_2232 {
758 // Common header
759 FT_EEPROM_HEADER common; // common elements for all device EEPROMs
760 // Drive options
761 UCHAR AIsHighCurrent; // non-zero if interface is high current
762 UCHAR BIsHighCurrent; // non-zero if interface is high current
763 // Hardware options
764 UCHAR AIsFifo; // non-zero if interface is 245 FIFO
765 UCHAR AIsFifoTar; // non-zero if interface is 245 FIFO CPU target
766 UCHAR AIsFastSer; // non-zero if interface is Fast serial
767 UCHAR BIsFifo; // non-zero if interface is 245 FIFO
768 UCHAR BIsFifoTar; // non-zero if interface is 245 FIFO CPU target
769 UCHAR BIsFastSer; // non-zero if interface is Fast serial
770 // Driver option
771 UCHAR ADriverType; //
772 UCHAR BDriverType; //
773 } FT_EEPROM_2232, *PFT_EEPROM_2232;
774  
775  
776 // FT232R EEPROM structure for use with FT_EEPROM_Read and FT_EEPROM_Program
777 typedef struct ft_eeprom_232r {
778 // Common header
779 FT_EEPROM_HEADER common; // common elements for all device EEPROMs
780 // Drive options
781 UCHAR IsHighCurrent; // non-zero if interface is high current
782 // Hardware options
783 UCHAR UseExtOsc; // Use External Oscillator
784 UCHAR InvertTXD; // non-zero if invert TXD
785 UCHAR InvertRXD; // non-zero if invert RXD
786 UCHAR InvertRTS; // non-zero if invert RTS
787 UCHAR InvertCTS; // non-zero if invert CTS
788 UCHAR InvertDTR; // non-zero if invert DTR
789 UCHAR InvertDSR; // non-zero if invert DSR
790 UCHAR InvertDCD; // non-zero if invert DCD
791 UCHAR InvertRI; // non-zero if invert RI
792 UCHAR Cbus0; // Cbus Mux control
793 UCHAR Cbus1; // Cbus Mux control
794 UCHAR Cbus2; // Cbus Mux control
795 UCHAR Cbus3; // Cbus Mux control
796 UCHAR Cbus4; // Cbus Mux control
797 // Driver option
798 UCHAR DriverType; //
799 } FT_EEPROM_232R, *PFT_EEPROM_232R;
800  
801  
802 // FT2232H EEPROM structure for use with FT_EEPROM_Read and FT_EEPROM_Program
803 typedef struct ft_eeprom_2232h {
804 // Common header
805 FT_EEPROM_HEADER common; // common elements for all device EEPROMs
806 // Drive options
807 UCHAR ALSlowSlew; // non-zero if AL pins have slow slew
808 UCHAR ALSchmittInput; // non-zero if AL pins are Schmitt input
809 UCHAR ALDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
810 UCHAR AHSlowSlew; // non-zero if AH pins have slow slew
811 UCHAR AHSchmittInput; // non-zero if AH pins are Schmitt input
812 UCHAR AHDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
813 UCHAR BLSlowSlew; // non-zero if BL pins have slow slew
814 UCHAR BLSchmittInput; // non-zero if BL pins are Schmitt input
815 UCHAR BLDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
816 UCHAR BHSlowSlew; // non-zero if BH pins have slow slew
817 UCHAR BHSchmittInput; // non-zero if BH pins are Schmitt input
818 UCHAR BHDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
819 // Hardware options
820 UCHAR AIsFifo; // non-zero if interface is 245 FIFO
821 UCHAR AIsFifoTar; // non-zero if interface is 245 FIFO CPU target
822 UCHAR AIsFastSer; // non-zero if interface is Fast serial
823 UCHAR BIsFifo; // non-zero if interface is 245 FIFO
824 UCHAR BIsFifoTar; // non-zero if interface is 245 FIFO CPU target
825 UCHAR BIsFastSer; // non-zero if interface is Fast serial
826 UCHAR PowerSaveEnable; // non-zero if using BCBUS7 to save power for self-powered designs
827 // Driver option
828 UCHAR ADriverType; //
829 UCHAR BDriverType; //
830 } FT_EEPROM_2232H, *PFT_EEPROM_2232H;
831  
832  
833 // FT4232H EEPROM structure for use with FT_EEPROM_Read and FT_EEPROM_Program
834 typedef struct ft_eeprom_4232h {
835 // Common header
836 FT_EEPROM_HEADER common; // common elements for all device EEPROMs
837 // Drive options
838 UCHAR ASlowSlew; // non-zero if A pins have slow slew
839 UCHAR ASchmittInput; // non-zero if A pins are Schmitt input
840 UCHAR ADriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
841 UCHAR BSlowSlew; // non-zero if B pins have slow slew
842 UCHAR BSchmittInput; // non-zero if B pins are Schmitt input
843 UCHAR BDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
844 UCHAR CSlowSlew; // non-zero if C pins have slow slew
845 UCHAR CSchmittInput; // non-zero if C pins are Schmitt input
846 UCHAR CDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
847 UCHAR DSlowSlew; // non-zero if D pins have slow slew
848 UCHAR DSchmittInput; // non-zero if D pins are Schmitt input
849 UCHAR DDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
850 // Hardware options
851 UCHAR ARIIsTXDEN; // non-zero if port A uses RI as RS485 TXDEN
852 UCHAR BRIIsTXDEN; // non-zero if port B uses RI as RS485 TXDEN
853 UCHAR CRIIsTXDEN; // non-zero if port C uses RI as RS485 TXDEN
854 UCHAR DRIIsTXDEN; // non-zero if port D uses RI as RS485 TXDEN
855 // Driver option
856 UCHAR ADriverType; //
857 UCHAR BDriverType; //
858 UCHAR CDriverType; //
859 UCHAR DDriverType; //
860 } FT_EEPROM_4232H, *PFT_EEPROM_4232H;
861  
862  
863 // FT232H EEPROM structure for use with FT_EEPROM_Read and FT_EEPROM_Program
864 typedef struct ft_eeprom_232h {
865 // Common header
866 FT_EEPROM_HEADER common; // common elements for all device EEPROMs
867 // Drive options
868 UCHAR ACSlowSlew; // non-zero if AC bus pins have slow slew
869 UCHAR ACSchmittInput; // non-zero if AC bus pins are Schmitt input
870 UCHAR ACDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
871 UCHAR ADSlowSlew; // non-zero if AD bus pins have slow slew
872 UCHAR ADSchmittInput; // non-zero if AD bus pins are Schmitt input
873 UCHAR ADDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
874 // CBUS options
875 UCHAR Cbus0; // Cbus Mux control
876 UCHAR Cbus1; // Cbus Mux control
877 UCHAR Cbus2; // Cbus Mux control
878 UCHAR Cbus3; // Cbus Mux control
879 UCHAR Cbus4; // Cbus Mux control
880 UCHAR Cbus5; // Cbus Mux control
881 UCHAR Cbus6; // Cbus Mux control
882 UCHAR Cbus7; // Cbus Mux control
883 UCHAR Cbus8; // Cbus Mux control
884 UCHAR Cbus9; // Cbus Mux control
885 // FT1248 options
886 UCHAR FT1248Cpol; // FT1248 clock polarity - clock idle high (1) or clock idle low (0)
887 UCHAR FT1248Lsb; // FT1248 data is LSB (1) or MSB (0)
888 UCHAR FT1248FlowControl; // FT1248 flow control enable
889 // Hardware options
890 UCHAR IsFifo; // non-zero if interface is 245 FIFO
891 UCHAR IsFifoTar; // non-zero if interface is 245 FIFO CPU target
892 UCHAR IsFastSer; // non-zero if interface is Fast serial
893 UCHAR IsFT1248 ; // non-zero if interface is FT1248
894 UCHAR PowerSaveEnable; //
895 // Driver option
896 UCHAR DriverType; //
897 } FT_EEPROM_232H, *PFT_EEPROM_232H;
898  
899  
900 // FT X Series EEPROM structure for use with FT_EEPROM_Read and FT_EEPROM_Program
901 typedef struct ft_eeprom_x_series {
902 // Common header
903 FT_EEPROM_HEADER common; // common elements for all device EEPROMs
904 // Drive options
905 UCHAR ACSlowSlew; // non-zero if AC bus pins have slow slew
906 UCHAR ACSchmittInput; // non-zero if AC bus pins are Schmitt input
907 UCHAR ACDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
908 UCHAR ADSlowSlew; // non-zero if AD bus pins have slow slew
909 UCHAR ADSchmittInput; // non-zero if AD bus pins are Schmitt input
910 UCHAR ADDriveCurrent; // valid values are 4mA, 8mA, 12mA, 16mA
911 // CBUS options
912 UCHAR Cbus0; // Cbus Mux control
913 UCHAR Cbus1; // Cbus Mux control
914 UCHAR Cbus2; // Cbus Mux control
915 UCHAR Cbus3; // Cbus Mux control
916 UCHAR Cbus4; // Cbus Mux control
917 UCHAR Cbus5; // Cbus Mux control
918 UCHAR Cbus6; // Cbus Mux control
919 // UART signal options
920 UCHAR InvertTXD; // non-zero if invert TXD
921 UCHAR InvertRXD; // non-zero if invert RXD
922 UCHAR InvertRTS; // non-zero if invert RTS
923 UCHAR InvertCTS; // non-zero if invert CTS
924 UCHAR InvertDTR; // non-zero if invert DTR
925 UCHAR InvertDSR; // non-zero if invert DSR
926 UCHAR InvertDCD; // non-zero if invert DCD
927 UCHAR InvertRI; // non-zero if invert RI
928 // Battery Charge Detect options
929 UCHAR BCDEnable; // Enable Battery Charger Detection
930 UCHAR BCDForceCbusPWREN; // asserts the power enable signal on CBUS when charging port detected
931 UCHAR BCDDisableSleep; // forces the device never to go into sleep mode
932 // I2C options
933 WORD I2CSlaveAddress; // I2C slave device address
934 DWORD I2CDeviceId; // I2C device ID
935 UCHAR I2CDisableSchmitt; // Disable I2C Schmitt trigger
936 // FT1248 options
937 UCHAR FT1248Cpol; // FT1248 clock polarity - clock idle high (1) or clock idle low (0)
938 UCHAR FT1248Lsb; // FT1248 data is LSB (1) or MSB (0)
939 UCHAR FT1248FlowControl; // FT1248 flow control enable
940 // Hardware options
941 UCHAR RS485EchoSuppress; //
942 UCHAR PowerSaveEnable; //
943 // Driver option
944 UCHAR DriverType; //
945 } FT_EEPROM_X_SERIES, *PFT_EEPROM_X_SERIES;
946  
947  
948 FTD2XX_API
949 FT_STATUS WINAPI FT_EEPROM_Read(
950 FT_HANDLE ftHandle,
951 void *eepromData,
952 DWORD eepromDataSize,
953 char *Manufacturer,
954 char *ManufacturerId,
955 char *Description,
956 char *SerialNumber
957 );
958  
959  
960 FTD2XX_API
961 FT_STATUS WINAPI FT_EEPROM_Program(
962 FT_HANDLE ftHandle,
963 void *eepromData,
964 DWORD eepromDataSize,
965 char *Manufacturer,
966 char *ManufacturerId,
967 char *Description,
968 char *SerialNumber
969 );
970  
971  
972 FTD2XX_API
973 FT_STATUS WINAPI FT_SetLatencyTimer(
974 FT_HANDLE ftHandle,
975 UCHAR ucLatency
976 );
977  
978 FTD2XX_API
979 FT_STATUS WINAPI FT_GetLatencyTimer(
980 FT_HANDLE ftHandle,
981 PUCHAR pucLatency
982 );
983  
984 FTD2XX_API
985 FT_STATUS WINAPI FT_SetBitMode(
986 FT_HANDLE ftHandle,
987 UCHAR ucMask,
988 UCHAR ucEnable
989 );
990  
991 FTD2XX_API
992 FT_STATUS WINAPI FT_GetBitMode(
993 FT_HANDLE ftHandle,
994 PUCHAR pucMode
995 );
996  
997 FTD2XX_API
998 FT_STATUS WINAPI FT_SetUSBParameters(
999 FT_HANDLE ftHandle,
1000 ULONG ulInTransferSize,
1001 ULONG ulOutTransferSize
1002 );
1003  
1004 FTD2XX_API
1005 FT_STATUS WINAPI FT_SetDeadmanTimeout(
1006 FT_HANDLE ftHandle,
1007 ULONG ulDeadmanTimeout
1008 );
1009  
1010 #ifndef _WIN32
1011 // Extra functions for non-Windows platforms to compensate
1012 // for lack of .INF file to specify Vendor and Product IDs.
1013  
1014 FTD2XX_API
1015 FT_STATUS FT_SetVIDPID(
1016 DWORD dwVID,
1017 DWORD dwPID
1018 );
1019  
1020 FTD2XX_API
1021 FT_STATUS FT_GetVIDPID(
1022 DWORD * pdwVID,
1023 DWORD * pdwPID
1024 );
1025  
1026 FTD2XX_API
1027 FT_STATUS WINAPI FT_GetDeviceLocId(
1028 FT_HANDLE ftHandle,
1029 LPDWORD lpdwLocId
1030 );
1031 #endif // _WIN32
1032  
1033 FTD2XX_API
1034 FT_STATUS WINAPI FT_GetDeviceInfo(
1035 FT_HANDLE ftHandle,
1036 FT_DEVICE *lpftDevice,
1037 LPDWORD lpdwID,
1038 PCHAR SerialNumber,
1039 PCHAR Description,
1040 LPVOID Dummy
1041 );
1042  
1043 FTD2XX_API
1044 FT_STATUS WINAPI FT_StopInTask(
1045 FT_HANDLE ftHandle
1046 );
1047  
1048 FTD2XX_API
1049 FT_STATUS WINAPI FT_RestartInTask(
1050 FT_HANDLE ftHandle
1051 );
1052  
1053 FTD2XX_API
1054 FT_STATUS WINAPI FT_SetResetPipeRetryCount(
1055 FT_HANDLE ftHandle,
1056 DWORD dwCount
1057 );
1058  
1059 FTD2XX_API
1060 FT_STATUS WINAPI FT_ResetPort(
1061 FT_HANDLE ftHandle
1062 );
1063  
1064 FTD2XX_API
1065 FT_STATUS WINAPI FT_CyclePort(
1066 FT_HANDLE ftHandle
1067 );
1068  
1069  
1070 //
1071 // Win32-type functions
1072 //
1073  
1074 FTD2XX_API
1075 FT_HANDLE WINAPI FT_W32_CreateFile(
1076 LPCTSTR lpszName,
1077 DWORD dwAccess,
1078 DWORD dwShareMode,
1079 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
1080 DWORD dwCreate,
1081 DWORD dwAttrsAndFlags,
1082 HANDLE hTemplate
1083 );
1084  
1085 FTD2XX_API
1086 BOOL WINAPI FT_W32_CloseHandle(
1087 FT_HANDLE ftHandle
1088 );
1089  
1090 FTD2XX_API
1091 BOOL WINAPI FT_W32_ReadFile(
1092 FT_HANDLE ftHandle,
1093 LPVOID lpBuffer,
1094 DWORD nBufferSize,
1095 LPDWORD lpBytesReturned,
1096 LPOVERLAPPED lpOverlapped
1097 );
1098  
1099 FTD2XX_API
1100 BOOL WINAPI FT_W32_WriteFile(
1101 FT_HANDLE ftHandle,
1102 LPVOID lpBuffer,
1103 DWORD nBufferSize,
1104 LPDWORD lpBytesWritten,
1105 LPOVERLAPPED lpOverlapped
1106 );
1107  
1108 FTD2XX_API
1109 DWORD WINAPI FT_W32_GetLastError(
1110 FT_HANDLE ftHandle
1111 );
1112  
1113 FTD2XX_API
1114 BOOL WINAPI FT_W32_GetOverlappedResult(
1115 FT_HANDLE ftHandle,
1116 LPOVERLAPPED lpOverlapped,
1117 LPDWORD lpdwBytesTransferred,
1118 BOOL bWait
1119 );
1120  
1121 FTD2XX_API
1122 BOOL WINAPI FT_W32_CancelIo(
1123 FT_HANDLE ftHandle
1124 );
1125  
1126  
1127 //
1128 // Win32 COMM API type functions
1129 //
1130 typedef struct _FTCOMSTAT {
1131 DWORD fCtsHold : 1;
1132 DWORD fDsrHold : 1;
1133 DWORD fRlsdHold : 1;
1134 DWORD fXoffHold : 1;
1135 DWORD fXoffSent : 1;
1136 DWORD fEof : 1;
1137 DWORD fTxim : 1;
1138 DWORD fReserved : 25;
1139 DWORD cbInQue;
1140 DWORD cbOutQue;
1141 } FTCOMSTAT, *LPFTCOMSTAT;
1142  
1143 typedef struct _FTDCB {
1144 DWORD DCBlength; /* sizeof(FTDCB) */
1145 DWORD BaudRate; /* Baudrate at which running */
1146 DWORD fBinary: 1; /* Binary Mode (skip EOF check) */
1147 DWORD fParity: 1; /* Enable parity checking */
1148 DWORD fOutxCtsFlow:1; /* CTS handshaking on output */
1149 DWORD fOutxDsrFlow:1; /* DSR handshaking on output */
1150 DWORD fDtrControl:2; /* DTR Flow control */
1151 DWORD fDsrSensitivity:1; /* DSR Sensitivity */
1152 DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
1153 DWORD fOutX: 1; /* Enable output X-ON/X-OFF */
1154 DWORD fInX: 1; /* Enable input X-ON/X-OFF */
1155 DWORD fErrorChar: 1; /* Enable Err Replacement */
1156 DWORD fNull: 1; /* Enable Null stripping */
1157 DWORD fRtsControl:2; /* Rts Flow control */
1158 DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
1159 DWORD fDummy2:17; /* Reserved */
1160 WORD wReserved; /* Not currently used */
1161 WORD XonLim; /* Transmit X-ON threshold */
1162 WORD XoffLim; /* Transmit X-OFF threshold */
1163 BYTE ByteSize; /* Number of bits/byte, 4-8 */
1164 BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */
1165 BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */
1166 char XonChar; /* Tx and Rx X-ON character */
1167 char XoffChar; /* Tx and Rx X-OFF character */
1168 char ErrorChar; /* Error replacement char */
1169 char EofChar; /* End of Input character */
1170 char EvtChar; /* Received Event character */
1171 WORD wReserved1; /* Fill for now. */
1172 } FTDCB, *LPFTDCB;
1173  
1174 typedef struct _FTTIMEOUTS {
1175 DWORD ReadIntervalTimeout; /* Maximum time between read chars. */
1176 DWORD ReadTotalTimeoutMultiplier; /* Multiplier of characters. */
1177 DWORD ReadTotalTimeoutConstant; /* Constant in milliseconds. */
1178 DWORD WriteTotalTimeoutMultiplier; /* Multiplier of characters. */
1179 DWORD WriteTotalTimeoutConstant; /* Constant in milliseconds. */
1180 } FTTIMEOUTS,*LPFTTIMEOUTS;
1181  
1182  
1183 FTD2XX_API
1184 BOOL WINAPI FT_W32_ClearCommBreak(
1185 FT_HANDLE ftHandle
1186 );
1187  
1188 FTD2XX_API
1189 BOOL WINAPI FT_W32_ClearCommError(
1190 FT_HANDLE ftHandle,
1191 LPDWORD lpdwErrors,
1192 LPFTCOMSTAT lpftComstat
1193 );
1194  
1195 FTD2XX_API
1196 BOOL WINAPI FT_W32_EscapeCommFunction(
1197 FT_HANDLE ftHandle,
1198 DWORD dwFunc
1199 );
1200  
1201 FTD2XX_API
1202 BOOL WINAPI FT_W32_GetCommModemStatus(
1203 FT_HANDLE ftHandle,
1204 LPDWORD lpdwModemStatus
1205 );
1206  
1207 FTD2XX_API
1208 BOOL WINAPI FT_W32_GetCommState(
1209 FT_HANDLE ftHandle,
1210 LPFTDCB lpftDcb
1211 );
1212  
1213 FTD2XX_API
1214 BOOL WINAPI FT_W32_GetCommTimeouts(
1215 FT_HANDLE ftHandle,
1216 FTTIMEOUTS *pTimeouts
1217 );
1218  
1219 FTD2XX_API
1220 BOOL WINAPI FT_W32_PurgeComm(
1221 FT_HANDLE ftHandle,
1222 DWORD dwMask
1223 );
1224  
1225 FTD2XX_API
1226 BOOL WINAPI FT_W32_SetCommBreak(
1227 FT_HANDLE ftHandle
1228 );
1229  
1230 FTD2XX_API
1231 BOOL WINAPI FT_W32_SetCommMask(
1232 FT_HANDLE ftHandle,
1233 ULONG ulEventMask
1234 );
1235  
1236 FTD2XX_API
1237 BOOL WINAPI FT_W32_GetCommMask(
1238 FT_HANDLE ftHandle,
1239 LPDWORD lpdwEventMask
1240 );
1241  
1242 FTD2XX_API
1243 BOOL WINAPI FT_W32_SetCommState(
1244 FT_HANDLE ftHandle,
1245 LPFTDCB lpftDcb
1246 );
1247  
1248 FTD2XX_API
1249 BOOL WINAPI FT_W32_SetCommTimeouts(
1250 FT_HANDLE ftHandle,
1251 FTTIMEOUTS *pTimeouts
1252 );
1253  
1254 FTD2XX_API
1255 BOOL WINAPI FT_W32_SetupComm(
1256 FT_HANDLE ftHandle,
1257 DWORD dwReadBufferSize,
1258 DWORD dwWriteBufferSize
1259 );
1260  
1261 FTD2XX_API
1262 BOOL WINAPI FT_W32_WaitCommEvent(
1263 FT_HANDLE ftHandle,
1264 PULONG pulEvent,
1265 LPOVERLAPPED lpOverlapped
1266 );
1267  
1268  
1269 //
1270 // Device information
1271 //
1272  
1273 typedef struct _ft_device_list_info_node {
1274 ULONG Flags;
1275 ULONG Type;
1276 ULONG ID;
1277 DWORD LocId;
1278 char SerialNumber[16];
1279 char Description[64];
1280 FT_HANDLE ftHandle;
1281 } FT_DEVICE_LIST_INFO_NODE;
1282  
1283 // Device information flags
1284 enum {
1285 FT_FLAGS_OPENED = 1,
1286 FT_FLAGS_HISPEED = 2
1287 };
1288  
1289  
1290 FTD2XX_API
1291 FT_STATUS WINAPI FT_CreateDeviceInfoList(
1292 LPDWORD lpdwNumDevs
1293 );
1294  
1295 FTD2XX_API
1296 FT_STATUS WINAPI FT_GetDeviceInfoList(
1297 FT_DEVICE_LIST_INFO_NODE *pDest,
1298 LPDWORD lpdwNumDevs
1299 );
1300  
1301 FTD2XX_API
1302 FT_STATUS WINAPI FT_GetDeviceInfoDetail(
1303 DWORD dwIndex,
1304 LPDWORD lpdwFlags,
1305 LPDWORD lpdwType,
1306 LPDWORD lpdwID,
1307 LPDWORD lpdwLocId,
1308 LPVOID lpSerialNumber,
1309 LPVOID lpDescription,
1310 FT_HANDLE *pftHandle
1311 );
1312  
1313  
1314 //
1315 // Version information
1316 //
1317  
1318 FTD2XX_API
1319 FT_STATUS WINAPI FT_GetDriverVersion(
1320 FT_HANDLE ftHandle,
1321 LPDWORD lpdwVersion
1322 );
1323  
1324 FTD2XX_API
1325 FT_STATUS WINAPI FT_GetLibraryVersion(
1326 LPDWORD lpdwVersion
1327 );
1328  
1329  
1330 FTD2XX_API
1331 FT_STATUS WINAPI FT_Rescan(
1332 void
1333 );
1334  
1335 FTD2XX_API
1336 FT_STATUS WINAPI FT_Reload(
1337 WORD wVid,
1338 WORD wPid
1339 );
1340  
1341 FTD2XX_API
1342 FT_STATUS WINAPI FT_GetComPortNumber(
1343 FT_HANDLE ftHandle,
1344 LPLONG lpdwComPortNumber
1345 );
1346  
1347  
1348 //
1349 // FT232H additional EEPROM functions
1350 //
1351  
1352 FTD2XX_API
1353 FT_STATUS WINAPI FT_EE_ReadConfig(
1354 FT_HANDLE ftHandle,
1355 UCHAR ucAddress,
1356 PUCHAR pucValue
1357 );
1358  
1359 FTD2XX_API
1360 FT_STATUS WINAPI FT_EE_WriteConfig(
1361 FT_HANDLE ftHandle,
1362 UCHAR ucAddress,
1363 UCHAR ucValue
1364 );
1365  
1366 FTD2XX_API
1367 FT_STATUS WINAPI FT_EE_ReadECC(
1368 FT_HANDLE ftHandle,
1369 UCHAR ucOption,
1370 LPWORD lpwValue
1371 );
1372  
1373 FTD2XX_API
1374 FT_STATUS WINAPI FT_GetQueueStatusEx(
1375 FT_HANDLE ftHandle,
1376 DWORD *dwRxBytes
1377 );
1378  
1379 FTD2XX_API
1380 FT_STATUS WINAPI FT_ComPortIdle(
1381 FT_HANDLE ftHandle
1382 );
1383  
1384 FTD2XX_API
1385 FT_STATUS WINAPI FT_ComPortCancelIdle(
1386 FT_HANDLE ftHandle
1387 );
1388  
1389 FTD2XX_API
1390 FT_STATUS WINAPI FT_VendorCmdGet(
1391 FT_HANDLE ftHandle,
1392 UCHAR Request,
1393 UCHAR *Buf,
1394 USHORT Len
1395 );
1396  
1397 FTD2XX_API
1398 FT_STATUS WINAPI FT_VendorCmdSet(
1399 FT_HANDLE ftHandle,
1400 UCHAR Request,
1401 UCHAR *Buf,
1402 USHORT Len
1403 );
1404  
1405 FTD2XX_API
1406 FT_STATUS WINAPI FT_VendorCmdGetEx(
1407 FT_HANDLE ftHandle,
1408 USHORT wValue,
1409 UCHAR *Buf,
1410 USHORT Len
1411 );
1412  
1413 FTD2XX_API
1414 FT_STATUS WINAPI FT_VendorCmdSetEx(
1415 FT_HANDLE ftHandle,
1416 USHORT wValue,
1417 UCHAR *Buf,
1418 USHORT Len
1419 );
1420  
1421 #ifdef __cplusplus
1422 }
1423 #endif
1424  
1425  
1426 #endif /* FTD2XX_H */
1427