Wrapper for FTDI's D2XX DLL

For issues with communication ports, protocols, etc.
fdrn
Posts: 3
Joined: Jan 18, 2010 10:35
Location: UK

Wrapper for FTDI's D2XX DLL

Postby fdrn » Jan 18, 2010 20:48

I've been doing a wrapper for FTDI's D2XX DLL which lets you access more of the features of their USB chips. The FTDI driver is here - http://www.ftdichip.com/Drivers/D2XX.htm

The lib file generated ok from the dlltool after a bit of manual editing of the def file (shown below).

Code: Select all

LIBRARY ftd2xx.dll
EXPORTS
FT_Close@4
FT_ClrDtr@4
FT_ClrRts@4
FT_CreateDeviceInfoList@4
FT_CyclePort@4
FT_EE_Program@8
FT_EE_ProgramEx@24
FT_EE_Read@8
FT_EE_ReadEx@24
FT_EE_UARead@16
FT_EE_UASize@8
FT_EE_UAWrite@12
FT_EraseEE@4
FT_GetBitMode@8
FT_GetComPortNumber@8
FT_GetDeviceInfo@24
FT_GetDeviceInfoDetail@32
FT_GetDeviceInfoList@8
FT_GetDriverVersion@8
FT_GetEventStatus@8
FT_GetLatencyTimer@8
FT_GetLibraryVersion@4
FT_GetModemStatus@8
FT_GetQueueStatus@8
FT_GetStatus@16
FT_IoCtl@32
FT_ListDevices@12
FT_Open@8
FT_OpenEx@12
FT_Purge@8
FT_Read@16
FT_ReadEE@12
FT_Reload@8
FT_Rescan@0
FT_ResetDevice@4
FT_ResetPort@4
FT_RestartInTask@4
FT_SetBaudRate@8
FT_SetBitMode@12
FT_SetBreakOff@4
FT_SetBreakOn@4
FT_SetChars@20
FT_SetDataCharacteristics@16
FT_SetDeadmanTimeout@8
FT_SetDivisor@8
FT_SetDtr@4
FT_SetEventNotification@12
FT_SetFlowControl@16
FT_SetLatencyTimer@8
FT_SetResetPipeRetryCount@8
FT_SetRts@4
FT_SetTimeouts@12
FT_SetUSBParameters@12
FT_SetWaitMask@8
FT_StopInTask@4
FT_W32_CancelIo@4
FT_W32_ClearCommBreak@4
FT_W32_ClearCommError@12
FT_W32_CloseHandle@4
FT_W32_CreateFile@28
FT_W32_EscapeCommFunction@8
FT_W32_GetCommMask@8
FT_W32_GetCommModemStatus@8
FT_W32_GetCommState@8
FT_W32_GetCommTimeouts@8
FT_W32_GetLastError@4
FT_W32_GetOverlappedResult@16
FT_W32_PurgeComm@8
FT_W32_ReadFile@20
FT_W32_SetCommBreak@4
FT_W32_SetCommMask@8
FT_W32_SetCommState@8
FT_W32_SetCommTimeouts@8
FT_W32_SetupComm@12
FT_W32_WaitCommEvent@12
FT_W32_WriteFile@20
FT_WaitOnMask@8
FT_Write@16
FT_WriteEE@12


The header file took a bit more time as I did it as a cut and paste job and my knowledge of Freebasic and DLL's is quite recent. I'm hesitating to post it though as its over 300 lines long. Would anyone want to look over it? Is it appropriate to post code that long on the forum?

I also tried using swig today in an attempt to generate the header file automatically after finding the following post - http://www.freebasic.net/forum/viewtopic.php?t=313

I used this interface file to try and generate the .bi file from ftd2xx.h

Code: Select all

%module FTD2XX
%include FTD2XX.h

It did generate some enum and type definitions but no function declarations. Does swig need the c code as well as the ftd2xx.h file? Or would it be a problem with swig trying to parse something generated with Microsoft c?

I've got a working test program using my current lib and header files but I'd still like someone to have a look at the header file if anyone's willing?

Frank
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Jan 23, 2010 7:31

Sure, post it up. Long code is no problem; if it's approaching a couple thousand lines, it may be better to zip it up and post a link. ~300 lines isn't too much though, no worries.
fdrn
Posts: 3
Joined: Jan 18, 2010 10:35
Location: UK

Postby fdrn » Jan 26, 2010 11:31

Thanks cha0s. Here's the header file then -

Code: Select all

''
'' FTDI.bi
''
#inclib "ftd2xx"

Type FT_HANDLE As UInteger

Type FT_DEVICE_LIST_INFO_NODE
   Flags As UInteger
   DevType As UInteger
   DevID As UInteger
   LocId As UInteger
   SerialNumber As ZString*16
   Description As ZString*64
   ftHandle As FT_HANDLE
End Type

Type FT_PROGRAM_DATA_STRUCTURE
   Signature1 As UInteger   'Header - must be 0x00000000
   Signature2 As UInteger   'Header - must be 0xffffffff
   Version As UInteger      'Header - FT_PROGRAM_DATA version
                        '0 = original
                        '1 = FT2232 extensions
                        '2 = FT232R extensions
                        '3 = FT2232H extensions
                        '4 = FT4232H extensions
   VendorId As UShort   '0x0403
   ProductId As UShort   '0x6001
   Manufacturer As ZString Ptr   '"FTDI"
   ManufacturerId As ZString Ptr'"FT"
   Description As ZString Ptr   '"USB HS Serial Converter"
   SerialNumber As ZString Ptr   '"FT000001" if fixed, or NULL
   MaxPower As UShort         '0 < MaxPower <= 500
   PnP As UShort               '0 = disabled, 1 = enabled
   SelfPowered As UShort      '0 = bus powered, 1 = self powered
   RemoteWakeup As UShort      '0 = not capable, 1 = capable
   'Rev4 (FT232B) extensions
   Rev4 As UByte               'non-zero if Rev4 chip, zero otherwise
   IsoIn As UByte               'non-zero if in endpoint is isochronous
   IsoOut As UByte            'non-zero if out endpoint is isochronous
   PullDownEnable As UByte      'non-zero if pull down enabled
   SerNumEnable As UByte      'non-zero if serial number to be used
   USBVersionEnable As UByte   'non-zero if chip uses USBVersion
   USBVersion As UShort         'BCD (0x0200 => USB2)
   'Rev 5 (FT2232) extensions
   Rev5 As UByte               'non-zero if Rev5 chip, zero otherwise
   IsoInA As UByte            'not implemented – set to 0
   IsoInB As UByte            'not implemented – set to 0
   IsoOutA As UByte            'not implemented – set to 0
   IsoOutB As UByte            'not implemented – set to 0
   PullDownEnable5 As UByte   'non-zero if pull down enabled
   SerNumEnable5 As UByte      'non-zero if serial number to be used
   USBVersionEnable5 As UShort'non-zero if chip uses USBVersion
   USBVersion5 As UByte         'BCD (0x0200 => USB2)
   AIsHighCurrent As UByte      'non-zero if interface is high current
   BIsHighCurrent As UByte      'non-zero if interface is high current
   IFAIsFifo As UByte         'non-zero if interface is 245 FIFO
   IFAIsFifoTar As UByte      'non-zero if interface is 245 FIFO CPU target
   IFAIsFastSer As UByte      'non-zero if interface is Fast serial
   AIsVCP As UByte            'non-zero if interface is to use VCP drivers
   IFBIsFifo As UByte         'non-zero if interface is 245 FIFO
   IFBIsFifoTar As UByte      'non-zero if interface is 245 FIFO CPU target
   IFBIsFastSer As UByte      'non-zero if interface is Fast serial
   BIsVCP As UByte            'non-zero if interface is to use VCP drivers
   'Rev 6 (FT232R) extensions
   UseExtOsc As UByte         'Use External Oscillator
   HighDriveIOs As UByte      'High Drive I/Os
   EndpointSize As UByte      'Endpoint size – this should always be 64
   PullDownEnableR As UByte   'non-zero if pull down enabled
   SerNumEnableR As UByte      'non-zero if serial number to be used
   InvertTXD As UByte         'non-zero if invert TXD
   InvertRXD As UByte         'non-zero if invert RXD
   InvertRTS As UByte         'non-zero if invert RTS
   InvertCTS As UByte         'non-zero if invert CTS
   InvertDTR As UByte         'non-zero if invert DTR
   InvertDSR As UByte         'non-zero if invert DSR
   InvertDCD As UByte         'non-zero if invert DCD
   InvertRI As UByte            'non-zero if invert RI
   Cbus0 As UByte               'Cbus Mux control
   Cbus1 As UByte               'Cbus Mux control
   Cbus2 As UByte               'Cbus Mux control
   Cbus3 As UByte               'Cbus Mux control
   Cbus4 As UByte               'Cbus Mux control
   RIsD2XX As UByte            'non-zero if using D2XX driver
   'Rev 7 (FT2232H) Extensions
   PullDownEnable7 As UByte   'non-zero if pull down enabled
   SerNumEnable7 As UByte      'non-zero if serial number to be used
   ALSlowSlew As UByte         'non-zero if AL pins have slow slew
   ALSchmittInput As UByte      'non-zero if AL pins are Schmitt input
   ALDriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   AHSlowSlew As UByte         'non-zero if AH pins have slow slew
   AHSchmittInput As UByte      'non-zero if AH pins are Schmitt input
   AHDriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   BLSlowSlew As UByte         'non-zero if BL pins have slow slew
   BLSchmittInput As UByte      'non-zero if BL pins are Schmitt input
   BLDriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   BHSlowSlew As UByte         'non-zero if BH pins have slow slew
   BHSchmittInput As UByte      'non-zero if BH pins are Schmitt input
   BHDriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   IFAIsFifo7 As UByte         'non-zero if interface is 245 FIFO
   IFAIsFifoTar7 As UByte      'non-zero if interface is 245 FIFO CPU target
   IFAIsFastSer7 As UByte      'non-zero if interface is Fast serial
   AIsVCP7 As UByte            'non-zero if interface is to use VCP drivers
   IFBIsFifo7 As UByte         'non-zero if interface is 245 FIFO
   IFBIsFifoTar7 As UByte      'non-zero if interface is 245 FIFO CPU target
   IFBIsFastSer7 As UByte      'non-zero if interface is Fast serial
   BIsVCP7 As UByte            'non-zero if interface is to use VCP drivers
   PowerSaveEnable As UByte   'non-zero if using BCBUS7 to save power for self-powered designs
   'Rev 8 (FT4232H) Extensions
   PullDownEnable8 As UByte   'non-zero if pull down enabled
   SerNumEnable8 As UByte      'non-zero if serial number to be used
   ASlowSlew As UByte         'non-zero if AL pins have slow slew
   ASchmittInput As UByte      'non-zero if AL pins are Schmitt input
   ADriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   BSlowSlew As UByte         'non-zero if AH pins have slow slew
   BSchmittInput As UByte      'non-zero if AH pins are Schmitt input
   BDriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   CSlowSlew As UByte         'non-zero if BL pins have slow slew
   CSchmittInput As UByte      'non-zero if BL pins are Schmitt input
   CDriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   DSlowSlew As UByte         'non-zero if BH pins have slow slew
   DSchmittInput As UByte      'non-zero if BH pins are Schmitt input
   DDriveCurrent As UByte      'valid values are 4mA, 8mA, 12mA, 16mA
   ARIIsTXDEN As UByte         'non-zero if port A uses RI as RS485 TXDEN
   BRIIsTXDEN As UByte         'non-zero if port B uses RI as RS485 TXDEN
   CRIIsTXDEN As UByte         'non-zero if port C uses RI as RS485 TXDEN
   DRIIsTXDEN As UByte         'non-zero if port D uses RI as RS485 TXDEN
   AIsVCP8 As UByte            'non-zero if interface is to use VCP drivers
   BIsVCP8 As UByte            'non-zero if interface is to use VCP drivers
   CIsVCP8 As UByte            'non-zero if interface is to use VCP drivers
   DIsVCP8 As UByte            'non-zero if interface is to use VCP drivers
End Type

Enum FT_Status_Flags
   FT_OK = 0
   FT_INVALID_HANDLE = 1
   FT_DEVICE_NOT_FOUND = 2
   FT_DEVICE_NOT_OPENED = 3
   FT_IO_ERROR = 4
   FT_INSUFFICIENT_RESOURCES = 5
   FT_INVALID_PARAMETER = 6
   FT_INVALID_BAUD_RATE = 7
   FT_DEVICE_NOT_OPENED_FOR_ERASE = 8
   FT_DEVICE_NOT_OPENED_FOR_WRITE = 9
   FT_FAILED_TO_WRITE_DEVICE = 10
   FT_EEPROM_READ_FAILED = 11
   FT_EEPROM_WRITE_FAILED = 12
   FT_EEPROM_ERASE_FAILED = 13
   FT_EEPROM_NOT_PRESENT = 14
   FT_EEPROM_NOT_PROGRAMMED = 15
   FT_INVALID_ARGS = 16
   FT_NOT_SUPPORTED = 17
   FT_OTHER_ERROR = 18
End Enum

Enum FT_ListDevices_Flags
   FT_LIST_ALL = &h20000000
   FT_LIST_BY_INDEX = &h40000000
   FT_LIST_NUMBER_ONLY = &h80000000
End Enum

Enum FT_OpenEx_Flags
   FT_OPEN_BY_SERIAL_NUMBER = 1
   FT_OPEN_BY_DESCRIPTION = 2
   FT_OPEN_BY_LOCATION = 4
End Enum

Enum FT_Device_Flags
   FT_DEVICE_232BM = 0
   FT_DEVICE_232AM = 1
   FT_DEVICE_100AX = 2
   FT_DEVICE_UNKNOWN = 3
   FT_DEVICE_2232C = 4
   FT_DEVICE_232R = 5
   FT_DEVICE_2232H = 6
   FT_DEVICE_4232H = 7
End Enum

Enum FT_WordLength
   FT_BITS_7 = 7
   FT_BITS_8 = 8
End Enum

Enum FT_StopBits
   FT_STOP_BITS_1 = 0
   FT_STOP_BITS_2 = 2
End Enum

Enum FT_Parity
   FT_PARITY_NONE = 0
   FT_PARITY_ODD = 1
   FT_PARITY_EVEN = 2
   FT_PARITY_MARK = 3
   FT_PARITY_SPACE = 4
End Enum

Enum FT_FlowControl
   FT_FLOW_NONE = &h0000
   FT_FLOW_RTS_CTS = &h0100
   FT_FLOW_DTR_DSR = &h0200
   FT_FLOW_XON_XOFF = &h0400
End Enum

Enum FT_Purge_Flags
   FT_PURGE_RX = 1
   FT_PURGE_TX = 2
End Enum

Enum FT_NotificationEvent
   FT_EVENT_RXCHAR = 1
   FT_EVENT_MODEM_STATUS = 2
   FT_EVENT_LINE_STATUS = 4
End Enum

Enum FT_ModemStatus
   CTS = &h10
   DSR = &h20
   RI = &h40
   DCD = &h80
End Enum

Enum FT_LineStatus
   OE = &h02
   PE = &h04
   FE = &h08
   BI = &h10
End Enum

Enum FT_BitModes
   FT_Reset = &h00
   AsynchronousBitBang = &h01
   MPSSE = &h02
   SynchronousBitBang = &h04
   MCUHostBusEmulation = &h08
   FastOptoIsolatedSerialMode = &h10
   CBUSBitBang = &h20
   SingleChannelSynchronous245FIFOMode = &h40
End Enum

Enum FT_CBUSOptions
   CBUS_TXDEN = &h00
   CBUS_PWRON = &h01
   CBUS_RXLED = &h02
   CBUS_TXLED = &h03
   CBUS_TXRXLED = &h04
   CBUS_SLEEP = &h05
   CBUS_CLK48 = &h06
   CBUS_CLK24 = &h07
   CBUS_CLK12 = &h08
   CBUS_CLK6 = &h09
   CBUS_IOMODE = &h0A
   CBUS_BITBANG_WR = &h0B
   CBUS_BITBANG_RD = &h0C
End Enum

'Communication functions
Declare Function FT_Close Alias "FT_Close" (Byval As FT_HANDLE) As Integer
Declare Function FT_ClrDtr Alias "FT_ClrDtr" (Byval As FT_HANDLE) As Integer
Declare Function FT_ClrRts Alias "FT_ClrRts" (Byval As FT_HANDLE) As Integer
Declare Function FT_CreateDeviceInfoList Alias "FT_CreateDeviceInfoList" (ByVal As UInteger Ptr) As Integer
Declare Function FT_CyclePort Alias "FT_CyclePort" (Byval As FT_HANDLE) As Integer
Declare Function FT_GetBitMode Alias "FT_GetBitMode" (Byval As FT_HANDLE,Byval As UByte Ptr) As Integer
Declare Function FT_GetComPortNumber Alias "FT_GetComPortNumber" (Byval As FT_HANDLE,Byval As UInteger Ptr) As Integer
Declare Function FT_GetDeviceInfo Alias "FT_GetDeviceInfo" (Byval As FT_HANDLE,ByVal As UInteger Ptr,ByVal As UInteger Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr,ByVal As Integer) As Integer
Declare Function FT_GetDeviceInfoDetail Alias "FT_GetDeviceInfoDetail" (Byval As UInteger,Byval As UInteger Ptr,Byval As UInteger Ptr,Byval As UInteger Ptr,Byval As UInteger Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr,ByVal As FT_HANDLE Ptr) As Integer
Declare Function FT_GetDeviceInfoList Alias "FT_GetDeviceInfoList" (Byval As FT_DEVICE_LIST_INFO_NODE Ptr,Byval As UInteger Ptr) As Integer
Declare Function FT_GetDriverVersion Alias "FT_GetDriverVersion" (Byval As FT_HANDLE,Byval As UInteger Ptr) As Integer
Declare Function FT_GetLatencyTimer Alias "FT_GetLatencyTimer" (Byval As FT_HANDLE,Byval As UByte Ptr) As Integer
Declare Function FT_GetLibraryVersion Alias "FT_GetLibraryVersion" (Byval As UInteger Ptr) As Integer
Declare Function FT_GetModemStatus Alias "FT_GetModemStatus" (Byval As FT_HANDLE,Byval As UInteger Ptr) As Integer
Declare Function FT_GetQueueStatus Alias "FT_GetQueueStatus" (Byval As FT_HANDLE,Byval As UInteger Ptr) As Integer
Declare Function FT_GetStatus Alias "FT_GetStatus" (Byval As FT_HANDLE,Byval As UInteger Ptr,Byval As UInteger Ptr,Byval As UInteger Ptr) As Integer
Declare Function FT_ListDevices Alias "FT_ListDevices" (Byval As Any Ptr,Byval As Any Ptr,ByVal As UInteger) As Integer
Declare Function FT_Open Alias "FT_Open" (Byval As UInteger,Byval As FT_HANDLE Ptr) As Integer
Declare Function FT_OpenEx Alias "FT_OpenEx" (Byval As Any Ptr,ByVal As UInteger,Byval As FT_HANDLE Ptr) As Integer
Declare Function FT_Purge Alias "FT_Purge" (Byval As FT_HANDLE,Byval As UInteger) As Integer
Declare Function FT_Read Alias "FT_Read" (Byval As FT_HANDLE,ByVal As Byte Ptr,Byval As UInteger,Byval As UInteger Ptr) As Integer
Declare Function FT_Reload Alias "FT_Reload" (Byval As UShort,Byval As UShort) As Integer
Declare Function FT_Rescan Alias "FT_Rescan" () As Integer
Declare Function FT_ResetDevice Alias "FT_ResetDevice" (Byval As FT_HANDLE) As Integer
Declare Function FT_ResetPort Alias "FT_ResetPort" (Byval As FT_HANDLE) As Integer
Declare Function FT_RestartInTask Alias "FT_RestartInTask" (Byval As FT_HANDLE) As Integer
Declare Function FT_SetBaudRate Alias "FT_SetBaudRate" (Byval As FT_HANDLE,Byval As UInteger) As Integer
Declare Function FT_SetBitMode Alias "FT_SetBitMode" (Byval As FT_HANDLE,Byval As UInteger,Byval As UInteger) As Integer
Declare Function FT_SetBreakOff Alias "FT_SetBreakOff" (Byval As FT_HANDLE) As Integer
Declare Function FT_SetBreakOn Alias "FT_SetBreakOn" (Byval As FT_HANDLE) As Integer
Declare Function FT_SetChars Alias "FT_SetChars" (Byval As FT_HANDLE,ByVal As UByte,ByVal As UByte,ByVal As UByte,ByVal As UByte) As Integer
Declare Function FT_SetDataCharacteristics Alias "FT_SetDataCharacteristics" (Byval As FT_HANDLE,ByVal As UByte,ByVal As UByte,ByVal As UByte) As Integer
Declare Function FT_SetDeadmanTimeout Alias "FT_SetDeadmanTimeout" (Byval As FT_HANDLE,Byval As UInteger) As Integer
Declare Function FT_SetDtr Alias "FT_SetDtr" (Byval As FT_HANDLE) As Integer
Declare Function FT_SetEventNotification Alias "FT_SetEventNotification" (Byval As FT_HANDLE,ByVal As UInteger,ByVal As UInteger) As Integer
Declare Function FT_SetFlowControl Alias "FT_SetFlowControl" (Byval As FT_HANDLE,ByVal As UShort,ByVal As UByte,ByVal As UByte) As Integer
Declare Function FT_SetLatencyTimer Alias "FT_SetLatencyTimer" (Byval As FT_HANDLE,Byval As UBYTE) As Integer
Declare Function FT_SetResetPipeRetryCount Alias "FT_SetResetPipeRetryCount" (Byval As FT_HANDLE,Byval As UInteger) As Integer
Declare Function FT_SetRts Alias "FT_SetRts" (Byval As FT_HANDLE) As Integer
Declare Function FT_SetTimeouts Alias "FT_SetTimeouts" (Byval As FT_HANDLE,Byval As Integer,Byval As UInteger) As Integer
Declare Function FT_SetUSBParameters Alias "FT_SetUSBParameters" (Byval As FT_HANDLE,ByVal As UInteger,ByVal As UInteger) As Integer
Declare Function FT_StopInTask Alias "FT_StopInTask" (Byval As FT_HANDLE) As Integer
Declare Function FT_Write Alias "FT_Write" (Byval As FT_HANDLE,Byval As Byte Ptr,ByVal As UInteger,ByVal As UInteger Ptr) As Integer

'EEPROM functions
Declare Function FT_EE_Program Alias "FT_EE_Program" (Byval As FT_HANDLE,Byval As FT_PROGRAM_DATA_STRUCTURE Ptr) As Integer
Declare Function FT_EE_ProgramEx Alias "FT_EE_ProgramEx" (Byval As FT_HANDLE,Byval As UInteger Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr) As Integer
Declare Function FT_EE_Read Alias "FT_EE_Read" (Byval As FT_HANDLE,Byval As FT_PROGRAM_DATA_STRUCTURE Ptr) As Integer
Declare Function FT_EE_ReadEx Alias "FT_EE_ReadEx" (Byval As FT_HANDLE,Byval As UInteger Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr,ByVal As ZString Ptr) As Integer
Declare Function FT_EE_UARead Alias "FT_EE_UARead" (Byval As FT_HANDLE,Byval As UByte Ptr,Byval as UInteger, Byval as UInteger Ptr) As Integer
Declare Function FT_EE_UASize Alias "FT_EE_UASize" (Byval As FT_HANDLE,Byval As UInteger Ptr) As Integer
Declare Function FT_EE_UAWrite Alias "FT_EE_UAWrite" (Byval As FT_HANDLE,Byval As UByte Ptr,Byval as UInteger) As Integer
Declare Function FT_EraseEE Alias "FT_EraseEE" (Byval As FT_HANDLE) As Integer
Declare Function FT_ReadEE Alias "FT_ReadEE" (Byval As FT_HANDLE,ByVal As UInteger,ByVal As UShort Ptr) As Integer
Declare Function FT_WriteEE Alias "FT_WriteEE" (Byval As FT_HANDLE,ByVal As UInteger,ByVal As UShort) As Integer



'Declare Function FT_W32_CancelIo@4 Alias "FT_W32_CancelIo" (Byval As Integer) As Integer
'Declare Function FT_W32_ClearCommBreak@4 Alias "FT_W32_ClearCommBreak" (Byval As Integer) As Integer
'Declare Function FT_W32_ClearCommError@12 Alias "FT_W32_ClearCommError" (Byval As Integer) As Integer
'Declare Function FT_W32_CloseHandle@4 Alias "FT_W32_CloseHandle" (Byval As Integer) As Integer
'Declare Function FT_W32_CreateFile@28 Alias "FT_W32_CreateFile" (Byval As Integer) As Integer
'Declare Function FT_W32_EscapeCommFunction@8 Alias "FT_W32_EscapeCommFunction" (Byval As Integer) As Integer
'Declare Function FT_W32_GetCommMask@8 Alias "FT_W32_GetCommMask" (Byval As Integer) As Integer
'Declare Function FT_W32_GetCommModemStatus@8 Alias "FT_W32_GetCommModemStatus" (Byval As Integer) As Integer
'Declare Function FT_W32_GetCommState@8 Alias "FT_W32_GetCommState" (Byval As Integer) As Integer
'Declare Function FT_W32_GetCommTimeouts@8 Alias "FT_W32_GetCommTimeouts" (Byval As Integer) As Integer
'Declare Function FT_W32_GetLastError@4 Alias "FT_W32_GetLastError" (Byval As Integer) As Integer
'Declare Function FT_W32_GetOverlappedResult@16 Alias "FT_W32_GetOverlappedResult" (Byval As Integer) As Integer
'Declare Function FT_W32_PurgeComm@8 Alias "FT_W32_PurgeComm" (Byval As Integer) As Integer
'Declare Function FT_W32_ReadFile@20 Alias "FT_W32_ReadFile" (Byval As Integer) As Integer
'Declare Function FT_W32_SetCommBreak@4 Alias "FT_W32_SetCommBreak" (Byval As Integer) As Integer
'Declare Function FT_W32_SetCommMask@8 Alias "FT_W32_SetCommMask" (Byval As Integer) As Integer
'Declare Function FT_W32_SetCommState@8 Alias "FT_W32_SetCommState" (Byval As Integer) As Integer
'Declare Function FT_W32_SetCommTimeouts@8 Alias "FT_W32_SetCommTimeouts" (Byval As Integer) As Integer
'Declare Function FT_W32_SetupComm@12 Alias "FT_W32_SetupComm" (Byval As Integer) As Integer
'Declare Function FT_W32_WaitCommEvent@12 Alias "FT_W32_WaitCommEvent" (Byval As Integer) As Integer
'Declare Function FT_W32_WriteFile@20 Alias "FT_W32_WriteFile" (Byval As Integer) As Integer

'No longer required
'Declare Function FT_SetDivisor@8 Alias "FT_SetDivisor" (Byval As Integer) As Integer

'Undocumented functions
'Declare Function FT_GetEventStatus@8 Alias "FT_GetEventStatus" (Byval As Integer) As Integer
'Declare Function FT_IoCtl@32 Alias "FT_IoCtl" (Byval As Integer) As Integer
'Declare Function FT_SetWaitMask@8 Alias "FT_SetWaitMask" (Byval As Integer) As Integer
'Declare Function FT_WaitOnMask@8 Alias "FT_WaitOnMask" (Byval As Integer) As Integer


I haven't done all the function declarations as there are some I'm not interested in - leaving them out shouldn't cause any problems should it?

Do the Freebasic data types I've converted too look alright? Does the syntax in general look correct?

Frank

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 0 guests