Merge pull request #4216 from mysterywolf/tio

重新整理了serial.c和pipe.c的格式
This commit is contained in:
Bernard Xiong 2021-01-01 19:27:36 +08:00 committed by GitHub
commit efc536afec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 141 additions and 137 deletions

View File

@ -759,14 +759,17 @@ static rt_err_t rt_serial_close(struct rt_device *dev)
#ifdef RT_SERIAL_USING_DMA
else if (dev->open_flag & RT_DEVICE_FLAG_DMA_RX)
{
if (serial->config.bufsz == 0) {
if (serial->config.bufsz == 0)
{
struct rt_serial_rx_dma* rx_dma;
rx_dma = (struct rt_serial_rx_dma*)serial->serial_rx;
RT_ASSERT(rx_dma != RT_NULL);
rt_free(rx_dma);
} else {
}
else
{
struct rt_serial_rx_fifo* rx_fifo;
rx_fifo = (struct rt_serial_rx_fifo*)serial->serial_rx;
@ -1105,6 +1108,16 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
break;
case TCXONC:
break;
case TIOCSWINSZ:
{
struct winsize* p_winsize;
p_winsize = (struct winsize*)args;
rt_enter_critical();
rt_kprintf("\x1b[8;%d;%dt", p_winsize->ws_col, p_winsize->ws_row);
rt_exit_critical();
}
break;
#endif /*RT_USING_POSIX_TERMIOS*/
case FIONREAD:
{
@ -1118,14 +1131,6 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
*(rt_size_t *)args = recved;
}
break;
case TIOCSWINSZ:
{
struct winsize* p_winsize;
p_winsize = (struct winsize*)args;
rt_kprintf("\x1b[8;%d;%dt", p_winsize->ws_col, p_winsize->ws_row);
}
break;
#endif /*RT_USING_POSIX*/
default :
/* control device */

View File

@ -227,4 +227,3 @@ struct winsize {
#define SIOCPROTOPRIVATE 0x89E0
#endif