Add serial method so that lower half driver can provide RX flow control information. From Jussi Kivilinna

This commit is contained in:
Gregory Nutt
2014-05-08 09:00:33 -06:00
parent 35e94a5be4
commit 7594d8b8cf
40 changed files with 305 additions and 30 deletions
+21 -2
View File
@@ -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 */
+3
View File
@@ -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,