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));

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to