All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] 16550A driver and Moxa card / solved
@ 2007-05-11  9:31 CHABAL David
  2007-05-11  9:08 ` Jan Kiszka
  2007-05-11  9:12 ` Maksym Veremeyenko
  0 siblings, 2 replies; 20+ messages in thread
From: CHABAL David @ 2007-05-11  9:31 UTC (permalink / raw)
  To: xenomai

Hello,

I met some trouble with the 16550A driver provided in Xenomai 2.3.1
and my Moxa cards (PCI / 8 * RS232 / 168U ).

It was a problem of baudrate computation before setting the LCR_DLAB
register.

The formula implemented by the Xenomai driver is different from the one
provided by Moxa. So I copy/paste the formula from the mxser.c file
(present in the
kernel distro), and it seems to work fine.

I think it's Moxa card dependant, may be caused by the high default baud
rate of this card.

I post here my patch below, it may interest someone.

David

----------------------------------------------



@@ -29,7 +29,7 @@
 #define IN_BUFFER_SIZE      4096
 #define OUT_BUFFER_SIZE     4096

-#define DEFAULT_BAUD_BASE   115200
+#define DEFAULT_BAUD_BASE   921600
 #define DEFAULT_TX_FIFO     16

 #define PARITY_MASK         0x03
@@ -316,8 +316,23 @@

     if (testbits(config->config_mask, RTSER_SET_BAUD)) {
         ctx->config.baud_rate = config->baud_rate;
-        baud_div = (baud_base[dev_id] + (ctx->config.baud_rate >> 1)) /
-                   ctx->config.baud_rate;
+        if (ctx->config.baud_rate == 134)
+        {
+          baud_div = (2 * baud_base[dev_id] / 269);
+        }
+        else
+        {
+          if (ctx->config.baud_rate)
+          {
+            baud_div = baud_base[dev_id] / ctx->config.baud_rate;
+                 if (baud_div == 0)
+              baud_div = 1;
+               }
+          else
+          {
+                 baud_div = 0;
+          }
+        }
         outb(LCR_DLAB,        LCR(dev_id));
         outb(baud_div & 0xff, DLL(dev_id));
         outb(baud_div >> 8,   DLM(dev_id));


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-05-11 15:45 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11  9:31 [Xenomai-core] 16550A driver and Moxa card / solved CHABAL David
2007-05-11  9:08 ` Jan Kiszka
2007-05-11  9:12 ` Maksym Veremeyenko
2007-05-11  9:17   ` Jan Kiszka
2007-05-11 10:57     ` CHABAL David
2007-05-11 10:28       ` Maksym Veremeyenko
2007-05-11 10:36       ` Jan Kiszka
2007-05-11 11:25         ` Jan Kiszka
2007-05-11 12:33           ` CHABAL David
2007-05-11 11:46         ` Maksym Veremeyenko
2007-05-11 12:11           ` Jan Kiszka
2007-05-11 14:11             ` CHABAL David
2007-05-11 13:25               ` Jan Kiszka
2007-05-11 13:35                 ` Maksym Veremeyenko
2007-05-11 14:33                 ` CHABAL David
2007-05-11 13:54                   ` Jan Kiszka
2007-05-11 13:58                   ` Maksym Veremeyenko
2007-05-11 15:33                     ` CHABAL David
2007-05-11 15:45                       ` Jan Kiszka
2007-05-11 13:29               ` Maksym Veremeyenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.