Difference between revisions of "Unit FTDISerial"

From Ultibo.org
Jump to: navigation, search
Line 6,372: Line 6,372:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,387: Line 6,387:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,399: Line 6,399:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,411: Line 6,411:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,423: Line 6,423:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,438: Line 6,438:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Device'''
+
! Device
 
| The USB device to attempt to bind to
 
| The USB device to attempt to bind to
 
|-
 
|-
! '''Interrface'''
+
! Interrface
 
| The USB interface to attempt to bind to (or nil for whole device)
 
| The USB interface to attempt to bind to (or nil for whole device)
 
|-
 
|-
! '''Return'''
+
! Return
| USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure
+
| USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure.
 
|-
 
|-
 
|}
 
|}
Line 6,456: Line 6,456:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Device'''
+
! Device
 
| The USB device to unbind from
 
| The USB device to unbind from
 
|-
 
|-
! '''Interrface'''
+
! Interrface
 
| The USB interface to unbind from (or nil for whole device)
 
| The USB interface to unbind from (or nil for whole device)
 
|-
 
|-
! '''Return'''
+
! Return
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 6,474: Line 6,474:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Request'''
+
! Request
 
| The USB request which has completed
 
| The USB request which has completed
 
|-
 
|-
! '''Note'''
+
! Note
 
| The first two bytes of the received packet will be:
 
| The first two bytes of the received packet will be:
 
Byte 0: Modem Status
 
Byte 0: Modem Status
Line 6,507: Line 6,507:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Request'''
+
! Request
 
| The USB request which has completed
 
| The USB request which has completed
 
|-
 
|-
! '''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
 
|-
 
|-
Line 6,522: Line 6,522:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Request'''
+
! Request
 
| The USB transmit request to use
 
| The USB transmit request to use
 
|-
 
|-
! '''Note'''
+
! Note
 
| The FTDISERIAL_CHIP_SIO device requires the first byte to be:
 
| The FTDISERIAL_CHIP_SIO device requires the first byte to be:
 
Bit0 1  Reserved must be 1
 
Bit0 1  Reserved must be 1
Line 6,541: Line 6,541:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Request'''
+
! Request
 
| The USB request which has completed
 
| The USB request which has completed
 
|-
 
|-
Line 6,553: Line 6,553:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Request'''
+
! Request
 
| The USB request which has completed
 
| The USB request which has completed
 
|-
 
|-
! '''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
 
|-
 
|-
Line 6,571: Line 6,571:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Device'''
+
! Device
 
| USB device to check
 
| USB device to check
 
|-
 
|-
! '''Return'''
+
! Return
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 6,586: Line 6,586:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Device'''
+
! Device
 
| USB device to check
 
| USB device to check
 
|-
 
|-
! '''Return'''
+
! Return
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 6,601: Line 6,601:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Device'''
+
! Device
 
| USB device to check
 
| USB device to check
 
|-
 
|-
! '''Return'''
+
! Return
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
| USB_STATUS_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 6,616: Line 6,616:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,628: Line 6,628:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,640: Line 6,640:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,652: Line 6,652:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,664: Line 6,664:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,676: Line 6,676:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,688: Line 6,688:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,700: Line 6,700:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,712: Line 6,712:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,724: Line 6,724:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,736: Line 6,736:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,748: Line 6,748:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,760: Line 6,760:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,772: Line 6,772:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,784: Line 6,784:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 6,796: Line 6,796:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Revision as of 04:15, 24 April 2018

Return to Unit Reference


Description


FTDI USB to Serial Driver unit

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 from application code.

Constants



[Expand]
FTDI serial specific constants FTDISERIAL_*


[Expand]
FTDI serial chip type FTDISERIAL_CHIP_*


[Expand]
FTDI serial SIO chip baud rate divisor FTDISERIAL_SIO_*


[Expand]
FTDI serial bulk IN/OUT size FTDISERIAL_BULK_*


[Expand]
FTDI serial USB timeout FTDISERIAL_TIMEOUT*


[Expand]
FTDI serial USB request FTDISERIAL_*_REQUEST


[Expand]
FTDI serial USB request type FTDISERIAL_*_REQUEST_TYPE


[Expand]
FTDI serial reset FTDISERIAL_RESET_*


[Expand]
FTDI serial set modem control FTDISERIAL_SET_MODEM_CTRL_*


[Expand]
FTDI serial set flow control FTDISERIAL_SET_FLOW_CTRL_*


[Expand]
FTDI serial set data FTDISERIAL_SET_DATA_*


[Expand]
FTDI serial get modem status FTDISERIAL_GET_MODEM_STATUS_*


[Expand]
FTDI serial receive status FTDISERIAL_RECEIVE_STATUS*


[Expand]
FTDI serial interface index FTDISERIAL_INTERFACE_*


[Expand]
FTDI serial device quirk FTDISERIAL_QUIRK_*


[Expand]
FTDI vendor and product Id FTDI_VID*, FTDI_*_PID


[Expand]
FTDI serial device Id FTDISERIAL_DEVICE_ID_*


[Expand]
FTDI serial device and interface Id FTDISERIAL_DEVICE_INTERFACE_ID_*


[Expand]
FTDI serial device and interface no FTDISERIAL_DEVICE_INTERFACE_NO_*


Type definitions



FTDI serial device types

[Expand]

PFTDISerialDevice = ^TFTDISerialDevice;

TFTDISerialDevice = record


Public variables


None defined

Function declarations



Initialization functions

[Expand]
procedure FTDISerialInit;
Description: To be documented


FTDI serial functions

[Expand]
function FTDISerialDeviceOpen(Serial:PSerialDevice; BaudRate,DataBits,StopBits,Parity,FlowControl,ReceiveDepth,TransmitDepth:LongWord):LongWord;
Description: To be documented


[Expand]
function FTDISerialDeviceClose(Serial:PSerialDevice):LongWord;
Description: To be documented


[Expand]
function FTDISerialDeviceRead(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: To be documented


[Expand]
function FTDISerialDeviceWrite(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: To be documented


FTDI serial USB functions

[Expand]
function FTDISerialDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the FTDI Serial driver to a USB device if it is suitable


[Expand]
function FTDISerialDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the FTDI Serial driver from a USB device


[Expand]
procedure FTDISerialReceiveWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from the FTDI Serial bulk IN endpoint


[Expand]
procedure FTDISerialReceiveComplete(Request:PUSBRequest);
Description: Called when a USB request from the FTDI Serial bulk IN endpoint completes


[Expand]
procedure FTDISerialTransmitStart(Request:PUSBRequest);
Description: Called to continue transmission of data from the transmit buffer


[Expand]
procedure FTDISerialTransmitWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request to the FTDI Serial bulk OUT endpoint


[Expand]
procedure FTDISerialTransmitComplete(Request:PUSBRequest);
Description: Called when a USB request to the FTDI Serial bulk OUT endpoint completes


FTDI serial helper functions

[Expand]
function FTDISerialCheckDevice(Device:PUSBDevice):LongWord;
Description: Check the Vendor and Device ID against the supported devices


[Expand]
function FTDISerialCheckDeviceAndInterface(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Check the Device and Interface against the supported devices


[Expand]
function FTDISerialPatchDevice(Device:PUSBDevice; var Quirks:LongWord):LongWord;
Description: Check the USB device for quirks information needed by the driver


[Expand]
function FTDISerialCheckJTAGDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Check for the first port (interface) on JTAG adapters which is reserved for JTAG


[Expand]
function FTDISerialCheck8U2232CDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Check for the first port (interface) on 8U2232C adapters which is reserved for JTAG


[Expand]
function FTDISerialCheckSTMCLiteDevice(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
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


[Expand]
function FTDISerialDetermineType(Serial:PFTDISerialDevice):LongWord;
Description: To be documented


[Expand]
function FTDISerialGetLatency(Serial:PFTDISerialDevice):LongWord;
Description: To be documented


[Expand]
function FTDISerialSetLatency(Serial:PFTDISerialDevice):LongWord;
Description: To be documented


[Expand]
function FTDISerialReset(Serial:PFTDISerialDevice; Value:Word):LongWord;
Description: To be documented


[Expand]
function FTDISerialSetData(Serial:PFTDISerialDevice; Value:Word):LongWord;
Description: To be documented


[Expand]
function FTDISerialSetBaudRate(Serial:PFTDISerialDevice; Divisor:LongWord):LongWord;
Description: To be documented


[Expand]
function FTDISerialSetFlowControl(Serial:PFTDISerialDevice; Index:Word):LongWord;
Description: To be documented


[Expand]
function FTDISerialGetModemStatus(Serial:PFTDISerialDevice; var Status:Word):LongWord;
Description: To be documented


[Expand]
function FTDISerialSetModemControl(Serial:PFTDISerialDevice; Value:Word):LongWord;
Description: To be documented


[Expand]
function FTDISerialGetDivisor(Serial:PFTDISerialDevice; var BaudRate:LongWord):LongWord;
Description: To be documented


[Expand]
function FTDISerialBaudToDivisor232AM(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;
Description: To be documented


[Expand]
function FTDISerialBaudToDivisor232BM(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;
Description: To be documented


[Expand]
function FTDISerialBaudToDivisor2232H(Serial:PFTDISerialDevice; BaudRate:LongWord):LongWord;
Description: To be documented


Return to Unit Reference