serial: ns16550: Fix poll in
poll_in was dropping all data and return just the last character. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
1738f0e64b
commit
459dde17e5
1 changed files with 4 additions and 13 deletions
|
@ -511,19 +511,10 @@ static int uart_ns16550_poll_in(struct device *dev, unsigned char *c)
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
k_spinlock_key_t key = k_spin_lock(&DEV_DATA(dev)->lock);
|
k_spinlock_key_t key = k_spin_lock(&DEV_DATA(dev)->lock);
|
||||||
|
|
||||||
while (1) {
|
if ((INBYTE(LSR(dev)) & LSR_RXRDY) != 0) {
|
||||||
|
/* got a character */
|
||||||
if ((INBYTE(LSR(dev)) & LSR_RXRDY) != 0) {
|
*c = INBYTE(RDR(dev));
|
||||||
/* got a character */
|
ret = 0;
|
||||||
*c = INBYTE(RDR(dev));
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((INBYTE(LSR(dev)) & LSR_RXRDY) != 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
k_spin_unlock(&DEV_DATA(dev)->lock, key);
|
k_spin_unlock(&DEV_DATA(dev)->lock, key);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue