Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)
Chapter 6 127
Typeahead Mode
Programming for Typeahead Mode
Flushing the Typeahead Buffer
Figure 6-2 illustrates how FDEVICECONTROL can be used to flush
the typeahead buffer. For example, the buffer can be flushed if an error
is detected in the data that was typed ahead. This FDEVICECONTROL
is only valid if type ahead is enabled. The default is not to flush the
typeahead buffer.
An FDEVICECONTROL call with a control directive of 60 will cause
the buffer to be flushed at the time of the next read. The read can then
be satisfied by data entered directly from the device. The typeahead
buffer is flushed for a single read only; normal typeahead mode
processing will resume for any following reads.
In the example, the parm1 value is set to 60, flush typeahead buffer,
and the buffer parameter (
value
) passes a value of 1. This specifies
that all data currently in the typeahead buffer should be discarded, and
the next read should access the device directly. Write access is specified
in parm2, and the program checks for errors using the Pascal/iX
ccode
function.