Re: synchronous serial port communication (16550A)

From: Russell King
Date: Tue Mar 23 2004 - 05:34:12 EST


On Tue, Mar 23, 2004 at 11:09:33AM +0100, Christof wrote:
> To make the story short: I see a lot of garbage on the LCD.
> It looks like output would be buffered and all data would be sent at
> once without giving me the possibility to check if everything's
> allright. Sometimes I can send >400 Bytes and ioctl says that CTS is not
> asserted, altough it certainly is.

It probably isn't, at the time you check it. When you write a byte,
the call will generally return immediately because it'll be placed in
a buffer. Transmission has only just started, and you then go and check
the CTS line. Repeat multiple times on a slow enough baud rate, and
you'll end up queueing a lot of bytes.

You could write a byte, wait for it to complete by calling ioctl(TCSETSW)
without changing any parameters, and then read the CTS status.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/