[En-Nut-Discussion] flushing input buffers, or fpurge. (was: fflush on input)
Oliver Schulz
Oliver.Schulz at bong.de
Mon Mar 1 09:58:38 CET 2004
Hi,
regarding this fpurge issue. The actual UART driver in nut-3_4-release branch in CVS does already support discarding input buffers. For v 3.5 the new USART driver does also.
Like flushing the output buffers (by calling write functions with zero length), discarding the input buffer is done by device driver by calling the read function with zero data pointer. Example:
fread(0, 0, 0, someStream);
or
_read (someFd, 0, 0);
The TCPSOCKET virtual device driver doesn't actually support discarding the input buffer. I think this should be done for the next release (3.5), since this is an additional feature.
Nevertheless, for your convenience I will add the function 'fpurge' to 3.4, because it is like fflush just a wrapper for calling the read function.
Cheers,
Oliver.
> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de]Im Auftrag von
> Oliver Schulz
> Gesendet: Freitag, 27. Februar 2004 10:05
> An: Ethernut User Chat (English)
> Betreff: AW: [En-Nut-Discussion] fflush on input
>
>
> Hi,
>
> to finally clearify this fflush issue:
>
> By calling 'fflush', the device's write function is called
> with parameter 'len' set to zero. It's up to the device
> driver to handle this special write.
>
> The USART device driver and TCPSOCKET virtual device will
> then sent any buffered output data to the device output
> function. That means output buffers are flushed, but NOT discarded.
>
> The input buffer is NOT touched in any manner, means that it
> is also NOT discarded.
>
> Actually there is no function to discard input buffers, but
> IMHO it would be nice to have one. I will look how to
> implement 'fpurge' this weekend (and commitin' some other
> queued bugfixes to CVS).
>
> Regards,
> Oliver.
>
>
More information about the En-Nut-Discussion
mailing list