diff options
author | Jan Vesely <jano.vesely@gmail.com> | 2012-04-03 17:53:24 -0400 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2012-04-05 15:41:41 +0000 |
commit | 1231034678018d88eae66218bc6c68ca33e99af7 (patch) | |
tree | a2680e2246cde061b2d3216e15ce150876c5acd5 | |
parent | 638d057783f10fb492a66fcb9766cc2e8599b5a1 (diff) |
serial, omap_uart: Add support for fifo level regs2012.04.rebasing
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
-rw-r--r-- | hw/omap_uart.c | 10 | ||||
-rw-r--r-- | hw/pc.h | 3 | ||||
-rw-r--r-- | hw/serial.c | 12 |
3 files changed, 25 insertions, 0 deletions
diff --git a/hw/omap_uart.c b/hw/omap_uart.c index 644fa04e9..738e1e9d3 100644 --- a/hw/omap_uart.c +++ b/hw/omap_uart.c @@ -175,6 +175,16 @@ static uint64_t omap_uart_read(void *opaque, target_phys_addr_t addr, return s->wkup; case 0x60: /* CFPS (OMAP2) */ return s->cfps; + case 0x64: /* RXFIFO_LVL_REG (OMAP36xx) */ + if (s->revision >= 0x52) { + return serial_rx_fifo_count(s->serial) & 0xff; + } + break; + case 0x68: /* TXFIFO_LVL_REG (OMAP36xx) */ + if (s->revision >= 0x52) { + return serial_tx_fifo_count(s->serial) & 0xff; + } + break; } OMAP_BAD_REG(addr); @@ -37,6 +37,9 @@ static inline bool serial_isa_init(ISABus *bus, int index, return true; } +unsigned serial_rx_fifo_count(SerialState *s); +unsigned serial_tx_fifo_count(SerialState *s); + void serial_set_frequency(SerialState *s, uint32_t frequency); void serial_change_char_driver(SerialState *s, CharDriverState *chr); const MemoryRegionOps *serial_get_memops(enum device_endian end); diff --git a/hw/serial.c b/hw/serial.c index d3d45bf28..4925612a8 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -761,6 +761,18 @@ static void serial_init_core(SerialState *s) serial_event, s); } +/* Get number of stored bytes in receive fifo. */ +unsigned serial_rx_fifo_count(SerialState *s) +{ + return s->recv_fifo.count; +} + +/* Get number of stored bytes in transmit fifo. */ +unsigned serial_tx_fifo_count(SerialState *s) +{ + return s->xmit_fifo.count; +} + /* Change the main reference oscillator frequency. */ void serial_set_frequency(SerialState *s, uint32_t frequency) { |