]> git.proxmox.com Git - mirror_qemu.git/commit - hw/char/cadence_uart.c
char/cadence_uart: Fix can_receive logic
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>
Mon, 6 Jan 2014 10:16:39 +0000 (10:16 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Wed, 8 Jan 2014 19:07:21 +0000 (19:07 +0000)
commitd0ac820fe4152ea3a57fc3fa9f732cc9524017a4
tree49684cdbdf08799f393e242cd221712f446e1d03
parent2152e08ad12180f307bc5b838134ab745767d2e5
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