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.
This commit is contained in:
Dimitry Kloper 2015-12-29 17:56:44 +02:00
parent d6f6e41a36
commit ff5e589f76
2 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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: