Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)
104 Chapter4
Using FDEVICECONTROL
Examples
Controlling Device XON/XOFF Processing
Another device control feature provided by the FDEVICECONTROL
intrinsic is the ability to disable (and subsequently reenable)
XON/XOFF flow control between a device and the DTC.
XON/XOFF protocol provides the main method of flow control used by
MPE/iX systems. The protocol controls the flow of data transmitted
between the DTC and a device to protect against data overruns.
XON/XOFF flow control allows the device receiving a transmission to
stop the flow of data coming in should the device become temporarily
unable to receive the data. It does this by sending an XOFF character to
the DTC. XOFF is the ASCII DC3 character (
[CTRL]S).
When the device is once again able to receive data, it transmits an XON
character to signal that the DTC should resume data transmission.
XON is the ASCII DC1 character (
[CTRL]Q).
When XON/XOFF flow control is enabled, the DC1 and DC3 characters
are not transmitted to the host. XON/XOFF flow control is enabled by
default. All devices supported for use on MPE/iX systems are capable of
using XON/XOFF protocol.
The only time XON/XOFF flow control is normally not active is during
binary mode reads. This is because the DC1 and DC3 characters are not
recognized as special characters in binary editing mode. However, no
other special character processing occurs in this mode, either.
By using FDEVICECONTROL with a control directive of 26, it is
possible to disable XON/XOFF flow control without altering any other
aspect of how the device operates. It then becomes possible to transmit
DC1 and DC3 characters to the host without causing the DTC to
suspend transmission. All other special characters will still be
recognized, and the associated special character functions will be
performed. You should only use this capability when it is absolutely
necessary to do so, however, and always with extreme care. When
XON/XOFF flow control is disabled, it is possible for data overruns to
occur and for data to be lost as a result.
The program fragment shown in Figure 4-6 provides an example of
using FDEVICECONTROL to disable device XON/XOFF flow control.
The parm1 value of 26 specifies that the call is to set device
XON/XOFF. The
value
variable contained in the buffer parameter is
set to 0, which indicates that XON/XOFF is to be disabled by the call.
To re-enable device XON/XOFF you would call FDEVICECONTROL
with a control directive of 26 again, but this time you would set the
value of buffer to 1.