From 9e1a7113f7adbec16eaa3f62cedc73e578592bbe Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 8 Apr 2015 14:35:04 -0600 Subject: [PATCH] SAMA5 Serial: Fix a couple of errors backporting termios and flowcontrol --- arch/arm/src/sama5/Kconfig | 7 +++++++ arch/arm/src/sama5/sam_serial.c | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/sama5/Kconfig b/arch/arm/src/sama5/Kconfig index d02ad3b40b..1946b9b324 100644 --- a/arch/arm/src/sama5/Kconfig +++ b/arch/arm/src/sama5/Kconfig @@ -282,38 +282,45 @@ config SAMA5_UART0 default y depends on SAMA5_HAVE_UART0 select ARCH_HAVE_UART0 + select ARCH_HAVE_SERIAL_TERMIOS config SAMA5_UART1 bool "UART 1" default n depends on SAMA5_HAVE_UART1 select ARCH_HAVE_UART1 + select ARCH_HAVE_SERIAL_TERMIOS config SAMA5_USART0 bool "USART 0" default n select ARCH_HAVE_USART0 + select ARCH_HAVE_SERIAL_TERMIOS config SAMA5_USART1 bool "USART 1" default n select ARCH_HAVE_USART1 + select ARCH_HAVE_SERIAL_TERMIOS config SAMA5_USART2 bool "USART 2" default n select ARCH_HAVE_USART2 + select ARCH_HAVE_SERIAL_TERMIOS config SAMA5_USART3 bool "USART 3" default n select ARCH_HAVE_USART3 + select ARCH_HAVE_SERIAL_TERMIOS config SAMA5_USART4 bool "USART 4" default n depends on SAMA5_HAVE_USART4 select ARCH_HAVE_USART4 + select ARCH_HAVE_SERIAL_TERMIOS config SAMA5_TWI0 bool "Two-Wire Interface 0 (TWI0)" diff --git a/arch/arm/src/sama5/sam_serial.c b/arch/arm/src/sama5/sam_serial.c index 11e4d8d437..2f5f54870b 100644 --- a/arch/arm/src/sama5/sam_serial.c +++ b/arch/arm/src/sama5/sam_serial.c @@ -404,7 +404,7 @@ struct up_dev_s uint8_t bits; /* Number of bits (7 or 8) */ bool stopbits2; /* true: Configure with 2 stop bits instead of 1 */ #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) - bool flowc; /* input flow control (RTS) enabled */ + bool flowc; /* input flow control (RTS) enabled */ #endif }; @@ -521,7 +521,7 @@ static struct up_dev_s g_uart1priv = .parity = CONFIG_UART1_PARITY, .bits = CONFIG_UART1_BITS, .stopbits2 = CONFIG_UART1_2STOP, -; +}; static uart_dev_t g_uart1port = { @@ -1239,16 +1239,17 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) priv->flowc = flowc; #endif - /* effect the changes immediately - note that we do not + /* Effect the changes immediately - note that we do not * implement TCSADRAIN / TCSAFLUSH */ - up_disableallints(priv, &imr); + imr = up_serialin(priv, SAM_UART_IMR_OFFSET); + up_disableallints(priv); ret = up_setup(dev); /* Restore the interrupt state */ - up_restoreusartint(priv, imr); + up_serialout(priv, SAM_UART_IER_OFFSET, imr); } } break;