Difference between revisions of "Unit FTDISerial"
Line 224: | Line 224: | ||
! '''Note''' | ! '''Note''' | ||
| Request is passed to worker thread for processing to prevent blocking the USB completion | | Request is passed to worker thread for processing to prevent blocking the USB completion | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''FTDI serial helper functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialCheckDevice(Device:PUSBDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the Vendor and Device ID against the supported devices</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Device''' | ||
+ | | USB device to check | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialCheckDeviceAndInterface(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the Device and Interface against the supported devices</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Device''' | ||
+ | | USB device to check | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialPatchDevice(Device:PUSBDevice; var Quirks:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the USB device for quirks information needed by the driver</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Device''' | ||
+ | | USB device to check | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | USB_STATUS_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialCheckJTAGDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check for the first port (interface) on JTAG adapters which is reserved for JTAG</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialCheck8U2232CDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check for the first port (interface) on 8U2232C adapters which is reserved for JTAG</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialCheckSTMCLiteDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check for the first and second ports (interfaces) on FT4232 adapters which are reserved for JTAG or other non UART interfaces. Port (interface) 2 is a standard RS232 UART</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialDetermineType(Serial:PFTDISerialDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialGetLatency(Serial:PFTDISerialDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialSetLatency(Serial:PFTDISerialDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialReset(Serial:PFTDISerialDevice; Value:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialSetData(Serial:PFTDISerialDevice; Value:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialSetBaudRate(Serial:PFTDISerialDevice; Divisor:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialSetFlowControl(Serial:PFTDISerialDevice; Index:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialGetModemStatus(Serial:PFTDISerialDevice; var Status:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialSetModemControl(Serial:PFTDISerialDevice; Value:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialGetDivisor(Serial:PFTDISerialDevice; var BaudRate:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialBaudToDivisor232AM(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialBaudToDivisor232BM(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function FTDISerialBaudToDivisor2232H(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
|- | |- | ||
|} | |} |
Revision as of 00:21, 14 October 2016
Return to Unit Reference
Description
This driver is intended to support a range of USB to Serial converter chips manufactured by Future Technology Devices International Ltd (FTDI). These include devices using the FT232H,FT-X (FT201X, FT230X, FT231X), FT8U100AX and FT4232H as well as others, many of these chips utilize similar communications protocols and where different the driver attempts to account for those differences.
The driver also supports communication with many Arduino models that contain an FTDI serial device on board rather than the USB CDC ADM device found in more recent models.
Any device recognized as an FTDI Serial is presented as a generic serial interface device that can be accessed using the API in the Serial unit. It should not be necessary to directly call any of the functions in this unit within application code.
Constants
To be documented
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
procedure FTDISerialInit;
Note | None documented |
---|
FTDI serial functions
function FTDISerialDeviceOpen(Serial:PSerialDevice; BaudRate,DataBits,StopBits,Parity,FlowControl,ReceiveDepth,TransmitDepth:LongWord):LongWord;
Note | None documented |
---|
function FTDISerialDeviceClose(Serial:PSerialDevice):LongWord;
Note | None documented |
---|
function FTDISerialDeviceRead(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Note | None documented |
---|
function FTDISerialDeviceWrite(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Note | None documented |
---|
FTDI serial USB functions
function FTDISerialDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Device | The USB device to attempt to bind to |
---|---|
Interrface | The USB interface to attempt to bind to (or nil for whole device) |
Return | USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure |
function FTDISerialDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Device | The USB device to unbind ?rom |
---|---|
Interrface | The USB interface to unbind ?rom (or nil for whole device) |
Return | USB_STATUS_SUCCESS if completed or another error code on failure |
procedure FTDISerialReceiveWorker(Request:PUSBRequest);
Request | The USB request which has completed |
---|---|
Note | The first two bytes of the received packet will be:
Byte 0: Modem Status
|
procedure FTDISerialReceiveComplete(Request:PUSBRequest);
Request | The USB request which has completed |
---|---|
Note | Request is passed to worker thread for processing to prevent blocking the USB completion |
procedure FTDISerialTransmitStart(Request:PUSBRequest);
Request | The USB transmit request to use |
---|---|
Note | The FTDISERIAL_CHIP_SIO device requires the first byte to be:
Bit0 1 Reserved must be 1
|
procedure FTDISerialTransmitWorker(Request:PUSBRequest);
Request | The USB request which has completed |
---|
procedure FTDISerialTransmitComplete(Request:PUSBRequest);
Request | The USB request which has completed |
---|---|
Note | Request is passed to worker thread for processing to prevent blocking the USB completion |
FTDI serial helper functions
function FTDISerialCheckDevice(Device:PUSBDevice):LongWord;
Device | USB device to check |
---|---|
Return | USB_STATUS_SUCCESS if completed or another error code on failure |
function FTDISerialCheckDeviceAndInterface(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Device | USB device to check |
---|---|
Return | USB_STATUS_SUCCESS if completed or another error code on failure |
function FTDISerialPatchDevice(Device:PUSBDevice; var Quirks:LongWord):LongWord;
Device | USB device to check |
---|---|
Return | USB_STATUS_SUCCESS if completed or another error code on failure |
function FTDISerialCheckJTAGDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Note | None documented |
---|
function FTDISerialCheck8U2232CDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Note | None documented |
---|
function FTDISerialCheckSTMCLiteDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Note | None documented |
---|
function FTDISerialDetermineType(Serial:PFTDISerialDevice):LongWord;
Note | None documented |
---|
function FTDISerialGetLatency(Serial:PFTDISerialDevice):LongWord;
Note | None documented |
---|
function FTDISerialSetLatency(Serial:PFTDISerialDevice):LongWord;
Note | None documented |
---|
function FTDISerialReset(Serial:PFTDISerialDevice; Value:Word):LongWord;
Note | None documented |
---|
function FTDISerialSetData(Serial:PFTDISerialDevice; Value:Word):LongWord;
Note | None documented |
---|
function FTDISerialSetBaudRate(Serial:PFTDISerialDevice; Divisor:LongWord):LongWord;
Note | None documented |
---|
function FTDISerialSetFlowControl(Serial:PFTDISerialDevice; Index:Word):LongWord;
Note | None documented |
---|
function FTDISerialGetModemStatus(Serial:PFTDISerialDevice; var Status:Word):LongWord;
Note | None documented |
---|
function FTDISerialSetModemControl(Serial:PFTDISerialDevice; Value:Word):LongWord;
Note | None documented |
---|
function FTDISerialGetDivisor(Serial:PFTDISerialDevice; var BaudRate:LongWord):LongWord;
Note | None documented |
---|
function FTDISerialBaudToDivisor232AM(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;
Note | None documented |
---|
function FTDISerialBaudToDivisor232BM(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;
Note | None documented |
---|
function FTDISerialBaudToDivisor2232H(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;
Note | None documented |
---|
Return to Unit Reference