|
||
The member function Write()
is typically rather more straightforward than Read()
, as the characteristics of the data that we want to send are already known. However, there is a potential ambiguity in the
meaning of a return from this call, in that it could occur immediately after the data has been queued for sending, or it could
be postponed until the data has been completely transmitted and the transmit buffer is empty.
It is possible to configure a port for either type of behaviour by using TCommConfig
to set the KConfigWriteBufferedComplete
bit in iHandshake
. This is the final member of the handshaking bitmasks. The potential advantage of enabling early completion is that applications
are able to leverage the interrupt-driven output buffers in the serial port driver and make use of the time taken to transmit
data to ready their next block of data for transmission with no delays. On the other hand, if the write request is going to
be followed by a read, in expectation of a response to the data just sent, the fact of early completion serves to complicate
the calculation of a suitable time-out period.