drivers/serial/serial.c: Add support for TCFLUSH
This commit is contained in:
parent
05ea22e9ab
commit
e22912db37
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user