From 0b46ac44f2673be2ee51bb52149cab3546ff1696 Mon Sep 17 00:00:00 2001 From: Ilpo Järvinen Date: Mon, 9 May 2022 12:34:44 +0300 Subject: termbits.h: create termbits-common.h for identical bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some defines are the same across all archs. Move the most obvious intersection to termbits-common.h. Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220509093446.6677-2-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- include/uapi/asm-generic/termbits-common.h | 65 ++++++++++++++++++++++++++++++ include/uapi/asm-generic/termbits.h | 53 +----------------------- 2 files changed, 67 insertions(+), 51 deletions(-) create mode 100644 include/uapi/asm-generic/termbits-common.h (limited to 'include/uapi/asm-generic') diff --git a/include/uapi/asm-generic/termbits-common.h b/include/uapi/asm-generic/termbits-common.h new file mode 100644 index 000000000000..4d084fe8def5 --- /dev/null +++ b/include/uapi/asm-generic/termbits-common.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_GENERIC_TERMBITS_COMMON_H +#define __ASM_GENERIC_TERMBITS_COMMON_H + +typedef unsigned char cc_t; +typedef unsigned int speed_t; + +/* c_iflag bits */ +#define IGNBRK 0x001 /* Ignore break condition */ +#define BRKINT 0x002 /* Signal interrupt on break */ +#define IGNPAR 0x004 /* Ignore characters with parity errors */ +#define PARMRK 0x008 /* Mark parity and framing errors */ +#define INPCK 0x010 /* Enable input parity check */ +#define ISTRIP 0x020 /* Strip 8th bit off characters */ +#define INLCR 0x040 /* Map NL to CR on input */ +#define IGNCR 0x080 /* Ignore CR */ +#define ICRNL 0x100 /* Map CR to NL on input */ +#define IXANY 0x800 /* Any character will restart after stop */ + +/* c_oflag bits */ +#define OPOST 0x01 /* Perform output processing */ +#define OCRNL 0x08 +#define ONOCR 0x10 +#define ONLRET 0x20 +#define OFILL 0x40 +#define OFDEL 0x80 + +/* c_cflag bit meaning */ +/* Common CBAUD rates */ +#define B0 0x00000000 /* hang up */ +#define B50 0x00000001 +#define B75 0x00000002 +#define B110 0x00000003 +#define B134 0x00000004 +#define B150 0x00000005 +#define B200 0x00000006 +#define B300 0x00000007 +#define B600 0x00000008 +#define B1200 0x00000009 +#define B1800 0x0000000a +#define B2400 0x0000000b +#define B4800 0x0000000c +#define B9600 0x0000000d +#define B19200 0x0000000e +#define B38400 0x0000000f +#define EXTA B19200 +#define EXTB B38400 + +#define CMSPAR 0x40000000 /* mark or space (stick) parity */ +#define CRTSCTS 0x80000000 /* flow control */ + +#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ + +/* tcflow() ACTION argument and TCXONC use these */ +#define TCOOFF 0 /* Suspend output */ +#define TCOON 1 /* Restart suspended output */ +#define TCIOFF 2 /* Send a STOP character */ +#define TCION 3 /* Send a START character */ + +/* tcflush() QUEUE_SELECTOR argument and TCFLSH use these */ +#define TCIFLUSH 0 /* Discard data received but not yet read */ +#define TCOFLUSH 1 /* Discard data written but not yet sent */ +#define TCIOFLUSH 2 /* Discard all pending data */ + +#endif /* __ASM_GENERIC_TERMBITS_COMMON_H */ diff --git a/include/uapi/asm-generic/termbits.h b/include/uapi/asm-generic/termbits.h index 470fd673ff84..78a85c326eef 100644 --- a/include/uapi/asm-generic/termbits.h +++ b/include/uapi/asm-generic/termbits.h @@ -4,8 +4,8 @@ #include -typedef unsigned char cc_t; -typedef unsigned int speed_t; +#include + typedef unsigned int tcflag_t; #define NCCS 19 @@ -60,31 +60,15 @@ struct ktermios { #define VEOL2 16 /* c_iflag bits */ -#define IGNBRK 0x00001 -#define BRKINT 0x00002 -#define IGNPAR 0x00004 -#define PARMRK 0x00008 -#define INPCK 0x00010 -#define ISTRIP 0x00020 -#define INLCR 0x00040 -#define IGNCR 0x00080 -#define ICRNL 0x00100 #define IUCLC 0x00200 #define IXON 0x00400 -#define IXANY 0x00800 #define IXOFF 0x01000 #define IMAXBEL 0x02000 #define IUTF8 0x04000 /* c_oflag bits */ -#define OPOST 0x00001 #define OLCUC 0x00002 #define ONLCR 0x00004 -#define OCRNL 0x00008 -#define ONOCR 0x00010 -#define ONLRET 0x00020 -#define OFILL 0x00040 -#define OFDEL 0x00080 #define NLDLY 0x00100 #define NL0 0x00000 #define NL1 0x00100 @@ -111,24 +95,6 @@ struct ktermios { /* c_cflag bit meaning */ #define CBAUD 0x0000100f -#define B0 0x00000000 /* hang up */ -#define B50 0x00000001 -#define B75 0x00000002 -#define B110 0x00000003 -#define B134 0x00000004 -#define B150 0x00000005 -#define B200 0x00000006 -#define B300 0x00000007 -#define B600 0x00000008 -#define B1200 0x00000009 -#define B1800 0x0000000a -#define B2400 0x0000000b -#define B4800 0x0000000c -#define B9600 0x0000000d -#define B19200 0x0000000e -#define B38400 0x0000000f -#define EXTA B19200 -#define EXTB B38400 #define CSIZE 0x00000030 #define CS5 0x00000000 #define CS6 0x00000010 @@ -158,10 +124,6 @@ struct ktermios { #define B3500000 0x0000100e #define B4000000 0x0000100f #define CIBAUD 0x100f0000 /* input baud rate */ -#define CMSPAR 0x40000000 /* mark or space (stick) parity */ -#define CRTSCTS 0x80000000 /* flow control */ - -#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ /* c_lflag bits */ #define ISIG 0x00001 @@ -181,17 +143,6 @@ struct ktermios { #define IEXTEN 0x08000 #define EXTPROC 0x10000 -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - /* tcsetattr uses these */ #define TCSANOW 0 #define TCSADRAIN 1 -- cgit v1.2.3