OpenCores
URL https://opencores.org/ocsvn/ft2232hcore/ft2232hcore/trunk

Subversion Repositories ft2232hcore

[/] [ft2232hcore/] [trunk/] [pc_test_app/] [ftd2xx.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wes314
/*++
2
 
3
Copyright (c) 2001-2007  Future Technology Devices International Ltd.
4
 
5
Module Name:
6
 
7
    ftd2xx.h
8
 
9
Abstract:
10
 
11
    Native USB device driver for FTDI FT8U232/245
12
    FTD2XX library definitions
13
 
14
Environment:
15
 
16
    kernel & user mode
17
 
18
Revision History:
19
 
20
    13/03/01    awm     Created.
21
        13/01/03        awm             Added device information support.
22
        19/03/03        awm             Added FT_W32_CancelIo.
23
        12/06/03        awm             Added FT_StopInTask and FT_RestartInTask.
24
        18/09/03        awm             Added FT_SetResetPipeRetryCount.
25
        10/10/03        awm             Added FT_ResetPort.
26
        23/01/04        awm             Added support for open-by-location.
27
        16/03/04        awm             Added support for FT2232C.
28
        23/09/04        awm             Added support for FT232R.
29
        20/10/04        awm             Added FT_CyclePort.
30
        18/01/05        awm             Added FT_DEVICE_LIST_INFO_NODE type.
31
        11/02/05        awm             Added LocId to FT_DEVICE_LIST_INFO_NODE.
32
        25/08/05        awm             Added FT_SetDeadmanTimeout.
33
        02/12/05        awm             Removed obsolete references.
34
        05/12/05        awm             Added FT_GetVersion, FT_GetVersionEx.
35
        08/09/06        awm             Added FT_W32_GetCommMask.
36
        11/09/06        awm             Added FT_Rescan.
37
        11/07/07        awm             Added support for FT2232H and FT4232H.
38
        10/08/07        awm             Added flags definitions.
39
        21/11/07        mja             Added FT_GetComPortNumber.
40
        05/06/08        mja             Added EEPROM extensions for FT2232H.
41
 
42
 
43
--*/
44
 
45
 
46
#ifndef FTD2XX_H
47
#define FTD2XX_H
48
 
49
// The following ifdef block is the standard way of creating macros
50
// which make exporting from a DLL simpler.  All files within this DLL
51
// are compiled with the FTD2XX_EXPORTS symbol defined on the command line.
52
// This symbol should not be defined on any project that uses this DLL.
53
// This way any other project whose source files include this file see
54
// FTD2XX_API functions as being imported from a DLL, whereas this DLL
55
// sees symbols defined with this macro as being exported.
56
 
57
#ifdef FTD2XX_EXPORTS
58
#define FTD2XX_API __declspec(dllexport)
59
#else
60
#define FTD2XX_API __declspec(dllimport)
61
#endif
62
 
63
 
64
typedef PVOID   FT_HANDLE;
65
typedef ULONG   FT_STATUS;
66
 
67
//
68
// Device status
69
//
70
enum {
71
    FT_OK,
72
    FT_INVALID_HANDLE,
73
    FT_DEVICE_NOT_FOUND,
74
    FT_DEVICE_NOT_OPENED,
75
    FT_IO_ERROR,
76
    FT_INSUFFICIENT_RESOURCES,
77
    FT_INVALID_PARAMETER,
78
    FT_INVALID_BAUD_RATE,
79
 
80
    FT_DEVICE_NOT_OPENED_FOR_ERASE,
81
    FT_DEVICE_NOT_OPENED_FOR_WRITE,
82
    FT_FAILED_TO_WRITE_DEVICE,
83
    FT_EEPROM_READ_FAILED,
84
    FT_EEPROM_WRITE_FAILED,
85
    FT_EEPROM_ERASE_FAILED,
86
        FT_EEPROM_NOT_PRESENT,
87
        FT_EEPROM_NOT_PROGRAMMED,
88
        FT_INVALID_ARGS,
89
        FT_NOT_SUPPORTED,
90
        FT_OTHER_ERROR,
91
        FT_DEVICE_LIST_NOT_READY,
92
};
93
 
94
 
95
#define FT_SUCCESS(status) ((status) == FT_OK)
96
 
97
//
98
// FT_OpenEx Flags
99
//
100
 
101
#define FT_OPEN_BY_SERIAL_NUMBER    1
102
#define FT_OPEN_BY_DESCRIPTION      2
103
#define FT_OPEN_BY_LOCATION                     4
104
 
105
//
106
// FT_ListDevices Flags (used in conjunction with FT_OpenEx Flags
107
//
108
 
109
#define FT_LIST_NUMBER_ONLY                     0x80000000
110
#define FT_LIST_BY_INDEX                        0x40000000
111
#define FT_LIST_ALL                                     0x20000000
112
 
113
#define FT_LIST_MASK (FT_LIST_NUMBER_ONLY|FT_LIST_BY_INDEX|FT_LIST_ALL)
114
 
115
//
116
// Baud Rates
117
//
118
 
119
#define FT_BAUD_300                     300
120
#define FT_BAUD_600                     600
121
#define FT_BAUD_1200            1200
122
#define FT_BAUD_2400            2400
123
#define FT_BAUD_4800            4800
124
#define FT_BAUD_9600            9600
125
#define FT_BAUD_14400           14400
126
#define FT_BAUD_19200           19200
127
#define FT_BAUD_38400           38400
128
#define FT_BAUD_57600           57600
129
#define FT_BAUD_115200          115200
130
#define FT_BAUD_230400          230400
131
#define FT_BAUD_460800          460800
132
#define FT_BAUD_921600          921600
133
 
134
//
135
// Word Lengths
136
//
137
 
138
#define FT_BITS_8                       (UCHAR) 8
139
#define FT_BITS_7                       (UCHAR) 7
140
#define FT_BITS_6                       (UCHAR) 6
141
#define FT_BITS_5                       (UCHAR) 5
142
 
143
//
144
// Stop Bits
145
//
146
 
147
#define FT_STOP_BITS_1          (UCHAR) 0
148
#define FT_STOP_BITS_1_5        (UCHAR) 1
149
#define FT_STOP_BITS_2          (UCHAR) 2
150
 
151
//
152
// Parity
153
//
154
 
155
#define FT_PARITY_NONE          (UCHAR) 0
156
#define FT_PARITY_ODD           (UCHAR) 1
157
#define FT_PARITY_EVEN          (UCHAR) 2
158
#define FT_PARITY_MARK          (UCHAR) 3
159
#define FT_PARITY_SPACE         (UCHAR) 4
160
 
161
//
162
// Flow Control
163
//
164
 
165
#define FT_FLOW_NONE        0x0000
166
#define FT_FLOW_RTS_CTS     0x0100
167
#define FT_FLOW_DTR_DSR     0x0200
168
#define FT_FLOW_XON_XOFF    0x0400
169
 
170
//
171
// Purge rx and tx buffers
172
//
173
#define FT_PURGE_RX         1
174
#define FT_PURGE_TX         2
175
 
176
//
177
// Events
178
//
179
 
180
typedef void (*PFT_EVENT_HANDLER)(DWORD,DWORD);
181
 
182
#define FT_EVENT_RXCHAR             1
183
#define FT_EVENT_MODEM_STATUS   2
184
#define FT_EVENT_LINE_STATUS   4
185
 
186
//
187
// Timeouts
188
//
189
 
190
#define FT_DEFAULT_RX_TIMEOUT   300
191
#define FT_DEFAULT_TX_TIMEOUT   300
192
 
193
//
194
// Device types
195
//
196
 
197
typedef ULONG   FT_DEVICE;
198
 
199
enum {
200
    FT_DEVICE_BM,
201
    FT_DEVICE_AM,
202
    FT_DEVICE_100AX,
203
    FT_DEVICE_UNKNOWN,
204
    FT_DEVICE_2232C,
205
    FT_DEVICE_232R,
206
        FT_DEVICE_2232H,
207
        FT_DEVICE_4232H
208
};
209
 
210
 
211
#ifdef __cplusplus
212
extern "C" {
213
#endif
214
 
215
 
216
FTD2XX_API
217
FT_STATUS WINAPI FT_Open(
218
        int deviceNumber,
219
        FT_HANDLE *pHandle
220
        );
221
 
222
FTD2XX_API
223
FT_STATUS WINAPI FT_OpenEx(
224
    PVOID pArg1,
225
    DWORD Flags,
226
    FT_HANDLE *pHandle
227
    );
228
 
229
FTD2XX_API
230
FT_STATUS WINAPI FT_ListDevices(
231
        PVOID pArg1,
232
        PVOID pArg2,
233
        DWORD Flags
234
        );
235
 
236
FTD2XX_API
237
FT_STATUS WINAPI FT_Close(
238
    FT_HANDLE ftHandle
239
    );
240
 
241
FTD2XX_API
242
FT_STATUS WINAPI FT_Read(
243
    FT_HANDLE ftHandle,
244
    LPVOID lpBuffer,
245
    DWORD dwBytesToRead,
246
    LPDWORD lpBytesReturned
247
    );
248
 
249
FTD2XX_API
250
FT_STATUS WINAPI FT_Write(
251
    FT_HANDLE ftHandle,
252
    LPVOID lpBuffer,
253
    DWORD dwBytesToWrite,
254
    LPDWORD lpBytesWritten
255
    );
256
 
257
FTD2XX_API
258
FT_STATUS WINAPI FT_IoCtl(
259
    FT_HANDLE ftHandle,
260
    DWORD dwIoControlCode,
261
    LPVOID lpInBuf,
262
    DWORD nInBufSize,
263
    LPVOID lpOutBuf,
264
    DWORD nOutBufSize,
265
    LPDWORD lpBytesReturned,
266
    LPOVERLAPPED lpOverlapped
267
    );
268
 
269
FTD2XX_API
270
FT_STATUS WINAPI FT_SetBaudRate(
271
    FT_HANDLE ftHandle,
272
        ULONG BaudRate
273
        );
274
 
275
FTD2XX_API
276
FT_STATUS WINAPI FT_SetDivisor(
277
    FT_HANDLE ftHandle,
278
        USHORT Divisor
279
        );
280
 
281
FTD2XX_API
282
FT_STATUS WINAPI FT_SetDataCharacteristics(
283
    FT_HANDLE ftHandle,
284
        UCHAR WordLength,
285
        UCHAR StopBits,
286
        UCHAR Parity
287
        );
288
 
289
FTD2XX_API
290
FT_STATUS WINAPI FT_SetFlowControl(
291
    FT_HANDLE ftHandle,
292
    USHORT FlowControl,
293
    UCHAR XonChar,
294
    UCHAR XoffChar
295
        );
296
 
297
FTD2XX_API
298
FT_STATUS WINAPI FT_ResetDevice(
299
    FT_HANDLE ftHandle
300
        );
301
 
302
FTD2XX_API
303
FT_STATUS WINAPI FT_SetDtr(
304
    FT_HANDLE ftHandle
305
        );
306
 
307
FTD2XX_API
308
FT_STATUS WINAPI FT_ClrDtr(
309
    FT_HANDLE ftHandle
310
        );
311
 
312
FTD2XX_API
313
FT_STATUS WINAPI FT_SetRts(
314
    FT_HANDLE ftHandle
315
        );
316
 
317
FTD2XX_API
318
FT_STATUS WINAPI FT_ClrRts(
319
    FT_HANDLE ftHandle
320
        );
321
 
322
FTD2XX_API
323
FT_STATUS WINAPI FT_GetModemStatus(
324
    FT_HANDLE ftHandle,
325
        ULONG *pModemStatus
326
        );
327
 
328
FTD2XX_API
329
FT_STATUS WINAPI FT_SetChars(
330
    FT_HANDLE ftHandle,
331
        UCHAR EventChar,
332
        UCHAR EventCharEnabled,
333
        UCHAR ErrorChar,
334
        UCHAR ErrorCharEnabled
335
    );
336
 
337
FTD2XX_API
338
FT_STATUS WINAPI FT_Purge(
339
    FT_HANDLE ftHandle,
340
        ULONG Mask
341
        );
342
 
343
FTD2XX_API
344
FT_STATUS WINAPI FT_SetTimeouts(
345
    FT_HANDLE ftHandle,
346
        ULONG ReadTimeout,
347
        ULONG WriteTimeout
348
        );
349
 
350
FTD2XX_API
351
FT_STATUS WINAPI FT_GetQueueStatus(
352
    FT_HANDLE ftHandle,
353
        DWORD *dwRxBytes
354
        );
355
 
356
FTD2XX_API
357
FT_STATUS WINAPI FT_SetEventNotification(
358
    FT_HANDLE ftHandle,
359
        DWORD Mask,
360
        PVOID Param
361
        );
362
 
363
FTD2XX_API
364
FT_STATUS WINAPI FT_GetStatus(
365
    FT_HANDLE ftHandle,
366
    DWORD *dwRxBytes,
367
    DWORD *dwTxBytes,
368
    DWORD *dwEventDWord
369
        );
370
 
371
FTD2XX_API
372
FT_STATUS WINAPI FT_SetBreakOn(
373
    FT_HANDLE ftHandle
374
    );
375
 
376
FTD2XX_API
377
FT_STATUS WINAPI FT_SetBreakOff(
378
    FT_HANDLE ftHandle
379
    );
380
 
381
FTD2XX_API
382
FT_STATUS WINAPI FT_SetWaitMask(
383
    FT_HANDLE ftHandle,
384
    DWORD Mask
385
    );
386
 
387
FTD2XX_API
388
FT_STATUS WINAPI FT_WaitOnMask(
389
    FT_HANDLE ftHandle,
390
    DWORD *Mask
391
    );
392
 
393
FTD2XX_API
394
FT_STATUS WINAPI FT_GetEventStatus(
395
    FT_HANDLE ftHandle,
396
    DWORD *dwEventDWord
397
    );
398
 
399
FTD2XX_API
400
FT_STATUS WINAPI FT_ReadEE(
401
    FT_HANDLE ftHandle,
402
        DWORD dwWordOffset,
403
    LPWORD lpwValue
404
        );
405
 
406
FTD2XX_API
407
FT_STATUS WINAPI FT_WriteEE(
408
    FT_HANDLE ftHandle,
409
        DWORD dwWordOffset,
410
    WORD wValue
411
        );
412
 
413
FTD2XX_API
414
FT_STATUS WINAPI FT_EraseEE(
415
    FT_HANDLE ftHandle
416
        );
417
 
418
//
419
// structure to hold program data for FT_Program function
420
//
421
typedef struct ft_program_data {
422
 
423
        DWORD Signature1;                       // Header - must be 0x00000000 
424
        DWORD Signature2;                       // Header - must be 0xffffffff
425
        DWORD Version;                          // Header - FT_PROGRAM_DATA version
426
                                                                //          0 = original
427
                                    //          1 = FT2232C extensions
428
                                                                //                      2 = FT232R extensions
429
                                                                //                      3 = FT2232H extensions
430
                                                                //                      4 = FT4232H extensions
431
 
432
        WORD VendorId;                          // 0x0403
433
        WORD ProductId;                         // 0x6001
434
        char *Manufacturer;                     // "FTDI"
435
        char *ManufacturerId;           // "FT"
436
        char *Description;                      // "USB HS Serial Converter"
437
        char *SerialNumber;                     // "FT000001" if fixed, or NULL
438
        WORD MaxPower;                          // 0 < MaxPower <= 500
439
        WORD PnP;                                       // 0 = disabled, 1 = enabled
440
        WORD SelfPowered;                       // 0 = bus powered, 1 = self powered
441
        WORD RemoteWakeup;                      // 0 = not capable, 1 = capable
442
        //
443
        // Rev4 (FT232B) extensions
444
        //
445
        UCHAR Rev4;                                     // non-zero if Rev4 chip, zero otherwise
446
        UCHAR IsoIn;                            // non-zero if in endpoint is isochronous
447
        UCHAR IsoOut;                           // non-zero if out endpoint is isochronous
448
        UCHAR PullDownEnable;           // non-zero if pull down enabled
449
        UCHAR SerNumEnable;                     // non-zero if serial number to be used
450
        UCHAR USBVersionEnable;         // non-zero if chip uses USBVersion
451
        WORD USBVersion;                        // BCD (0x0200 => USB2)
452
        //
453
        // Rev 5 (FT2232) extensions
454
        //
455
        UCHAR Rev5;                                     // non-zero if Rev5 chip, zero otherwise
456
        UCHAR IsoInA;                           // non-zero if in endpoint is isochronous
457
        UCHAR IsoInB;                           // non-zero if in endpoint is isochronous
458
        UCHAR IsoOutA;                          // non-zero if out endpoint is isochronous
459
        UCHAR IsoOutB;                          // non-zero if out endpoint is isochronous
460
        UCHAR PullDownEnable5;          // non-zero if pull down enabled
461
        UCHAR SerNumEnable5;            // non-zero if serial number to be used
462
        UCHAR USBVersionEnable5;        // non-zero if chip uses USBVersion
463
        WORD USBVersion5;                       // BCD (0x0200 => USB2)
464
        UCHAR AIsHighCurrent;           // non-zero if interface is high current
465
        UCHAR BIsHighCurrent;           // non-zero if interface is high current
466
        UCHAR IFAIsFifo;                        // non-zero if interface is 245 FIFO
467
        UCHAR IFAIsFifoTar;                     // non-zero if interface is 245 FIFO CPU target
468
        UCHAR IFAIsFastSer;                     // non-zero if interface is Fast serial
469
        UCHAR AIsVCP;                           // non-zero if interface is to use VCP drivers
470
        UCHAR IFBIsFifo;                        // non-zero if interface is 245 FIFO
471
        UCHAR IFBIsFifoTar;                     // non-zero if interface is 245 FIFO CPU target
472
        UCHAR IFBIsFastSer;                     // non-zero if interface is Fast serial
473
        UCHAR BIsVCP;                           // non-zero if interface is to use VCP drivers
474
        //
475
        // Rev 6 (FT232R) extensions
476
        //
477
        UCHAR UseExtOsc;                        // Use External Oscillator
478
        UCHAR HighDriveIOs;                     // High Drive I/Os
479
        UCHAR EndpointSize;                     // Endpoint size
480
        UCHAR PullDownEnableR;          // non-zero if pull down enabled
481
        UCHAR SerNumEnableR;            // non-zero if serial number to be used
482
        UCHAR InvertTXD;                        // non-zero if invert TXD
483
        UCHAR InvertRXD;                        // non-zero if invert RXD
484
        UCHAR InvertRTS;                        // non-zero if invert RTS
485
        UCHAR InvertCTS;                        // non-zero if invert CTS
486
        UCHAR InvertDTR;                        // non-zero if invert DTR
487
        UCHAR InvertDSR;                        // non-zero if invert DSR
488
        UCHAR InvertDCD;                        // non-zero if invert DCD
489
        UCHAR InvertRI;                         // non-zero if invert RI
490
        UCHAR Cbus0;                            // Cbus Mux control
491
        UCHAR Cbus1;                            // Cbus Mux control
492
        UCHAR Cbus2;                            // Cbus Mux control
493
        UCHAR Cbus3;                            // Cbus Mux control
494
        UCHAR Cbus4;                            // Cbus Mux control
495
        UCHAR RIsD2XX;                          // non-zero if using D2XX driver
496
        //
497
        // Rev 7 (FT2232H) Extensions
498
        //
499
        UCHAR PullDownEnable7;          // non-zero if pull down enabled
500
        UCHAR SerNumEnable7;            // non-zero if serial number to be used
501
        UCHAR ALSlowSlew;                       // non-zero if AL pins have slow slew
502
        UCHAR ALSchmittInput;           // non-zero if AL pins are Schmitt input
503
        UCHAR ALDriveCurrent;           // valid values are 4mA, 8mA, 12mA, 16mA
504
        UCHAR AHSlowSlew;                       // non-zero if AH pins have slow slew
505
        UCHAR AHSchmittInput;           // non-zero if AH pins are Schmitt input
506
        UCHAR AHDriveCurrent;           // valid values are 4mA, 8mA, 12mA, 16mA
507
        UCHAR BLSlowSlew;                       // non-zero if BL pins have slow slew
508
        UCHAR BLSchmittInput;           // non-zero if BL pins are Schmitt input
509
        UCHAR BLDriveCurrent;           // valid values are 4mA, 8mA, 12mA, 16mA
510
        UCHAR BHSlowSlew;                       // non-zero if BH pins have slow slew
511
        UCHAR BHSchmittInput;           // non-zero if BH pins are Schmitt input
512
        UCHAR BHDriveCurrent;           // valid values are 4mA, 8mA, 12mA, 16mA
513
        UCHAR IFAIsFifo7;                       // non-zero if interface is 245 FIFO
514
        UCHAR IFAIsFifoTar7;            // non-zero if interface is 245 FIFO CPU target
515
        UCHAR IFAIsFastSer7;            // non-zero if interface is Fast serial
516
        UCHAR AIsVCP7;                          // non-zero if interface is to use VCP drivers
517
        UCHAR IFBIsFifo7;                       // non-zero if interface is 245 FIFO
518
        UCHAR IFBIsFifoTar7;            // non-zero if interface is 245 FIFO CPU target
519
        UCHAR IFBIsFastSer7;            // non-zero if interface is Fast serial
520
        UCHAR BIsVCP7;                          // non-zero if interface is to use VCP drivers
521
        UCHAR PowerSaveEnable;          // non-zero if using BCBUS7 to save power for self-powered designs
522
        //
523
        // Rev 8 (FT4232H) Extensions
524
        //
525
        UCHAR PullDownEnable8;          // non-zero if pull down enabled
526
        UCHAR SerNumEnable8;            // non-zero if serial number to be used
527
        UCHAR ASlowSlew;                        // non-zero if AL pins have slow slew
528
        UCHAR ASchmittInput;            // non-zero if AL pins are Schmitt input
529
        UCHAR ADriveCurrent;            // valid values are 4mA, 8mA, 12mA, 16mA
530
        UCHAR BSlowSlew;                        // non-zero if AH pins have slow slew
531
        UCHAR BSchmittInput;            // non-zero if AH pins are Schmitt input
532
        UCHAR BDriveCurrent;            // valid values are 4mA, 8mA, 12mA, 16mA
533
        UCHAR CSlowSlew;                        // non-zero if BL pins have slow slew
534
        UCHAR CSchmittInput;            // non-zero if BL pins are Schmitt input
535
        UCHAR CDriveCurrent;            // valid values are 4mA, 8mA, 12mA, 16mA
536
        UCHAR DSlowSlew;                        // non-zero if BH pins have slow slew
537
        UCHAR DSchmittInput;            // non-zero if BH pins are Schmitt input
538
        UCHAR DDriveCurrent;            // valid values are 4mA, 8mA, 12mA, 16mA
539
        UCHAR ARIIsTXDEN;                       // non-zero if port A uses RI as RS485 TXDEN
540
        UCHAR BRIIsTXDEN;                       // non-zero if port B uses RI as RS485 TXDEN
541
        UCHAR CRIIsTXDEN;                       // non-zero if port C uses RI as RS485 TXDEN
542
        UCHAR DRIIsTXDEN;                       // non-zero if port D uses RI as RS485 TXDEN
543
        UCHAR AIsVCP8;                          // non-zero if interface is to use VCP drivers
544
        UCHAR BIsVCP8;                          // non-zero if interface is to use VCP drivers
545
        UCHAR CIsVCP8;                          // non-zero if interface is to use VCP drivers
546
        UCHAR DIsVCP8;                          // non-zero if interface is to use VCP drivers
547
 
548
} FT_PROGRAM_DATA, *PFT_PROGRAM_DATA;
549
 
550
FTD2XX_API
551
FT_STATUS WINAPI FT_EE_Program(
552
    FT_HANDLE ftHandle,
553
        PFT_PROGRAM_DATA pData
554
        );
555
 
556
FTD2XX_API
557
FT_STATUS WINAPI FT_EE_ProgramEx(
558
    FT_HANDLE ftHandle,
559
        PFT_PROGRAM_DATA pData,
560
        char *Manufacturer,
561
        char *ManufacturerId,
562
        char *Description,
563
        char *SerialNumber
564
        );
565
 
566
FTD2XX_API
567
FT_STATUS WINAPI FT_EE_Read(
568
    FT_HANDLE ftHandle,
569
        PFT_PROGRAM_DATA pData
570
        );
571
 
572
FTD2XX_API
573
FT_STATUS WINAPI FT_EE_ReadEx(
574
    FT_HANDLE ftHandle,
575
        PFT_PROGRAM_DATA pData,
576
        char *Manufacturer,
577
        char *ManufacturerId,
578
        char *Description,
579
        char *SerialNumber
580
        );
581
 
582
FTD2XX_API
583
FT_STATUS WINAPI FT_EE_UASize(
584
    FT_HANDLE ftHandle,
585
        LPDWORD lpdwSize
586
        );
587
 
588
FTD2XX_API
589
FT_STATUS WINAPI FT_EE_UAWrite(
590
    FT_HANDLE ftHandle,
591
        PUCHAR pucData,
592
        DWORD dwDataLen
593
        );
594
 
595
FTD2XX_API
596
FT_STATUS WINAPI FT_EE_UARead(
597
    FT_HANDLE ftHandle,
598
        PUCHAR pucData,
599
        DWORD dwDataLen,
600
        LPDWORD lpdwBytesRead
601
        );
602
 
603
FTD2XX_API
604
FT_STATUS WINAPI FT_SetLatencyTimer(
605
    FT_HANDLE ftHandle,
606
    UCHAR ucLatency
607
    );
608
 
609
FTD2XX_API
610
FT_STATUS WINAPI FT_GetLatencyTimer(
611
    FT_HANDLE ftHandle,
612
    PUCHAR pucLatency
613
    );
614
 
615
FTD2XX_API
616
FT_STATUS WINAPI FT_SetBitMode(
617
    FT_HANDLE ftHandle,
618
    UCHAR ucMask,
619
        UCHAR ucEnable
620
    );
621
 
622
FTD2XX_API
623
FT_STATUS WINAPI FT_GetBitMode(
624
    FT_HANDLE ftHandle,
625
    PUCHAR pucMode
626
    );
627
 
628
FTD2XX_API
629
FT_STATUS WINAPI FT_SetUSBParameters(
630
    FT_HANDLE ftHandle,
631
    ULONG ulInTransferSize,
632
    ULONG ulOutTransferSize
633
        );
634
 
635
FTD2XX_API
636
FT_STATUS WINAPI FT_SetDeadmanTimeout(
637
    FT_HANDLE ftHandle,
638
        ULONG ulDeadmanTimeout
639
    );
640
 
641
FTD2XX_API
642
FT_STATUS WINAPI FT_GetDeviceInfo(
643
    FT_HANDLE ftHandle,
644
    FT_DEVICE *lpftDevice,
645
        LPDWORD lpdwID,
646
        PCHAR SerialNumber,
647
        PCHAR Description,
648
        LPVOID Dummy
649
    );
650
 
651
FTD2XX_API
652
FT_STATUS WINAPI FT_StopInTask(
653
    FT_HANDLE ftHandle
654
    );
655
 
656
FTD2XX_API
657
FT_STATUS WINAPI FT_RestartInTask(
658
    FT_HANDLE ftHandle
659
    );
660
 
661
FTD2XX_API
662
FT_STATUS WINAPI FT_SetResetPipeRetryCount(
663
    FT_HANDLE ftHandle,
664
        DWORD dwCount
665
    );
666
 
667
FTD2XX_API
668
FT_STATUS WINAPI FT_ResetPort(
669
    FT_HANDLE ftHandle
670
    );
671
 
672
FTD2XX_API
673
FT_STATUS WINAPI FT_CyclePort(
674
    FT_HANDLE ftHandle
675
    );
676
 
677
 
678
//
679
// Win32-type functions
680
//
681
 
682
FTD2XX_API
683
FT_HANDLE WINAPI FT_W32_CreateFile(
684
        LPCTSTR                                 lpszName,
685
        DWORD                                   dwAccess,
686
        DWORD                                   dwShareMode,
687
        LPSECURITY_ATTRIBUTES   lpSecurityAttributes,
688
        DWORD                                   dwCreate,
689
        DWORD                                   dwAttrsAndFlags,
690
        HANDLE                                  hTemplate
691
        );
692
 
693
FTD2XX_API
694
BOOL WINAPI FT_W32_CloseHandle(
695
    FT_HANDLE ftHandle
696
        );
697
 
698
FTD2XX_API
699
BOOL WINAPI FT_W32_ReadFile(
700
    FT_HANDLE ftHandle,
701
    LPVOID lpBuffer,
702
    DWORD nBufferSize,
703
    LPDWORD lpBytesReturned,
704
        LPOVERLAPPED lpOverlapped
705
    );
706
 
707
FTD2XX_API
708
BOOL WINAPI FT_W32_WriteFile(
709
    FT_HANDLE ftHandle,
710
    LPVOID lpBuffer,
711
    DWORD nBufferSize,
712
    LPDWORD lpBytesWritten,
713
        LPOVERLAPPED lpOverlapped
714
    );
715
 
716
FTD2XX_API
717
DWORD WINAPI FT_W32_GetLastError(
718
    FT_HANDLE ftHandle
719
    );
720
 
721
FTD2XX_API
722
BOOL WINAPI FT_W32_GetOverlappedResult(
723
    FT_HANDLE ftHandle,
724
        LPOVERLAPPED lpOverlapped,
725
    LPDWORD lpdwBytesTransferred,
726
        BOOL bWait
727
    );
728
 
729
FTD2XX_API
730
BOOL WINAPI FT_W32_CancelIo(
731
    FT_HANDLE ftHandle
732
    );
733
 
734
 
735
//
736
// Win32 COMM API type functions
737
//
738
typedef struct _FTCOMSTAT {
739
    DWORD fCtsHold : 1;
740
    DWORD fDsrHold : 1;
741
    DWORD fRlsdHold : 1;
742
    DWORD fXoffHold : 1;
743
    DWORD fXoffSent : 1;
744
    DWORD fEof : 1;
745
    DWORD fTxim : 1;
746
    DWORD fReserved : 25;
747
    DWORD cbInQue;
748
    DWORD cbOutQue;
749
} FTCOMSTAT, *LPFTCOMSTAT;
750
 
751
typedef struct _FTDCB {
752
    DWORD DCBlength;      /* sizeof(FTDCB)                   */
753
    DWORD BaudRate;       /* Baudrate at which running       */
754
    DWORD fBinary: 1;     /* Binary Mode (skip EOF check)    */
755
    DWORD fParity: 1;     /* Enable parity checking          */
756
    DWORD fOutxCtsFlow:1; /* CTS handshaking on output       */
757
    DWORD fOutxDsrFlow:1; /* DSR handshaking on output       */
758
    DWORD fDtrControl:2;  /* DTR Flow control                */
759
    DWORD fDsrSensitivity:1; /* DSR Sensitivity              */
760
    DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
761
    DWORD fOutX: 1;       /* Enable output X-ON/X-OFF        */
762
    DWORD fInX: 1;        /* Enable input X-ON/X-OFF         */
763
    DWORD fErrorChar: 1;  /* Enable Err Replacement          */
764
    DWORD fNull: 1;       /* Enable Null stripping           */
765
    DWORD fRtsControl:2;  /* Rts Flow control                */
766
    DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
767
    DWORD fDummy2:17;     /* Reserved                        */
768
    WORD wReserved;       /* Not currently used              */
769
    WORD XonLim;          /* Transmit X-ON threshold         */
770
    WORD XoffLim;         /* Transmit X-OFF threshold        */
771
    BYTE ByteSize;        /* Number of bits/byte, 4-8        */
772
    BYTE Parity;          /* 0-4=None,Odd,Even,Mark,Space    */
773
    BYTE StopBits;        /* 0,1,2 = 1, 1.5, 2               */
774
    char XonChar;         /* Tx and Rx X-ON character        */
775
    char XoffChar;        /* Tx and Rx X-OFF character       */
776
    char ErrorChar;       /* Error replacement char          */
777
    char EofChar;         /* End of Input character          */
778
    char EvtChar;         /* Received Event character        */
779
    WORD wReserved1;      /* Fill for now.                   */
780
} FTDCB, *LPFTDCB;
781
 
782
typedef struct _FTTIMEOUTS {
783
    DWORD ReadIntervalTimeout;          /* Maximum time between read chars. */
784
    DWORD ReadTotalTimeoutMultiplier;   /* Multiplier of characters.        */
785
    DWORD ReadTotalTimeoutConstant;     /* Constant in milliseconds.        */
786
    DWORD WriteTotalTimeoutMultiplier;  /* Multiplier of characters.        */
787
    DWORD WriteTotalTimeoutConstant;    /* Constant in milliseconds.        */
788
} FTTIMEOUTS,*LPFTTIMEOUTS;
789
 
790
 
791
FTD2XX_API
792
BOOL WINAPI FT_W32_ClearCommBreak(
793
    FT_HANDLE ftHandle
794
        );
795
 
796
FTD2XX_API
797
BOOL WINAPI FT_W32_ClearCommError(
798
    FT_HANDLE ftHandle,
799
        LPDWORD lpdwErrors,
800
    LPFTCOMSTAT lpftComstat
801
        );
802
 
803
FTD2XX_API
804
BOOL WINAPI FT_W32_EscapeCommFunction(
805
    FT_HANDLE ftHandle,
806
        DWORD dwFunc
807
        );
808
 
809
FTD2XX_API
810
BOOL WINAPI FT_W32_GetCommModemStatus(
811
    FT_HANDLE ftHandle,
812
        LPDWORD lpdwModemStatus
813
        );
814
 
815
FTD2XX_API
816
BOOL WINAPI FT_W32_GetCommState(
817
    FT_HANDLE ftHandle,
818
    LPFTDCB lpftDcb
819
        );
820
 
821
FTD2XX_API
822
BOOL WINAPI FT_W32_GetCommTimeouts(
823
    FT_HANDLE ftHandle,
824
    FTTIMEOUTS *pTimeouts
825
        );
826
 
827
FTD2XX_API
828
BOOL WINAPI FT_W32_PurgeComm(
829
    FT_HANDLE ftHandle,
830
        DWORD dwMask
831
        );
832
 
833
FTD2XX_API
834
BOOL WINAPI FT_W32_SetCommBreak(
835
    FT_HANDLE ftHandle
836
        );
837
 
838
FTD2XX_API
839
BOOL WINAPI FT_W32_SetCommMask(
840
    FT_HANDLE ftHandle,
841
    ULONG ulEventMask
842
    );
843
 
844
FTD2XX_API
845
BOOL WINAPI FT_W32_GetCommMask(
846
    FT_HANDLE ftHandle,
847
    LPDWORD lpdwEventMask
848
    );
849
 
850
FTD2XX_API
851
BOOL WINAPI FT_W32_SetCommState(
852
    FT_HANDLE ftHandle,
853
    LPFTDCB lpftDcb
854
        );
855
 
856
FTD2XX_API
857
BOOL WINAPI FT_W32_SetCommTimeouts(
858
    FT_HANDLE ftHandle,
859
    FTTIMEOUTS *pTimeouts
860
        );
861
 
862
FTD2XX_API
863
BOOL WINAPI FT_W32_SetupComm(
864
    FT_HANDLE ftHandle,
865
        DWORD dwReadBufferSize,
866
        DWORD dwWriteBufferSize
867
        );
868
 
869
FTD2XX_API
870
BOOL WINAPI FT_W32_WaitCommEvent(
871
    FT_HANDLE ftHandle,
872
    PULONG pulEvent,
873
        LPOVERLAPPED lpOverlapped
874
    );
875
 
876
 
877
//
878
// Device information
879
//
880
 
881
typedef struct _ft_device_list_info_node {
882
        ULONG Flags;
883
    ULONG Type;
884
        ULONG ID;
885
        DWORD LocId;
886
        char SerialNumber[16];
887
        char Description[64];
888
        FT_HANDLE ftHandle;
889
} FT_DEVICE_LIST_INFO_NODE;
890
 
891
// Device information flags
892
enum {
893
        FT_FLAGS_OPENED = 1,
894
        FT_FLAGS_HISPEED = 2
895
};
896
 
897
 
898
FTD2XX_API
899
FT_STATUS WINAPI FT_CreateDeviceInfoList(
900
        LPDWORD lpdwNumDevs
901
        );
902
 
903
FTD2XX_API
904
FT_STATUS WINAPI FT_GetDeviceInfoList(
905
        FT_DEVICE_LIST_INFO_NODE *pDest,
906
        LPDWORD lpdwNumDevs
907
        );
908
 
909
FTD2XX_API
910
FT_STATUS WINAPI FT_GetDeviceInfoDetail(
911
        DWORD dwIndex,
912
        LPDWORD lpdwFlags,
913
        LPDWORD lpdwType,
914
        LPDWORD lpdwID,
915
        LPDWORD lpdwLocId,
916
        LPVOID lpSerialNumber,
917
        LPVOID lpDescription,
918
        FT_HANDLE *pftHandle
919
        );
920
 
921
 
922
//
923
// Version information
924
//
925
 
926
FTD2XX_API
927
FT_STATUS WINAPI FT_GetDriverVersion(
928
    FT_HANDLE ftHandle,
929
        LPDWORD lpdwVersion
930
        );
931
 
932
FTD2XX_API
933
FT_STATUS WINAPI FT_GetLibraryVersion(
934
        LPDWORD lpdwVersion
935
        );
936
 
937
 
938
FTD2XX_API
939
FT_STATUS WINAPI FT_Rescan(
940
        void
941
        );
942
 
943
FTD2XX_API
944
FT_STATUS WINAPI FT_Reload(
945
        WORD wVid,
946
        WORD wPid
947
        );
948
 
949
FTD2XX_API
950
FT_STATUS WINAPI FT_GetComPortNumber(
951
    FT_HANDLE ftHandle,
952
        LPLONG  lpdwComPortNumber
953
        );
954
 
955
 
956
 
957
#ifdef __cplusplus
958
}
959
#endif
960
 
961
 
962
#endif  /* FTD2XX_H */
963
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.