Unit FTDISerial
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 Bit0 Reserved - must be 1 Bit1 Reserved - must be 0 Bit2 Reserved - must be 0 Bit3 Reserved - must be 0 Bit4 Clear to Send (CTS) Bit5 Data Set Ready (DSR) Bit6 Ring Indicator (RI) Bit7 Receive Line Signal Detect (RLSD) Byte 1: Line Status Bit0 Data Ready (DR) Bit1 Overrun Error (OE) Bit2 Parity Error (PE) Bit3 Framing Error (FE) Bit4 Break Interrupt (BI) Bit5 Transmitter Holding Register (THRE) Bit6 Transmitter Empty (TEMT) Bit7 Error in RCVR FIFO} |
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 Bit1 0 Reserved must be 0 Bit2..7 Length of message (not including this byte) Caller must hold the lock on the serial device |
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 |
Return to Unit Reference