A.1. Flow control in Linux kernel

The Linux kernel can be asked to do CTS/RTS flow control using the r option on the console= parameter. For example, a serial link at 9600bps with 8 data bits, no parity and CTS/RTS flow control is configured as shown in Figure A-1.

Figure A-1. A kernel console parameter with CTS/RTS flow control

console=9600n8r

Because the Linux kernel only ever sends data, CTS/RTS flow control is implemented by checking that Clear to Send is not asserted. The code which does is found in /usr/src/linux/drivers/char/serial.c, the relevant portion can be seen in Figure A-2.

Figure A-2. Kernel source code for console CTS/RTS flow control

static inline void wait_for_xmitr(struct async_struct *info)
{
…
  /* Wait for flow control if necessary */
  if (info->flags & ASYNC_CONS_FLOW) {
    tmout = 1000000;
    while (--tmout &&
           ((serial_in(info, UART_MSR) & UART_MSR_CTS) == 0));
  }       
}

The loop driven by the tmout value of 1000000 results in a wait of about one second for the CTS line to become asserted.

This code ignores the status of the RS-232 Data Set Ready and Data Carrier Detect status lines. This has a number of consequences.

As a result of these bugs this HOWTO no longer recommends the use of kernel-level flow control. The author has a kernel patch which fixes all current-reported bugs and is attempting to get that patch integrated into the mainline kernel. Once the kernel bugs are corrected this HOWTO will once again recommend kernel-level flow control.

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:34