Difference between revisions of "Unit PL2303"
From Ultibo.org
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 /> | ||
+ | |||
+ | '''PL2303 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 PL2303CheckDevice(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 PL2303PatchDevice(Device:PUSBDevice; var Model,Quirks:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the USB device for quirks and model 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 PL2303VendorRead(Device:PUSBDevice; Value:Word; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a vendor read request to a PL2303 device</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 PL2303VendorWrite(Device:PUSBDevice; Value,Index:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a vendor write request to a PL2303 device</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 PL2303GetLineRequest(Device:PUSBDevice; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a get line request to a PL2303 device</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 PL2303SetLineRequest(Device:PUSBDevice; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a set line request to a PL2303 device</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 PL2303SetControlRequest(Device:PUSBDevice; Value:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a set control request to a PL2303 device</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 PL2303EncodeBaudRate(Device:PUSBDevice; BaudRate:LongWord; Data:PByte):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Encode a baud rate value into the Line Request buffer for a PL2303 device</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 PL2303GetSupportedRate(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 01:22, 14 October 2016
Return to Unit Reference
Description
The Prolific PL2303 is a USB to serial interface chip used by multiple vendors.
It includes a single serial port with bulk IN and OUT plus interrupt IN endpoints.
Constants
To be documented
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
procedure PL2303Init;
Description: To be documented
Note | None documented |
---|
PL2303 serial functions
function PL2303SerialDeviceOpen(Serial:PSerialDevice; BaudRate,DataBits,StopBits,Parity,FlowControl,ReceiveDepth,TransmitDepth:LongWord):LongWord;
Description: To be documented
Note | None documented |
---|
function PL2303SerialDeviceClose(Serial:PSerialDevice):LongWord;
Description: To be documented
Note | None documented |
---|
function PL2303SerialDeviceRead(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: To be documented
Note | None documented |
---|
function PL2303SerialDeviceWrite(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: To be documented
Note | None documented |
---|
PL2303 USB functions
function PL2303DriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the PL2303 driver to a USB device if it is suitable
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 PL2303DriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the PL2303 driver from a USB device
Device | The USB device to unbind from |
---|---|
Interrface | The USB interface to unbind from (or nil for whole device) |
Return | USB_STATUS_SUCCESS if completed or another error code on failure |
procedure PL2303ReceiveWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from the PL2303 bulk IN endpoint
Request | The USB request which has completed |
---|
procedure PL2303ReceiveComplete(Request:PUSBRequest);
Description: Called when a USB request from the PL2303 bulk IN endpoint completes
Request | The USB request which has completed |
---|---|
Note | Request is passed to worker thread for processing to prevent blocking the USB completion |
procedure PL2303TransmitStart(Request:PUSBRequest);
Description: Called to continue transmission of data from the transmit buffer
Request | The USB transmit request to use |
---|---|
Note | Caller must hold the lock on the serial device |
procedure PL2303TransmitWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request to the PL2303 bulk OUT endpoint
Request | The USB request which has completed |
---|
procedure PL2303TransmitComplete(Request:PUSBRequest);
Description: Called when a USB request to the PL2303 bulk OUT endpoint completes
Request | The USB request which has completed |
---|---|
Note | Request is passed to worker thread for processing to prevent blocking the USB completion |
procedure PL2303InterruptWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request to the PL2303 interrupt IN endpoint
Request | The USB request which has completed |
---|
procedure PL2303InterruptComplete(Request:PUSBRequest);
Description: Called when a USB request from the PL2303 interrupt IN endpoint completes
Request | The USB request which has completed |
---|---|
Note | Request is passed to worker thread for processing to prevent blocking the USB completion |
PL2303 helper functions
function PL2303CheckDevice(Device:PUSBDevice):LongWord;
Description: Check the Vendor and Device ID against the supported devices
Device | USB device to check |
---|---|
USB_STATUS_SUCCESS if completed or another error code on failure |
function PL2303PatchDevice(Device:PUSBDevice; var Model,Quirks:LongWord):LongWord;
Description: Check the USB device for quirks and model information needed by the driver
Device | USB device to check |
---|---|
Return | USB_STATUS_SUCCESS if completed or another error code on failure |
function PL2303VendorRead(Device:PUSBDevice; Value:Word; Data:PByte):LongWord;
Description: Perform a vendor read request to a PL2303 device
Note | None documented |
---|
function PL2303VendorWrite(Device:PUSBDevice; Value,Index:Word):LongWord;
Description: Perform a vendor write request to a PL2303 device
Note | None documented |
---|
function PL2303GetLineRequest(Device:PUSBDevice; Data:PByte):LongWord;
Description: Perform a get line request to a PL2303 device
Note | None documented |
---|
function PL2303SetLineRequest(Device:PUSBDevice; Data:PByte):LongWord;
Description: Perform a set line request to a PL2303 device
Note | None documented |
---|
function PL2303SetControlRequest(Device:PUSBDevice; Value:Word):LongWord;
Description: Perform a set control request to a PL2303 device
Note | None documented |
---|
function PL2303EncodeBaudRate(Device:PUSBDevice; BaudRate:LongWord; Data:PByte):LongWord;
Description: Encode a baud rate value into the Line Request buffer for a PL2303 device
Note | None documented |
---|
function PL2303GetSupportedRate(BaudRate:LongWord):LongWord;
Description: To be documented
Note | None documented |
---|
Return to Unit Reference