aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/omap_uart.c10
-rw-r--r--hw/pc.h3
-rw-r--r--hw/serial.c12
3 files changed, 25 insertions, 0 deletions
diff --git a/hw/omap_uart.c b/hw/omap_uart.c
index 644fa04e92..738e1e9d3d 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);
diff --git a/hw/pc.h b/hw/pc.h
index 9e7721b7a3..54554b0afe 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -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 d3d45bf28c..4925612a85 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)
{