sim/up_uart.c: fix losting uart data when user paste long cmd
N/A Change-Id: I66c01c0789fc83ae8f6db522d61ff8ab63cd9211 Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
f423403dfa
commit
d009074ed5
@ -79,6 +79,7 @@ config ARCH_SIM
|
|||||||
select ALARM_ARCH
|
select ALARM_ARCH
|
||||||
select ONESHOT
|
select ONESHOT
|
||||||
select SERIAL_CONSOLE
|
select SERIAL_CONSOLE
|
||||||
|
select SERIAL_IFLOWCONTROL
|
||||||
---help---
|
---help---
|
||||||
Linux/Cygwin user-mode simulation.
|
Linux/Cygwin user-mode simulation.
|
||||||
|
|
||||||
|
@ -81,6 +81,8 @@ static int tty_ioctl(FAR struct file *filep, int cmd,
|
|||||||
static int tty_receive(FAR struct uart_dev_s *dev, uint32_t *status);
|
static int tty_receive(FAR struct uart_dev_s *dev, uint32_t *status);
|
||||||
static void tty_rxint(FAR struct uart_dev_s *dev, bool enable);
|
static void tty_rxint(FAR struct uart_dev_s *dev, bool enable);
|
||||||
static bool tty_rxavailable(FAR struct uart_dev_s *dev);
|
static bool tty_rxavailable(FAR struct uart_dev_s *dev);
|
||||||
|
static bool tty_rxflowcontrol(FAR struct uart_dev_s *dev,
|
||||||
|
unsigned int nbuffered, bool upper);
|
||||||
static void tty_send(FAR struct uart_dev_s *dev, int ch);
|
static void tty_send(FAR struct uart_dev_s *dev, int ch);
|
||||||
static void tty_txint(FAR struct uart_dev_s *dev, bool enable);
|
static void tty_txint(FAR struct uart_dev_s *dev, bool enable);
|
||||||
static bool tty_txready(FAR struct uart_dev_s *dev);
|
static bool tty_txready(FAR struct uart_dev_s *dev);
|
||||||
@ -100,6 +102,7 @@ static const struct uart_ops_s g_tty_ops =
|
|||||||
.receive = tty_receive,
|
.receive = tty_receive,
|
||||||
.rxint = tty_rxint,
|
.rxint = tty_rxint,
|
||||||
.rxavailable = tty_rxavailable,
|
.rxavailable = tty_rxavailable,
|
||||||
|
.rxflowcontrol = tty_rxflowcontrol,
|
||||||
.send = tty_send,
|
.send = tty_send,
|
||||||
.txint = tty_txint,
|
.txint = tty_txint,
|
||||||
.txready = tty_txready,
|
.txready = tty_txready,
|
||||||
@ -415,6 +418,28 @@ static bool tty_rxavailable(struct uart_dev_s *dev)
|
|||||||
return simuart_checkc(dev->isconsole ? 0 : priv->fd);
|
return simuart_checkc(dev->isconsole ? 0 : priv->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: tty_rxflowcontrol
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return true if UART activated RX flow control to block more incoming
|
||||||
|
* data.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static bool tty_rxflowcontrol(FAR struct uart_dev_s *dev,
|
||||||
|
unsigned int nbuffered, bool upper)
|
||||||
|
{
|
||||||
|
FAR struct uart_buffer_s *rxbuf = &dev->recv;
|
||||||
|
|
||||||
|
if (nbuffered == rxbuf->size)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: tty_send
|
* Name: tty_send
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user