From ff5e589f76e5c90ab35c3a47dfd01d676a0b3647 Mon Sep 17 00:00:00 2001 From: Dimitry Kloper Date: Tue, 29 Dec 2015 17:56:44 +0200 Subject: [PATCH] AVR: add support for TCGETS and TCSETS terminal controls Sometimes I need UART to support binary data transfer, TCSETS/TCGETS allow stwitching into binary mode. --- arch/avr/src/atmega/Kconfig | 15 +++++++++++++++ arch/avr/src/atmega/atmega_serial.c | 10 ++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/avr/src/atmega/Kconfig b/arch/avr/src/atmega/Kconfig index b2c67025f1..218c61857d 100644 --- a/arch/avr/src/atmega/Kconfig +++ b/arch/avr/src/atmega/Kconfig @@ -38,5 +38,20 @@ config AVR_USART1 select ARCH_HAVE_USART1 endmenu # ATMega Peripheral Selections + + +menu "Low level UART driver options" + depends on AVR_USART0 || AVR_USART1 + +config SERIAL_TERMIOS + bool "Serial driver TERMIOS supported" + depends on AVR_USART0 || AVR_USART1 + default n + ---help--- + Serial driver supports termios.h interfaces (tcsetattr, tcflush, etc.). + If this is not defined, then the terminal settings (baud, parity, etc). + are not configurable at runtime; serial streams cannot be flushed, etc.. + +endmenu endif diff --git a/arch/avr/src/atmega/atmega_serial.c b/arch/avr/src/atmega/atmega_serial.c index c881debe25..6d2ae31589 100644 --- a/arch/avr/src/atmega/atmega_serial.c +++ b/arch/avr/src/atmega/atmega_serial.c @@ -561,12 +561,13 @@ static int usart1_txinterrupt(int irq, void *context) #ifdef CONFIG_AVR_USART0 static int usart0_ioctl(struct file *filep, int cmd, unsigned long arg) { -#if 0 /* Reserved for future growth */ +#if CONFIG_SERIAL_TERMIOS int ret = OK; switch (cmd) { - case xxx: /* Add commands here */ + case TCGETS: + case TCSETS: break; default: @@ -584,12 +585,13 @@ static int usart0_ioctl(struct file *filep, int cmd, unsigned long arg) #ifdef CONFIG_AVR_USART1 static int usart1_ioctl(struct file *filep, int cmd, unsigned long arg) { -#if 0 /* Reserved for future growth */ +#if CONFIG_SERIAL_TERMIOS int ret = OK; switch (cmd) { - case xxx: /* Add commands here */ + case TCGETS: + case TCSETS: break; default: