]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/drivers-frst/uart/src/uart_imx.cc
update
[l4.git] / l4 / pkg / drivers-frst / uart / src / uart_imx.cc
index c22f9bdc0429b083f444a9ed8be8570650f53300..e7bee0a3c95d67395546faa087ac52c06126af62 100644 (file)
@@ -7,6 +7,7 @@
  * Please see the COPYING-GPL-2 file for details.
  */
 #include "uart_imx.h"
+#include "poll_timeout_counter.h"
 
 namespace L4
 {
@@ -101,6 +102,10 @@ namespace L4
         _regs->write<unsigned int>(UBIR, 0xf);
         _regs->write<unsigned int>(UBMR, 0x120);
         break;
+      case Type_imx6:
+        _regs->write<unsigned int>(UBIR, 0xf);
+        _regs->write<unsigned int>(UBMR, 0x15b);
+        break;
       }
 
     _regs->write<unsigned int>(UCR1, UCR1_EN);
@@ -148,7 +153,8 @@ namespace L4
 
   void Uart_imx::out_char(char c) const
   {
-    while (!(_regs->read<unsigned int>(USR1) & USR1_TRDY))
+    Poll_timeout_counter i(3000000);
+    while (i.test(!(_regs->read<unsigned int>(USR1) & USR1_TRDY)))
      ;
     _regs->write<unsigned int>(UTXD, c);
   }
@@ -159,7 +165,8 @@ namespace L4
     while (c--)
       out_char(*s++);
 
-    while (!(_regs->read<unsigned int>(USR2) & USR2_TXDC))
+    Poll_timeout_counter i(3000000);
+    while (i.test(!(_regs->read<unsigned int>(USR2) & USR2_TXDC)))
       ;
 
     return count;