[Lazarus] SdpoSerial Tx and Rx buffers?
José Mejuto
joshyfun at gmail.com
Wed Feb 16 16:14:47 CET 2011
Hello Lazarus-List,
Wednesday, February 16, 2011, 1:26:38 PM, you wrote:
MS> On 02/16/2011 12:07 PM, José Mejuto wrote:
>> AFAIK the FIFO is in the receive, in sent the FIFOs are filled but
>> function does not return until the hardware sends the last byte.
MS> If this is true somewhere, it is not portable.
Glups! What ?
MSDN about RS232: Nonoverlapped I/O is familiar to most developers
because this is the traditional form of I/O, where an operation is
requested and is assumed to be complete when the function returns.
In non-overlapped mode, block mode, or whichever you like to call it,
the program sends, in example, 100 bytes to rs-232, the operative
system sends 16 of them to the UART, when FIFO bytes has been sent the
UART generates an interrupt to tell to the OS to refill the FIFO
buffer. This procedure is repeated several times, when no more data is
pending in the OS buffers to be sent, the OS waits for the interrupt
or timeout interrupt, and when the transmission buffer is empty
(interrupt received) the OS exits the send function. FIFO in
transmission alleviate the overhead in interrupts 16:1.
The problem is in the timeout case as you will not know at which byte
the transmission timedout as the FIFO can only be asked about empty or
not.
Non blocking is pretty the same at the OS level, except that the send
function returns inmediatly and you have some helper functions to
inquiry the current transmission status/state/progress.
--
Best regards,
José
More information about the Lazarus
mailing list