1 #include "uart_leon3.h"
13 STATUS_DR = 0x001, // data ready
14 STATUS_TS = 0x002, // transmit shift empty
15 STATUS_TE = 0x004, // transmit fifo empty
16 STATUS_BR = 0x008, // BREAK received
17 STATUS_OV = 0x010, // overrun
18 STATUS_PE = 0x020, // parity error
19 STATUS_FE = 0x040, // framing error
20 STATUS_TH = 0x080, // transmit fifo half-full
21 STATUS_RH = 0x100, // recv fifo half-full
22 STATUS_TF = 0x200, // transmit fifo full
23 STATUS_RF = 0x400, // recv fifo full
25 STATUS_TCNT_MASK = 0x3F,
26 STATUS_TCNT_SHIFT = 20,
27 STATUS_RCNT_MASK = 0x3F,
28 STATUS_RCNT_SHIFT = 26,
46 bool Uart_leon3::startup(Io_register_block const *regs)
53 void Uart_leon3::shutdown()
56 bool Uart_leon3::change_mode(Transfer_mode, Baud_rate r)
64 int Uart_leon3::get_char(bool blocking) const
70 return _regs->read<unsigned int>(DATA_REG) & DATA_MASK;
73 int Uart_leon3::char_avail() const
78 void Uart_leon3::out_char(char c) const
80 while (_regs->read<unsigned int>(STATUS_REG) & STATUS_TF)
82 _regs->write<unsigned int>(DATA_REG, c);
85 int Uart_leon3::write(char const *s, unsigned long count) const
87 unsigned long c = count;