drivers/serial/serial.c: Add support for TCFLUSH

This commit is contained in:
Sebastien Lorquet 2017-08-01 06:30:52 -06:00 committed by Gregory Nutt
parent 05ea22e9ab
commit e22912db37

View File

@ -977,6 +977,37 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
ret = 0;
}
break;
#ifdef CONFIG_SERIAL_TERMIOS
case TCFLSH:
{
/* Empty the tx/rx buffers */
irqstate_t flags = enter_critical_section();
if (arg == TCIFLUSH || arg == TCIOFLUSH)
{
dev->recv.head = 0;
dev->recv.tail = 0;
}
if (arg == TCOFLUSH || arg == TCIOFLUSH)
{
dev->xmit.head = 0;
dev->xmit.tail = 0;
}
leave_critical_section(flags);
}
break;
#if 0
case TCDRN:
{
}
break;
#endif
#endif
}
}