* [Patch] new serial flow control
@ 2004-10-04 22:54 Samuel Thibault
2004-10-04 22:55 ` Samuel Thibault
0 siblings, 1 reply; 21+ messages in thread
From: Samuel Thibault @ 2004-10-04 22:54 UTC (permalink / raw)
To: rmk; +Cc: linux-kernel, sebastien.hinderer
[-- Attachment #1: Type: text/plain, Size: 977 bytes --]
Hi,
Some Visiobraille braille terminals (TVB) need a peculiar serial flow
control:
- There is no flow control for the PC -> device way (yes, oddly enough)
- For the device -> PC way,
* RTS must be kept low, the device keeps CTS low as well.
* when the device wants to send data, it raises CTS. RTS must
be raised as well. Data can then pass, CTS and RTS are lowered.
We tried to implement that in user space, with ioctl(TIOCMBIS) & al, but
the responsiveness is too low: RTS is not raised soon enough, and the
device aborts transmission.
Here is a patch for 2.4, a 2.6 patch is coming in another mail. It
defines a CTVB flag the same way CRTSCTS is defined, letting user
space choose whether to use it or not (better ideas for the name
are welcome). This makes the device work perfectly (even better than
shipped drivers for DOS).
Applying it to vanilla kernel would be a real good thing for people
having such costly and useful hardware.
Regards,
Samuel Thibault
[-- Attachment #2: tvbpatch-2.4 --]
[-- Type: text/plain, Size: 14335 bytes --]
diff -urp linux-2.4.26-orig/drivers/char/serial.c linux-2.4.26-tvb/drivers/char/serial.c
--- linux-2.4.26-orig/drivers/char/serial.c 2004-02-18 14:59:55.000000000 +0100
+++ linux-2.4.26-tvb/drivers/char/serial.c 2004-08-18 00:48:39.000000000 +0200
@@ -789,6 +789,26 @@ static _INLINE_ void check_modem_status(
serial_out(info, UART_IER, info->IER);
}
}
+ } else if (info->flags & ASYNC_TVB_FLOW) {
+ if (status & UART_MSR_CTS) {
+ if (!(info->MCR & UART_MCR_RTS)) {
+ /* start of TVB frame, raise RTS to greet data */
+ info->MCR |= UART_MCR_RTS;
+ serial_out(info, UART_MCR, info->MCR);
+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
+ printk("TVB frame start...");
+#endif
+ }
+ } else {
+ if (info->MCR & UART_MCR_RTS) {
+ /* CTS went down, lower RTS as well */
+ info->MCR &= ~UART_MCR_RTS;
+ serial_out(info, UART_MCR, info->MCR);
+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
+ printk("TVB frame started...");
+#endif
+ }
+ }
}
}
@@ -1393,7 +1413,8 @@ static int startup(struct async_struct *
info->MCR = 0;
if (info->tty->termios->c_cflag & CBAUD)
- info->MCR = UART_MCR_DTR | UART_MCR_RTS;
+ info->MCR = UART_MCR_DTR |
+ (info->flags & ASYNC_TVB_FLOW ? 0 : UART_MCR_RTS);
#ifdef CONFIG_SERIAL_MANY_PORTS
if (info->flags & ASYNC_FOURPORT) {
if (state->irq == 0)
@@ -1752,8 +1773,12 @@ static void change_speed(struct async_st
if (cflag & CRTSCTS) {
info->flags |= ASYNC_CTS_FLOW;
info->IER |= UART_IER_MSI;
- } else
- info->flags &= ~ASYNC_CTS_FLOW;
+ } else if (cflag & CTVB) {
+ info->flags |= ASYNC_TVB_FLOW;
+ info->IER |= UART_IER_MSI;
+ } else {
+ info->flags &= ~(ASYNC_CTS_FLOW|ASYNC_TVB_FLOW);
+ }
if (cflag & CLOCAL)
info->flags &= ~ASYNC_CHECK_CD;
else {
@@ -3057,7 +3082,8 @@ static int block_til_ready(struct tty_st
(tty->termios->c_cflag & CBAUD))
serial_out(info, UART_MCR,
serial_inp(info, UART_MCR) |
- (UART_MCR_DTR | UART_MCR_RTS));
+ (UART_MCR_DTR |
+ (tty->termios->c_cflag & CTVB ? 0 : UART_MCR_RTS)));
restore_flags(flags);
set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) ||
diff -urp linux-2.4.26-orig/include/asm-alpha/termbits.h linux-2.4.26-tvb/include/asm-alpha/termbits.h
--- linux-2.4.26-orig/include/asm-alpha/termbits.h 1999-01-08 20:11:45.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-alpha/termbits.h 2004-08-18 00:10:30.000000000 +0200
@@ -150,6 +150,7 @@ struct termios {
#define HUPCL 00040000
#define CLOCAL 00100000
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CRTSCTS 020000000000 /* flow control */
/* c_lflag bits */
diff -urp linux-2.4.26-orig/include/asm-arm/termbits.h linux-2.4.26-tvb/include/asm-arm/termbits.h
--- linux-2.4.26-orig/include/asm-arm/termbits.h 2000-08-13 18:54:15.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-arm/termbits.h 2004-08-18 00:10:52.000000000 +0200
@@ -131,6 +131,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-cris/termbits.h linux-2.4.26-tvb/include/asm-cris/termbits.h
--- linux-2.4.26-orig/include/asm-cris/termbits.h 2003-08-27 20:53:15.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-cris/termbits.h 2004-08-18 00:10:56.000000000 +0200
@@ -126,6 +126,7 @@ struct termios {
#define B1843200 0010006
#define B6250000 0010007
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity, PARODD => mark parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-i386/termbits.h linux-2.4.26-tvb/include/asm-i386/termbits.h
--- linux-2.4.26-orig/include/asm-i386/termbits.h 2000-01-21 01:05:26.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-i386/termbits.h 2004-08-18 00:11:00.000000000 +0200
@@ -133,6 +133,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-ia64/termbits.h linux-2.4.26-tvb/include/asm-ia64/termbits.h
--- linux-2.4.26-orig/include/asm-ia64/termbits.h 2004-07-18 11:55:30.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-ia64/termbits.h 2004-08-18 00:11:02.000000000 +0200
@@ -142,6 +142,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-m68k/termbits.h linux-2.4.26-tvb/include/asm-m68k/termbits.h
--- linux-2.4.26-orig/include/asm-m68k/termbits.h 1999-01-08 20:11:45.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-m68k/termbits.h 2004-08-18 00:11:06.000000000 +0200
@@ -134,6 +134,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-mips/termbits.h linux-2.4.26-tvb/include/asm-mips/termbits.h
--- linux-2.4.26-orig/include/asm-mips/termbits.h 2001-09-09 19:43:01.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-mips/termbits.h 2004-08-18 00:11:09.000000000 +0200
@@ -161,6 +161,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-mips64/termbits.h linux-2.4.26-tvb/include/asm-mips64/termbits.h
--- linux-2.4.26-orig/include/asm-mips64/termbits.h 2001-09-09 19:43:02.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-mips64/termbits.h 2004-08-18 00:11:12.000000000 +0200
@@ -163,6 +163,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-parisc/termbits.h linux-2.4.26-tvb/include/asm-parisc/termbits.h
--- linux-2.4.26-orig/include/asm-parisc/termbits.h 2000-12-05 21:29:39.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-parisc/termbits.h 2004-08-18 00:12:01.000000000 +0200
@@ -134,6 +134,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-ppc/termbits.h linux-2.4.26-tvb/include/asm-ppc/termbits.h
--- linux-2.4.26-orig/include/asm-ppc/termbits.h 2003-06-14 02:30:26.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-ppc/termbits.h 2004-08-18 00:11:20.000000000 +0200
@@ -146,6 +146,7 @@ struct termios {
#define HUPCL 00040000
#define CLOCAL 00100000
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CRTSCTS 020000000000 /* flow control */
/* c_lflag bits */
diff -urp linux-2.4.26-orig/include/asm-ppc64/termbits.h linux-2.4.26-tvb/include/asm-ppc64/termbits.h
--- linux-2.4.26-orig/include/asm-ppc64/termbits.h 2002-08-03 23:05:34.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-ppc64/termbits.h 2004-08-18 00:11:22.000000000 +0200
@@ -154,6 +154,7 @@ struct termios {
#define HUPCL 00040000
#define CLOCAL 00100000
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CRTSCTS 020000000000 /* flow control */
/* c_lflag bits */
diff -urp linux-2.4.26-orig/include/asm-s390/termbits.h linux-2.4.26-tvb/include/asm-s390/termbits.h
--- linux-2.4.26-orig/include/asm-s390/termbits.h 2000-05-12 20:41:44.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-s390/termbits.h 2004-08-18 00:11:25.000000000 +0200
@@ -141,6 +141,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-s390x/termbits.h linux-2.4.26-tvb/include/asm-s390x/termbits.h
--- linux-2.4.26-orig/include/asm-s390x/termbits.h 2001-02-13 23:13:44.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-s390x/termbits.h 2004-08-18 00:11:28.000000000 +0200
@@ -141,6 +141,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-sh/termbits.h linux-2.4.26-tvb/include/asm-sh/termbits.h
--- linux-2.4.26-orig/include/asm-sh/termbits.h 1999-10-18 20:16:13.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-sh/termbits.h 2004-08-18 00:11:30.000000000 +0200
@@ -133,6 +133,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-sh64/termbits.h linux-2.4.26-tvb/include/asm-sh64/termbits.h
--- linux-2.4.26-orig/include/asm-sh64/termbits.h 2003-08-27 20:53:26.000000000 +0200
+++ linux-2.4.26-tvb/include/asm-sh64/termbits.h 2004-08-18 00:11:32.000000000 +0200
@@ -144,6 +144,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-sparc/termbits.h linux-2.4.26-tvb/include/asm-sparc/termbits.h
--- linux-2.4.26-orig/include/asm-sparc/termbits.h 2002-11-29 13:24:06.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-sparc/termbits.h 2004-08-18 00:12:23.000000000 +0200
@@ -173,6 +173,7 @@ struct termios {
#define B3500000 0x00001012
#define B4000000 0x00001013 */
#define CIBAUD 0x100f0000 /* input baud rate (not used) */
+#define CTVB 0x20000000 /* VisioBraille Terminal flow control */
#define CMSPAR 0x40000000 /* mark or space (stick) parity */
#define CRTSCTS 0x80000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-sparc64/termbits.h linux-2.4.26-tvb/include/asm-sparc64/termbits.h
--- linux-2.4.26-orig/include/asm-sparc64/termbits.h 2002-11-29 13:24:06.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-sparc64/termbits.h 2004-08-18 00:12:36.000000000 +0200
@@ -174,6 +174,7 @@ struct termios {
#define B3500000 0x00001012
#define B4000000 0x00001013 */
#define CIBAUD 0x100f0000 /* input baud rate (not used) */
+#define CTVB 0x20000000 /* VisioBraille Terminal flow control */
#define CMSPAR 0x40000000 /* mark or space (stick) parity */
#define CRTSCTS 0x80000000 /* flow control */
diff -urp linux-2.4.26-orig/include/asm-x86_64/termbits.h linux-2.4.26-tvb/include/asm-x86_64/termbits.h
--- linux-2.4.26-orig/include/asm-x86_64/termbits.h 2002-11-29 13:24:06.000000000 +0100
+++ linux-2.4.26-tvb/include/asm-x86_64/termbits.h 2004-08-18 00:13:11.000000000 +0200
@@ -133,6 +133,7 @@ struct termios {
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -urp linux-2.4.26-orig/include/linux/serial.h linux-2.4.26-tvb/include/linux/serial.h
--- linux-2.4.26-orig/include/linux/serial.h 2004-07-18 12:05:46.000000000 +0200
+++ linux-2.4.26-tvb/include/linux/serial.h 2004-08-18 00:34:20.000000000 +0200
@@ -141,7 +141,8 @@ struct serial_uart_config {
#define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */
#define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */
-#define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */
+#define ASYNC_TVB_FLOW 0x00200000 /* Do VisioBraille flow control */
+#define ASYNC_INTERNAL_FLAGS 0xFFE00000 /* Internal flags */
/*
* Multiport serial configuration structure --- external structure
diff -urp linux-2.4.26-orig/include/linux/tty.h linux-2.4.26-tvb/include/linux/tty.h
--- linux-2.4.26-orig/include/linux/tty.h 2004-07-18 12:05:17.000000000 +0200
+++ linux-2.4.26-tvb/include/linux/tty.h 2004-08-18 00:23:37.000000000 +0200
@@ -224,6 +224,7 @@ struct tty_flip_buffer {
#define C_HUPCL(tty) _C_FLAG((tty),HUPCL)
#define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL)
#define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD)
+#define C_CTVB(tty) _C_FLAG((tty),CTVB)
#define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS)
#define L_ISIG(tty) _L_FLAG((tty),ISIG)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-04 22:54 Samuel Thibault
@ 2004-10-04 22:55 ` Samuel Thibault
2004-10-05 22:51 ` Alan Cox
0 siblings, 1 reply; 21+ messages in thread
From: Samuel Thibault @ 2004-10-04 22:55 UTC (permalink / raw)
To: rmk; +Cc: linux-kernel, sebastien.hinderer
[-- Attachment #1: Type: text/plain, Size: 22 bytes --]
Here is patch for 2.6
[-- Attachment #2: tvbpatch-2.6 --]
[-- Type: text/plain, Size: 16089 bytes --]
diff -ur linux-2.6.8.1-orig/drivers/serial/serial_core.c linux-2.6.8.1-tvb/drivers/serial/serial_core.c
--- linux-2.6.8.1-orig/drivers/serial/serial_core.c 2004-08-14 12:54:51.000000000 +0200
+++ linux-2.6.8.1-tvb/drivers/serial/serial_core.c 2004-09-30 00:36:27.000000000 +0200
@@ -118,23 +118,6 @@
}
}
-static inline void
-uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
-{
- unsigned long flags;
- unsigned int old;
-
- spin_lock_irqsave(&port->lock, flags);
- old = port->mctrl;
- port->mctrl = (old & ~clear) | set;
- if (old != port->mctrl)
- port->ops->set_mctrl(port, port->mctrl);
- spin_unlock_irqrestore(&port->lock, flags);
-}
-
-#define uart_set_mctrl(port,set) uart_update_mctrl(port,set,0)
-#define uart_clear_mctrl(port,clear) uart_update_mctrl(port,0,clear)
-
/*
* Startup the port. This will be called once per open. All calls
* will be serialised by the per-port semaphore.
@@ -187,8 +170,13 @@
* Setup the RTS and DTR signals once the
* port is open and ready to respond.
*/
- if (info->tty->termios->c_cflag & CBAUD)
- uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
+ if (info->tty->termios->c_cflag & CBAUD) {
+ uart_set_mctrl(port, TIOCM_DTR);
+ if (info->tty->termios->c_cflag & CTVB)
+ uart_clear_mctrl(port, TIOCM_RTS);
+ else
+ uart_set_mctrl(port, TIOCM_RTS);
+ }
}
info->flags |= UIF_INITIALIZED;
@@ -434,6 +422,11 @@
else
state->info->flags &= ~UIF_CTS_FLOW;
+ if (termios->c_cflag & CTVB)
+ state->info->flags |= UIF_TVB_FLOW;
+ else
+ state->info->flags &= ~UIF_TVB_FLOW;
+
if (termios->c_cflag & CLOCAL)
state->info->flags &= ~UIF_CHECK_CD;
else
@@ -1180,8 +1173,8 @@
/* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
unsigned int mask = TIOCM_DTR;
- if (!(cflag & CRTSCTS) ||
- !test_bit(TTY_THROTTLED, &tty->flags))
+ if (!(cflag & CTVB) && (!(cflag & CRTSCTS) ||
+ !test_bit(TTY_THROTTLED, &tty->flags)))
mask |= TIOCM_RTS;
uart_set_mctrl(state->port, mask);
}
@@ -1419,8 +1412,13 @@
/*
* And finally enable the RTS and DTR signals.
*/
- if (tty->termios->c_cflag & CBAUD)
- uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
+ if (tty->termios->c_cflag & CBAUD) {
+ uart_set_mctrl(port, TIOCM_DTR);
+ if (tty->termios->c_cflag & CTVB)
+ uart_clear_mctrl(port,TIOCM_RTS);
+ else
+ uart_set_mctrl(port,TIOCM_RTS);
+ }
}
}
diff -ur linux-2.6.8.1-orig/include/asm-alpha/termbits.h linux-2.6.8.1-tvb/include/asm-alpha/termbits.h
--- linux-2.6.8.1-orig/include/asm-alpha/termbits.h 2004-08-14 12:55:35.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-alpha/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -148,6 +148,7 @@
#define HUPCL 00040000
#define CLOCAL 00100000
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CRTSCTS 020000000000 /* flow control */
/* c_lflag bits */
diff -ur linux-2.6.8.1-orig/include/asm-arm/termbits.h linux-2.6.8.1-tvb/include/asm-arm/termbits.h
--- linux-2.6.8.1-orig/include/asm-arm/termbits.h 2004-08-14 12:56:24.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-arm/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -132,6 +132,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-arm26/termbits.h linux-2.6.8.1-tvb/include/asm-arm26/termbits.h
--- linux-2.6.8.1-orig/include/asm-arm26/termbits.h 2004-08-14 12:55:35.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-arm26/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -132,6 +132,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-cris/termbits.h linux-2.6.8.1-tvb/include/asm-cris/termbits.h
--- linux-2.6.8.1-orig/include/asm-cris/termbits.h 2004-08-14 12:54:50.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-cris/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -108,9 +108,10 @@
* 10 987 654 321 098 765 432 109 876 543 210
* | || || CIBAUD, IBSHIFT=16
* ibaud
+ * |CTVB
* |CMSPAR
* | CRTSCTS
- * x x xxx xxx x x xx Free bits
+ * x xxx xxx x x xx Free bits
*/
#define CBAUD 0010017
@@ -159,6 +160,7 @@
* shifted left IBSHIFT bits.
*/
#define IBSHIFT 16
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity - PARODD=space*/
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-h8300/termbits.h linux-2.6.8.1-tvb/include/asm-h8300/termbits.h
--- linux-2.6.8.1-orig/include/asm-h8300/termbits.h 2004-08-14 12:56:24.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-h8300/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -135,6 +135,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-i386/termbits.h linux-2.6.8.1-tvb/include/asm-i386/termbits.h
--- linux-2.6.8.1-orig/include/asm-i386/termbits.h 2004-08-14 12:56:25.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-i386/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -134,6 +134,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-ia64/termbits.h linux-2.6.8.1-tvb/include/asm-ia64/termbits.h
--- linux-2.6.8.1-orig/include/asm-ia64/termbits.h 2004-08-14 12:55:35.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-ia64/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -143,6 +143,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-m68k/termbits.h linux-2.6.8.1-tvb/include/asm-m68k/termbits.h
--- linux-2.6.8.1-orig/include/asm-m68k/termbits.h 2004-08-14 12:56:23.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-m68k/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -135,6 +135,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-mips/termbits.h linux-2.6.8.1-tvb/include/asm-mips/termbits.h
--- linux-2.6.8.1-orig/include/asm-mips/termbits.h 2004-08-14 12:54:49.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-mips/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -164,6 +164,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-parisc/termbits.h linux-2.6.8.1-tvb/include/asm-parisc/termbits.h
--- linux-2.6.8.1-orig/include/asm-parisc/termbits.h 2004-08-14 12:55:33.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-parisc/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -135,6 +135,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-ppc/termbits.h linux-2.6.8.1-tvb/include/asm-ppc/termbits.h
--- linux-2.6.8.1-orig/include/asm-ppc/termbits.h 2004-08-14 12:55:34.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-ppc/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -147,6 +147,7 @@
#define HUPCL 00040000
#define CLOCAL 00100000
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CRTSCTS 020000000000 /* flow control */
/* c_lflag bits */
diff -ur linux-2.6.8.1-orig/include/asm-ppc64/termbits.h linux-2.6.8.1-tvb/include/asm-ppc64/termbits.h
--- linux-2.6.8.1-orig/include/asm-ppc64/termbits.h 2004-08-14 12:55:35.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-ppc64/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -155,6 +155,7 @@
#define HUPCL 00040000
#define CLOCAL 00100000
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CRTSCTS 020000000000 /* flow control */
/* c_lflag bits */
diff -ur linux-2.6.8.1-orig/include/asm-s390/termbits.h linux-2.6.8.1-tvb/include/asm-s390/termbits.h
--- linux-2.6.8.1-orig/include/asm-s390/termbits.h 2004-08-14 12:56:01.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-s390/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -142,6 +142,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-sh/termbits.h linux-2.6.8.1-tvb/include/asm-sh/termbits.h
--- linux-2.6.8.1-orig/include/asm-sh/termbits.h 2004-08-14 12:54:51.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-sh/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -134,6 +134,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-sparc/termbits.h linux-2.6.8.1-tvb/include/asm-sparc/termbits.h
--- linux-2.6.8.1-orig/include/asm-sparc/termbits.h 2004-08-14 12:55:59.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-sparc/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -174,6 +174,7 @@
#define B3500000 0x00001012
#define B4000000 0x00001013 */
#define CIBAUD 0x100f0000 /* input baud rate (not used) */
+#define CTVB 0x20000000 /* VisioBraille Terminal flow control */
#define CMSPAR 0x40000000 /* mark or space (stick) parity */
#define CRTSCTS 0x80000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-sparc64/termbits.h linux-2.6.8.1-tvb/include/asm-sparc64/termbits.h
--- linux-2.6.8.1-orig/include/asm-sparc64/termbits.h 2004-08-14 12:54:51.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-sparc64/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -175,6 +175,7 @@
#define B3500000 0x00001012
#define B4000000 0x00001013 */
#define CIBAUD 0x100f0000 /* input baud rate (not used) */
+#define CTVB 0x20000000 /* VisioBraille Terminal flow control */
#define CMSPAR 0x40000000 /* mark or space (stick) parity */
#define CRTSCTS 0x80000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-v850/termbits.h linux-2.6.8.1-tvb/include/asm-v850/termbits.h
--- linux-2.6.8.1-orig/include/asm-v850/termbits.h 2004-08-14 12:54:47.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-v850/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -135,6 +135,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/asm-x86_64/termbits.h linux-2.6.8.1-tvb/include/asm-x86_64/termbits.h
--- linux-2.6.8.1-orig/include/asm-x86_64/termbits.h 2004-08-14 12:54:48.000000000 +0200
+++ linux-2.6.8.1-tvb/include/asm-x86_64/termbits.h 2004-09-30 00:36:27.000000000 +0200
@@ -134,6 +134,7 @@
#define B3500000 0010016
#define B4000000 0010017
#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CTVB 004000000000 /* VisioBraille Terminal flow control */
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
diff -ur linux-2.6.8.1-orig/include/linux/serial_core.h linux-2.6.8.1-tvb/include/linux/serial_core.h
--- linux-2.6.8.1-orig/include/linux/serial_core.h 2004-08-14 12:54:50.000000000 +0200
+++ linux-2.6.8.1-tvb/include/linux/serial_core.h 2004-09-30 00:41:25.000000000 +0200
@@ -264,6 +264,7 @@
*/
#define UIF_CHECK_CD (1 << 25)
#define UIF_CTS_FLOW (1 << 26)
+#define UIF_TVB_FLOW (1 << 21)
#define UIF_NORMAL_ACTIVE (1 << 29)
#define UIF_INITIALIZED (1 << 31)
@@ -375,6 +376,23 @@
#define uart_handle_sysrq_char(port,ch,regs) (0)
#endif
+static inline void
+uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
+{
+ unsigned long flags;
+ unsigned int old;
+
+ spin_lock_irqsave(&port->lock, flags);
+ old = port->mctrl;
+ port->mctrl = (old & ~clear) | set;
+ if (old != port->mctrl)
+ port->ops->set_mctrl(port, port->mctrl);
+ spin_unlock_irqrestore(&port->lock, flags);
+}
+
+#define uart_set_mctrl(port,set) uart_update_mctrl(port,set,0)
+#define uart_clear_mctrl(port,clear) uart_update_mctrl(port,0,clear)
+
/*
* We do the SysRQ and SAK checking like this...
*/
@@ -446,6 +464,11 @@
port->ops->stop_tx(port, 0);
}
}
+ } else if (info->flags & UIF_TVB_FLOW) {
+ if (status)
+ uart_set_mctrl(port, TIOCM_RTS);
+ else
+ uart_clear_mctrl(port, TIOCM_RTS);
}
}
@@ -454,6 +477,7 @@
*/
#define UART_ENABLE_MS(port,cflag) ((port)->flags & UPF_HARDPPS_CD || \
(cflag) & CRTSCTS || \
+ (cflag) & CTVB || \
!((cflag) & CLOCAL))
#endif
diff -ur linux-2.6.8.1-orig/include/linux/serial.h linux-2.6.8.1-tvb/include/linux/serial.h
--- linux-2.6.8.1-orig/include/linux/serial.h 2004-08-14 12:54:51.000000000 +0200
+++ linux-2.6.8.1-tvb/include/linux/serial.h 2004-09-30 00:36:27.000000000 +0200
@@ -141,7 +141,8 @@
#define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */
#define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */
-#define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */
+#define ASYNC_TVB_FLOW 0x00200000 /* Do VisioBraille flow control */
+#define ASYNC_INTERNAL_FLAGS 0xFFE00000 /* Internal flags */
/*
* Multiport serial configuration structure --- external structure
diff -ur linux-2.6.8.1-orig/include/linux/tty.h linux-2.6.8.1-tvb/include/linux/tty.h
--- linux-2.6.8.1-orig/include/linux/tty.h 2004-08-14 12:55:32.000000000 +0200
+++ linux-2.6.8.1-tvb/include/linux/tty.h 2004-09-30 00:36:27.000000000 +0200
@@ -210,6 +210,7 @@
#define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL)
#define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD)
#define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS)
+#define C_TVB(tty) _C_FLAG((tty),CTVB)
#define L_ISIG(tty) _L_FLAG((tty),ISIG)
#define L_ICANON(tty) _L_FLAG((tty),ICANON)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
@ 2004-10-05 16:46 Chuck Ebbert
2004-10-05 17:25 ` Samuel Thibault
0 siblings, 1 reply; 21+ messages in thread
From: Chuck Ebbert @ 2004-10-05 16:46 UTC (permalink / raw)
To: Samuel Thibault; +Cc: linux-kernel, Russell King
Samual Thibault wrote:
>+ } else if (info->flags & ASYNC_TVB_FLOW) {
>+ if (status & UART_MSR_CTS) {
>+ if (!(info->MCR & UART_MCR_RTS)) {
>+ /* start of TVB frame, raise RTS to greet data */
>+ info->MCR |= UART_MCR_RTS;
>+ serial_out(info, UART_MCR, info->MCR);
>+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
>+ printk("TVB frame start...");
>+#endif
>+ }
>+ } else {
>+ if (info->MCR & UART_MCR_RTS) {
>+ /* CTS went down, lower RTS as well */
>+ info->MCR &= ~UART_MCR_RTS;
>+ serial_out(info, UART_MCR, info->MCR);
>+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
>+ printk("TVB frame started...");
>+#endif
^^^^^^^
Shouldn't this be "ended"? ... or "end" since frame begin msg says "start"
i.e. is not past tense?
--Chuck Ebbert
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-05 16:46 [Patch] new serial flow control Chuck Ebbert
@ 2004-10-05 17:25 ` Samuel Thibault
2004-10-07 19:08 ` Alan Cox
0 siblings, 1 reply; 21+ messages in thread
From: Samuel Thibault @ 2004-10-05 17:25 UTC (permalink / raw)
To: Chuck Ebbert; +Cc: linux-kernel, Russell King, sebastien.hinderer
Le mar 05 oct 2004 à 12:46:34 -0400, Chuck Ebbert a tapoté sur son clavier :
> Samual Thibault wrote:
>
> >+ } else if (info->flags & ASYNC_TVB_FLOW) {
> >+ if (status & UART_MSR_CTS) {
> >+ if (!(info->MCR & UART_MCR_RTS)) {
> >+ /* start of TVB frame, raise RTS to greet data */
> >+ info->MCR |= UART_MCR_RTS;
> >+ serial_out(info, UART_MCR, info->MCR);
> >+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
> >+ printk("TVB frame start...");
> >+#endif
> >+ }
> >+ } else {
> >+ if (info->MCR & UART_MCR_RTS) {
> >+ /* CTS went down, lower RTS as well */
> >+ info->MCR &= ~UART_MCR_RTS;
> >+ serial_out(info, UART_MCR, info->MCR);
> >+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
> >+ printk("TVB frame started...");
> >+#endif
> ^^^^^^^
>
> Shouldn't this be "ended"? ... or "end" since frame begin msg says "start"
> i.e. is not past tense?
No: data actually pass _after_ CTS and RTS are lowered back: the flow control
only indicate the beginning of one frame.
Regards,
Samuel Thibault
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-04 22:55 ` Samuel Thibault
@ 2004-10-05 22:51 ` Alan Cox
2004-10-06 7:11 ` Sébastien Hinderer
0 siblings, 1 reply; 21+ messages in thread
From: Alan Cox @ 2004-10-05 22:51 UTC (permalink / raw)
To: Samuel Thibault; +Cc: rmk, Linux Kernel Mailing List, sebastien.hinderer
On Llu, 2004-10-04 at 23:55, Samuel Thibault wrote:
> Here is patch for 2.6
How is this different from CRTSCTS ?
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-05 22:51 ` Alan Cox
@ 2004-10-06 7:11 ` Sébastien Hinderer
2004-10-06 7:38 ` Samuel Thibault
0 siblings, 1 reply; 21+ messages in thread
From: Sébastien Hinderer @ 2004-10-06 7:11 UTC (permalink / raw)
To: Alan Cox; +Cc: Samuel Thibault, rmk, Linux Kernel Mailing List
> > Here is patch for 2.6
>
> How is this different from CRTSCTS ?
I'd say it is symmetric. I think the roles of RTS and CTS are exchanged.
Sam, am I right ?
Sébastien.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-06 7:11 ` Sébastien Hinderer
@ 2004-10-06 7:38 ` Samuel Thibault
2004-10-06 13:29 ` Alan Cox
0 siblings, 1 reply; 21+ messages in thread
From: Samuel Thibault @ 2004-10-06 7:38 UTC (permalink / raw)
To: Sébastien Hinderer; +Cc: Alan Cox, rmk, Linux Kernel Mailing List
Le mer 06 oct 2004 à 09:11:10 +0200, Sébastien Hinderer a tapoté sur son clavier :
> > > Here is patch for 2.6
> >
> > How is this different from CRTSCTS ?
>
> I'd say it is symmetric. I think the roles of RTS and CTS are exchanged.
> Sam, am I right ?
No: CRTSCTS is a one-signal-for-each-way flow control: each
side of the link tells whether it can receive data. CTVB is a
two-signals-for-only-one-way flow control: the device tells when it
wants to send data, the PC acknowledges that, and then one frame of
data can pass.
Regards,
Samuel Thibault
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-06 7:38 ` Samuel Thibault
@ 2004-10-06 13:29 ` Alan Cox
2004-10-07 1:30 ` Stuart MacDonald
0 siblings, 1 reply; 21+ messages in thread
From: Alan Cox @ 2004-10-06 13:29 UTC (permalink / raw)
To: Samuel Thibault; +Cc: Sébastien Hinderer, rmk, Linux Kernel Mailing List
On Mer, 2004-10-06 at 08:38, Samuel Thibault wrote:
> No: CRTSCTS is a one-signal-for-each-way flow control: each
> side of the link tells whether it can receive data. CTVB is a
> two-signals-for-only-one-way flow control: the device tells when it
> wants to send data, the PC acknowledges that, and then one frame of
> data can pass.
This sounds a lot like RS485 and some other related stuff. I need to
poke my pet async guru and find out if they are the same thing. If so
that would be useful.
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [Patch] new serial flow control
2004-10-06 13:29 ` Alan Cox
@ 2004-10-07 1:30 ` Stuart MacDonald
2004-10-07 1:47 ` Paul Fulghum
2004-10-07 13:00 ` Alan Cox
0 siblings, 2 replies; 21+ messages in thread
From: Stuart MacDonald @ 2004-10-07 1:30 UTC (permalink / raw)
To: 'Alan Cox', 'Samuel Thibault'
Cc: 'Sébastien Hinderer', rmk,
'Linux Kernel Mailing List'
From: Alan Cox
> On Mer, 2004-10-06 at 08:38, Samuel Thibault wrote:
> > No: CRTSCTS is a one-signal-for-each-way flow control: each
> > side of the link tells whether it can receive data. CTVB is a
> > two-signals-for-only-one-way flow control: the device tells when it
> > wants to send data, the PC acknowledges that, and then one frame of
> > data can pass.
>
> This sounds a lot like RS485 and some other related stuff. I need to
> poke my pet async guru and find out if they are the same thing. If so
> that would be useful.
RS485 is a driver-transparent electrical interface. Unfortunately the
half-duplex and master-slave(s) arrangements require some sort of
token passing to know when they can successfully transmit. This is
usually handled by the apps in some manner, although it's often wanted
to be handled by the serial driver. This could be one method of
signalling, but isn't sufficient to show RS485 operation.
I haven't seen this style of flow control before. What uses it?
..Stu
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [Patch] new serial flow control
2004-10-07 1:30 ` Stuart MacDonald
@ 2004-10-07 1:47 ` Paul Fulghum
2004-10-07 7:26 ` Sébastien Hinderer
2004-10-07 13:00 ` Alan Cox
1 sibling, 1 reply; 21+ messages in thread
From: Paul Fulghum @ 2004-10-07 1:47 UTC (permalink / raw)
To: Stuart MacDonald
Cc: 'Alan Cox', 'Samuel Thibault',
'Sébastien Hinderer', rmk,
'Linux Kernel Mailing List'
On Wed, 2004-10-06 at 20:30, Stuart MacDonald wrote:
> RS485 is a driver-transparent electrical interface.
Yes.
This protocol issue is independent of the electrical interface.
> I haven't seen this style of flow control before. What uses it?
terminal visio-braille (TVB)
A device for the sight impaired.
--
Paul Fulghum
paulkf@microgate.com
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 1:47 ` Paul Fulghum
@ 2004-10-07 7:26 ` Sébastien Hinderer
0 siblings, 0 replies; 21+ messages in thread
From: Sébastien Hinderer @ 2004-10-07 7:26 UTC (permalink / raw)
To: Paul Fulghum
Cc: Stuart MacDonald, 'Alan Cox', 'Samuel Thibault',
rmk, 'Linux Kernel Mailing List'
Hi,
> > I haven't seen this style of flow control before. What uses it?
>
> terminal visio-braille (TVB)
> A device for the sight impaired.
Just to give a litle bit more precise information: this braille terminal
has been designed more than 10 years ago by the Handialog socity which is
now part of the TechniBraille/United Vision group.
Modern VisioBra"lles (with Prom of version 4 or higher) support both a
standard serial port management, and this odd flow control which was
originally designed to be used under MS-DOS, and was appropriate for doing
polling.
The integration of Samuel's patch into the kernel would allow users of
teominals containing a PROM older than 4 to use brltty with their terminal,
which would be a very useful thing, because updating such a PROM has a very
high cost.
Sébastien.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
@ 2004-10-07 11:08 Nick Craig-Wood
0 siblings, 0 replies; 21+ messages in thread
From: Nick Craig-Wood @ 2004-10-07 11:08 UTC (permalink / raw)
To: linux-kernel
Stuart MacDonald <stuartm@connecttech.com> wrote:
> From: Alan Cox
> > On Mer, 2004-10-06 at 08:38, Samuel Thibault wrote:
> > > No: CRTSCTS is a one-signal-for-each-way flow control: each
> > > side of the link tells whether it can receive data. CTVB is a
> > > two-signals-for-only-one-way flow control: the device tells when it
> > > wants to send data, the PC acknowledges that, and then one frame of
> > > data can pass.
> >
> > This sounds a lot like RS485 and some other related stuff. I need to
> > poke my pet async guru and find out if they are the same thing. If so
> > that would be useful.
>
> RS485 is a driver-transparent electrical interface.
Yes, in theory! In practice it isn't quite transparent due to
tristating.
These are the 4 main types of serial interface that I use regularly
RS232, RS422, RS485 4-Wire and RS485 2-Wire.
RS232 we all know and love - 12 V signalling etc
RS422 is RS232 with a different electrical interface, ie 5V
differential (2 wires per signal, eg rx+, rx- etc)
RS485 4-Wire is like RS422 but the bus has the potential to go
tri-state. In a bus with only one master, the master can just
transmit all the time and all the slaves will listen. However if you
want to be a slave or have multiple masters it is necessary for you to
tristate the bus.
RS485 2-Wire is like RS485 4-Wire except the transmit and receive
lines are combined into rx_tx+ and rx_tx-. In this kind of bus it is
essential everyone tristates the line after transmitting.
For the RS485 busses there needs to be some way of telling the serial
interface hardware that you want the bus to be tristate. This is
typically done with DTR (which isn't used for RS485 busses), DTR=1
means untristate the bus and DTR=0 means tristate it.
When used like this timing is very critical - you must de-assert DTR
as soon as the serial character has left the serial UART. This is
difficult to do exactly in user-space. Alternatively you can use a
specialist serial interface which will do it for you.
In practice for our applications we use RS485 in master mode which
requires no difficult control. When we have to do RS485 in 2-Wire
mode we transmit a character and block our application to wait for it
to come back then de-assert RTS. Thats nasty though and would be much
better done in the serial driver, where you get an interrupt at
exactly the moment the tx fifo is empty.
> Unfortunately the half-duplex and master-slave(s) arrangements
> require some sort of token passing to know when they can
> successfully transmit.
It does. Its usually done with a packet protocol and addresses.
> This is usually handled by the apps in some manner, although it's
> often wanted to be handled by the serial driver. This could be one
> method of signalling, but isn't sufficient to show RS485 operation.
The tristating above should be done in the driver if possible. The
packet protocol etc should be done in the application.
The flow control method described by the OP doesn't sound exactly like
RS485, but the timing constraints of waggling RTS are exactly the
same.
--
Nick Craig-Wood <nick@craig-wood.com> -- http://www.craig-wood.com/nick
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [Patch] new serial flow control
2004-10-07 1:30 ` Stuart MacDonald
2004-10-07 1:47 ` Paul Fulghum
@ 2004-10-07 13:00 ` Alan Cox
2004-10-07 14:28 ` Samuel Thibault
1 sibling, 1 reply; 21+ messages in thread
From: Alan Cox @ 2004-10-07 13:00 UTC (permalink / raw)
To: Stuart MacDonald
Cc: 'Samuel Thibault', 'Sébastien Hinderer', rmk,
'Linux Kernel Mailing List'
On Iau, 2004-10-07 at 02:30, Stuart MacDonald wrote:
> RS485 is a driver-transparent electrical interface. Unfortunately the
> half-duplex and master-slave(s) arrangements require some sort of
> token passing to know when they can successfully transmit. This is
> usually handled by the apps in some manner, although it's often wanted
> to be handled by the serial driver. This could be one method of
> signalling, but isn't sufficient to show RS485 operation.
No its one I've seen a lot there and it turns out having dug into docs
and consulted the serial people in pointy hats that it is RS232
half-duplex mode which is one of those bits of the spec nobody ever
uses.
In this mode the DTE end (host normally) asserts RTS to request
transmit access to the link. The DCE asserts CTS to indicate it has
finished sending bits, and the DTE then transmits.
RTS is a direction selector (RTS = 0, DCE transmit) (RTS = 1, DTE
transmit). CTS acts as the handshake to deal with the link turn around.
So that makes this much more useful.
Alan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 13:00 ` Alan Cox
@ 2004-10-07 14:28 ` Samuel Thibault
0 siblings, 0 replies; 21+ messages in thread
From: Samuel Thibault @ 2004-10-07 14:28 UTC (permalink / raw)
To: Alan Cox
Cc: Stuart MacDonald, 'Sébastien Hinderer', rmk,
'Linux Kernel Mailing List'
Hi,
Le jeu 07 oct 2004 à 14:00:24 +0100, Alan Cox a tapoté sur son clavier :
> In this mode the DTE end (host normally) asserts RTS to request
> transmit access to the link. The DCE asserts CTS to indicate it has
> finished sending bits, and the DTE then transmits.
>
> RTS is a direction selector (RTS = 0, DCE transmit) (RTS = 1, DTE
> transmit). CTS acts as the handshake to deal with the link turn around.
Hum... It seems like every role is inverted with TVB: _TVB_ raises
_CTS_ to request transmit access. The _PC_ then raises _RTS_ to
indicate it has finished sending bits, TVB then transmits.
(Yes, the cabling is correct: that's the way the DOS driver works)
Regards,
Samuel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-05 17:25 ` Samuel Thibault
@ 2004-10-07 19:08 ` Alan Cox
2004-10-07 20:27 ` Russell King
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Alan Cox @ 2004-10-07 19:08 UTC (permalink / raw)
To: Samuel Thibault
Cc: Chuck Ebbert, Linux Kernel Mailing List, Russell King,
sebastien.hinderer
On Maw, 2004-10-05 at 18:25, Samuel Thibault wrote:
> No: data actually pass _after_ CTS and RTS are lowered back: the flow control
> only indicate the beginning of one frame.
Ok I've pondered this somewhat. I don't think the hack proposed is the
right answer for this. I believe you should implement a simple line
discipline for this device so that it stays out of the general code.
Right now that poses a challenge but if drivers were to implement
ldisc->modem_change() or a similar callback for such events an ldisc
could then handle many of the grungy suprises and handle them once and
in one place.
Thoughts ?
Alan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 19:08 ` Alan Cox
@ 2004-10-07 20:27 ` Russell King
2004-10-07 22:08 ` Samuel Thibault
2004-10-07 21:43 ` Samuel Thibault
2004-10-08 18:59 ` Samuel Thibault
2 siblings, 1 reply; 21+ messages in thread
From: Russell King @ 2004-10-07 20:27 UTC (permalink / raw)
To: Alan Cox
Cc: Samuel Thibault, Chuck Ebbert, Linux Kernel Mailing List,
sebastien.hinderer
On Thu, Oct 07, 2004 at 08:08:56PM +0100, Alan Cox wrote:
> On Maw, 2004-10-05 at 18:25, Samuel Thibault wrote:
> > No: data actually pass _after_ CTS and RTS are lowered back: the flow control
> > only indicate the beginning of one frame.
>
> Ok I've pondered this somewhat. I don't think the hack proposed is the
> right answer for this. I believe you should implement a simple line
> discipline for this device so that it stays out of the general code.
>
> Right now that poses a challenge but if drivers were to implement
> ldisc->modem_change() or a similar callback for such events an ldisc
> could then handle many of the grungy suprises and handle them once and
> in one place.
To me at least that sounds like a good solution. I can't help but
wonder whether moving some of the usual modem line status change
processing should also be moved into the higher levels. This will
probably make more sense if the "block till ready" code also moves,
which I think Ted was considering at one point.
However, that's probably something to think about later.
--
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 19:08 ` Alan Cox
2004-10-07 20:27 ` Russell King
@ 2004-10-07 21:43 ` Samuel Thibault
2004-10-07 22:55 ` Samuel Thibault
2004-10-08 18:59 ` Samuel Thibault
2 siblings, 1 reply; 21+ messages in thread
From: Samuel Thibault @ 2004-10-07 21:43 UTC (permalink / raw)
To: Alan Cox
Cc: Chuck Ebbert, Linux Kernel Mailing List, Russell King,
sebastien.hinderer
Le jeu 07 oct 2004 à 20:08:56 +0100, Alan Cox a écrit:
> Right now that poses a challenge but if drivers were to implement
> ldisc->modem_change() or a similar callback for such events an ldisc
> could then handle many of the grungy suprises and handle them once and
> in one place.
Surprises like regular RTS/CTS flow control ?
Aren't there serial chips that are able to handle it themselves ? (so
that the _serial driver_ should be responsible for that, doing it in
software if needed)
I'm asking because there was some funny bug not that far ago: async
ppp people thought that xon/xoff were processed in the serial driver,
because "some serial chips may be able to handle that themselves". So
they weren't processing them. But actually it's really up to the
ldisc to process them. Thus nobody was processing it !
Regards,
Samuel Thibault
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 20:27 ` Russell King
@ 2004-10-07 22:08 ` Samuel Thibault
2004-10-07 23:10 ` Russell King
0 siblings, 1 reply; 21+ messages in thread
From: Samuel Thibault @ 2004-10-07 22:08 UTC (permalink / raw)
To: Alan Cox, Chuck Ebbert, Linux Kernel Mailing List,
sebastien.hinderer
Le jeu 07 oct 2004 à 21:27:22 +0100, Russell King a écrit:
> I can't help but wonder whether moving some of the usual modem line
> status change processing should also be moved into the higher levels.
The more I'm thinking about it, the more I think it's not a good idea:
that would require *every* line discipline to implement hardware flow
control (just like xon/xoff), while I think they shouldn't really care
about it.
The asynchronous ppp ldisc for instance can be used on a serial line,
but can very well be used on a ssh tunnel (in which case rts/cts flow
control has no meaning).
I can understand that xon/xoff processing be implemented in ldiscs
since it is characters stuff, but one can't ask the ldisc to know
details about hardware flow control which depends on the tty it is
used on.
Regards,
Samuel Thibault
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 21:43 ` Samuel Thibault
@ 2004-10-07 22:55 ` Samuel Thibault
0 siblings, 0 replies; 21+ messages in thread
From: Samuel Thibault @ 2004-10-07 22:55 UTC (permalink / raw)
To: Alan Cox, Chuck Ebbert, Linux Kernel Mailing List, Russell King,
sebastien.hinderer
Le jeu 07 oct 2004 à 23:43:30 +0200, Samuel Thibault a écrit:
> I'm asking because there was some funny bug not that far ago: async
> ppp people thought that xon/xoff were processed in the serial driver,
For some record
http://groups.google.com/groups?threadm=Pine.LNX.4.10.10112042358240.2290-100000@youpi.residence.ens-lyon.fr#link15
and
http://groups.google.com/groups?threadm=Pine.LNX.4.10.10112062257590.1328-100000@youpi.residence.ens-lyon.fr
(google didn't like the subject change)
Regards,
Samuel Thibault
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 22:08 ` Samuel Thibault
@ 2004-10-07 23:10 ` Russell King
0 siblings, 0 replies; 21+ messages in thread
From: Russell King @ 2004-10-07 23:10 UTC (permalink / raw)
To: Alan Cox, Chuck Ebbert, Linux Kernel Mailing List,
sebastien.hinderer
On Fri, Oct 08, 2004 at 12:08:51AM +0200, Samuel Thibault wrote:
> Le jeu 07 oct 2004 à 21:27:22 +0100, Russell King a écrit:
> > I can't help but wonder whether moving some of the usual modem line
> > status change processing should also be moved into the higher levels.
>
> The more I'm thinking about it, the more I think it's not a good idea:
> that would require *every* line discipline to implement hardware flow
> control (just like xon/xoff), while I think they shouldn't really care
> about it.
Please note that I said "into the higher levels" and not "into line
disciplines" - I completely agree with you. For the general case,
line disciplines do not need to know that the CTS signal has been
deasserted, or that DCD has deasserted - these are all meaningless
to the vast majority.
There are special cases though, such as the one being discussed in
this thread, where it does make sense for the line discipline to
override the default behaviour.
--
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Patch] new serial flow control
2004-10-07 19:08 ` Alan Cox
2004-10-07 20:27 ` Russell King
2004-10-07 21:43 ` Samuel Thibault
@ 2004-10-08 18:59 ` Samuel Thibault
2 siblings, 0 replies; 21+ messages in thread
From: Samuel Thibault @ 2004-10-08 18:59 UTC (permalink / raw)
To: Alan Cox
Cc: Chuck Ebbert, Linux Kernel Mailing List, Russell King,
sebastien.hinderer
Le jeu 07 oct 2004 à 20:08:56 +0100, Alan Cox wrote:
> On Maw, 2004-10-05 at 18:25, Samuel Thibault wrote:
> > No: data actually pass _after_ CTS and RTS are lowered back: the flow control
> > only indicate the beginning of one frame.
>
> Ok I've pondered this somewhat. I don't think the hack proposed is the
> right answer for this. I believe you should implement a simple line
> discipline for this device so that it stays out of the general code.
>
> Right now that poses a challenge but if drivers were to implement
> ldisc->modem_change() or a similar callback for such events an ldisc
> could then handle many of the grungy suprises and handle them once and
> in one place.
Serial drivers should then at least (when seeing ldisc->modem_change
!= NULL) do no RTS/CTS/DTR/etc handling at all (to avoid interfering),
and activate "MSI" for calling modem_change in the interrupt handler.
Being able to call port->ops->start/stop_tx by some way will also be
necessary, by grouping
{
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->port;
tty->hw_stopped = 0;
port->ops->start_tx(port, 0);
uart_write_wakeup(port);
}
and its dual in some function for instance.
Regards,
Samuel Thibault
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2004-10-08 19:01 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-05 16:46 [Patch] new serial flow control Chuck Ebbert
2004-10-05 17:25 ` Samuel Thibault
2004-10-07 19:08 ` Alan Cox
2004-10-07 20:27 ` Russell King
2004-10-07 22:08 ` Samuel Thibault
2004-10-07 23:10 ` Russell King
2004-10-07 21:43 ` Samuel Thibault
2004-10-07 22:55 ` Samuel Thibault
2004-10-08 18:59 ` Samuel Thibault
-- strict thread matches above, loose matches on Subject: below --
2004-10-07 11:08 Nick Craig-Wood
2004-10-04 22:54 Samuel Thibault
2004-10-04 22:55 ` Samuel Thibault
2004-10-05 22:51 ` Alan Cox
2004-10-06 7:11 ` Sébastien Hinderer
2004-10-06 7:38 ` Samuel Thibault
2004-10-06 13:29 ` Alan Cox
2004-10-07 1:30 ` Stuart MacDonald
2004-10-07 1:47 ` Paul Fulghum
2004-10-07 7:26 ` Sébastien Hinderer
2004-10-07 13:00 ` Alan Cox
2004-10-07 14:28 ` Samuel Thibault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox