1 #ifndef L4_CXX_UART_MPC52XX_H__
2 #define L4_CXX_UART_MPC52XX_H__
9 class Uart_mpc52xx : public Uart
12 typedef unsigned char u8;
13 typedef unsigned short u16;
14 typedef unsigned int u32;
20 unsigned long mode() const
23 //psc + 0x04, size u16
24 unsigned long status() const
25 { return _psc_base + 0x04; }
28 unsigned long command() const
29 { return _psc_base + 0x08; }
31 //psc + 0x0c, size u32
32 unsigned long buffer() const
33 { return _psc_base + 0x0c; }
35 //psc + 0x14, size u16
36 unsigned long imr() const
37 { return _psc_base + 0x14; }
39 unsigned long sicr() const
40 { return _psc_base + 0x44; }
42 template < typename T >
43 void wr(unsigned long addr, T val) const;
45 template < typename T >
46 T rd(unsigned long addr) const;
48 template < typename T >
49 void wr_dirty(unsigned long addr, T val) const;
51 template < typename T >
52 T rd_dirty(unsigned long addr) const;
54 inline void mpc52xx_out_char(char c) const;
56 unsigned long _psc_base;
58 Uart_mpc52xx(int rx_irq, int tx_irq) : Uart(rx_irq, tx_irq) {}
59 bool startup(unsigned long base);
61 bool enable_rx_irq(bool enable = true);
62 bool enable_tx_irq(bool enable = true);
63 bool change_mode(Transfer_mode m, Baud_rate r);
64 int get_char(bool blocking = true) const;
65 int char_avail() const;
66 inline void out_char(char c) const;
67 int write(char const *s, unsigned long count) const;