[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] serial line
From: |
Diego Roversi |
Subject: |
[patch] serial line |
Date: |
Fri, 12 Oct 2001 22:05:26 +0200 |
User-agent: |
Mutt/1.2.5i |
Hello,
the first patch allow programs to set the serial line speed at 57600 and
115200.
diff -ur hurd-20010817/term/devio.c hurd-20010817.new/term/devio.c
--- hurd-20010817/term/devio.c Sat Mar 18 19:37:21 2000
+++ hurd-20010817.new/term/devio.c Sat Oct 6 11:50:58 2001
@@ -164,10 +164,16 @@
*bspeed = B9600;
break;
case 19200:
- *bspeed = EXTA;
+ *bspeed = B19200;
break;
case 38400:
- *bspeed = EXTB;
+ *bspeed = B38400;
+ break;
+ case 57600:
+ *bspeed = B57600;
+ break;
+ case 115200:
+ *bspeed = B115200;
break;
default:
return -1;
@@ -210,10 +216,15 @@
return 4800;
case B9600:
return 9600;
- case EXTA:
+ case B19200:
return 19200;
- case EXTB:
+ case B38400:
return 38400;
+ case B57600:
+ return 57600;
+ case B115200:
+ return 115200;
+
}
}
The second patch is quite experimental, and allow to transfer at high speed
continuisly without loosing data. There is still two problems: the first one
is that sometime sending data block after about 30k-40k of sustained
transfert. Receiving works fine. The second one is that I don't know exactly
why my patch improves serial line handling. BTW this is the patch:
diff -ur gnumach-20010918/device/chario.c gnumach-20010918.new/device/chario.c
--- gnumach-20010918/device/chario.c Sun Apr 29 22:26:01 2001
+++ gnumach-20010918.new/device/chario.c Tue Oct 9 22:45:58 2001
@@ -122,8 +122,8 @@
pdma_timeouts[B2400] = _PR(240);
pdma_timeouts[B4800] = _PR(480);
pdma_timeouts[B9600] = _PR(960);
- pdma_timeouts[EXTA] = _PR(1440); /* >14400 baud */
- pdma_timeouts[EXTB] = _PR(1920); /* >19200 baud */
+ pdma_timeouts[B19200] = _PR(1920); /* >14400 baud */
+ pdma_timeouts[B38400] = _PR(3840); /* >19200 baud */
pdma_timeouts[B57600] = _PR(5760);
pdma_timeouts[B115200] = _PR(11520);
@@ -143,13 +143,23 @@
pdma_water_mark[B1800] = _PR(180);
pdma_water_mark[B2400] = _PR(240);
pdma_water_mark[B4800] = _PR(480);
+ pdma_water_mark[B9600] = _PR(960);
+ pdma_water_mark[B19200] = _PR(1920);
+#undef _PR
+#define _PR(X) (0.10 * X)
+ pdma_water_mark[B38400] = 192;
+ pdma_water_mark[B57600] = 96;
+ pdma_water_mark[B115200] = 64;
+
+#if 0
i = tty_inq_size/2;
pdma_water_mark[B9600] = i;
pdma_water_mark[EXTA] = i; /* >14400 baud */
pdma_water_mark[EXTB] = i; /* >19200 baud */
pdma_water_mark[B57600] = i;
pdma_water_mark[B115200] = i;
-
+#endif
+
return;
}
I don't understand what is this pdma stuff (serial port usualy don'use dma
on PC), but IHMO water_mark is how much incoming data is collected before
being processed. I don't understand why water_mark must decrease at higher
speed. BTW the values for speed of 38400 or greater was found out with some
experiments.
That's all for the moment...
--
Saluti / Regards
Diego Roversi | diegor at maganet.net
| diegor at tiscalinet.it
- [patch] serial line,
Diego Roversi <=