]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/lib/uart/arm/uart_imx.h
update
[l4.git] / kernel / fiasco / src / lib / uart / arm / uart_imx.h
index dba0eedbd02160b57eaa2abc6bb06f94fcc06de9..e565434f7b923ebb517f2147ca6b403931482a1c 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
+ *     economic rights: Technische Universität Dresden (Germany)
+ *
+ * This file is part of TUD:OS and distributed under the terms of the
+ * GNU General Public License 2.
+ * Please see the COPYING-GPL-2 file for details.
+ */
 #ifndef L4_CXX_UART_imx_H__
 #define L4_CXX_UART_imx_H__
 
@@ -7,15 +15,10 @@ namespace L4
 {
   class Uart_imx : public Uart
   {
-  private:
-    unsigned long _base;
-
-    inline unsigned long rd(unsigned long reg) const;
-    inline void wr(unsigned long reg, unsigned long val) const;
-
   public:
-    Uart_imx(int rx_irq, int tx_irq)
-       : Uart(rx_irq, tx_irq), _base(~0UL) {}
+    enum platform_type { Type_imx21, Type_imx35, Type_imx51 };
+    Uart_imx(int rx_irq, int tx_irq, enum platform_type type)
+       : Uart(rx_irq, tx_irq), _base(~0UL), _type(type) {}
     bool startup(unsigned long base);
     void shutdown();
     bool enable_rx_irq(bool enable = true);
@@ -25,6 +28,34 @@ namespace L4
     int char_avail() const;
     inline void out_char(char c) const;
     int write(char const *s, unsigned long count) const;
+
+  private:
+    unsigned long _base;
+    enum platform_type _type;
+
+    inline unsigned long rd(unsigned long reg) const;
+    inline void wr(unsigned long reg, unsigned long val) const;
+  };
+
+  class Uart_imx21 : public Uart_imx
+  {
+  public:
+    Uart_imx21(int rx_irq, int tx_irq)
+       : Uart_imx(rx_irq, tx_irq, Type_imx21) {}
+  };
+
+  class Uart_imx35 : public Uart_imx
+  {
+  public:
+    Uart_imx35(int rx_irq, int tx_irq)
+       : Uart_imx(rx_irq, tx_irq, Type_imx35) {}
+  };
+
+  class Uart_imx51 : public Uart_imx
+  {
+  public:
+    Uart_imx51(int rx_irq, int tx_irq)
+       : Uart_imx(rx_irq, tx_irq, Type_imx51) {}
   };
 };