mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 18:58:27 +08:00
Add serial method so that lower half driver can provide RX flow control information. From Jussi Kivilinna
This commit is contained in:
@@ -153,7 +153,26 @@ void uart_recvchars(FAR uart_dev_t *dev)
|
||||
|
||||
while (uart_rxavailable(dev))
|
||||
{
|
||||
char ch = uart_receive(dev, &status);
|
||||
bool is_full = (nexthead == dev->recv.tail);
|
||||
char ch;
|
||||
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
/* Check if RX buffer is full and allow serial low-level driver to pause
|
||||
* processing. This allows proper utilization of hardware flow control.
|
||||
*/
|
||||
|
||||
if (is_full)
|
||||
{
|
||||
if (uart_rxflowcontrol(dev))
|
||||
{
|
||||
/* Low-level driver activated RX flow control, exit loop now. */
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ch = uart_receive(dev, &status);
|
||||
|
||||
/* If the RX buffer becomes full, then the serial data is discarded. This is
|
||||
* necessary because on most serial hardware, you must read the data in order
|
||||
@@ -163,7 +182,7 @@ void uart_recvchars(FAR uart_dev_t *dev)
|
||||
* some large internal buffering).
|
||||
*/
|
||||
|
||||
if (nexthead != dev->recv.tail)
|
||||
if (!is_full)
|
||||
{
|
||||
/* Add the character to the buffer */
|
||||
|
||||
|
||||
@@ -119,6 +119,9 @@ static const struct uart_ops_s g_uart_ops =
|
||||
.receive = u16550_receive,
|
||||
.rxint = u16550_rxint,
|
||||
.rxavailable = u16550_rxavailable,
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
.rxflowcontrol = NULL,
|
||||
#endif
|
||||
.send = u16550_send,
|
||||
.txint = u16550_txint,
|
||||
.txready = u16550_txready,
|
||||
|
||||
Reference in New Issue
Block a user