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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or_debug_proxy/] [includes/] [ftd2xx.h] - Blame information for rev 290

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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