char/cadence_uart: Fix can_receive logic
commit61654c77413d1bccb69b384d891d0c688a31430b
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>
Mon, 6 Jan 2014 10:16:39 +0000 (6 10:16 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 7 Jan 2014 19:18:06 +0000 (7 19:18 +0000)
treedce301f7c49afebff553cd6e411276240ad9c40c
parentfaa79359cdb28916b102024e49916af212b344bf
char/cadence_uart: Fix can_receive logic

The can_receive logic was only taking into account the RxFIFO
occupancy. RxFIFO population is only used for the echo and normal modes
however. Improve the logic to correctly return the true number of
receivable characters based on the current mode:

Normal mode: RxFIFO vacancy.
Remote loopback: TxFIFO vacancy.
Echo mode: The min of the TxFIFO and RxFIFO vacancies.
Local Loopback: Return non-zero (to implement droppage)

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 36a58440c9ca5080151e95765c2c81342de8a8df.1388626249.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/char/cadence_uart.c