18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci#ifndef _UAPI_SPARC_TERMBITS_H
38c2ecf20Sopenharmony_ci#define _UAPI_SPARC_TERMBITS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/posix_types.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_citypedef unsigned char   cc_t;
88c2ecf20Sopenharmony_citypedef unsigned int    speed_t;
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#if defined(__sparc__) && defined(__arch64__)
118c2ecf20Sopenharmony_citypedef unsigned int    tcflag_t;
128c2ecf20Sopenharmony_ci#else
138c2ecf20Sopenharmony_citypedef unsigned long   tcflag_t;
148c2ecf20Sopenharmony_ci#endif
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define NCC 8
178c2ecf20Sopenharmony_cistruct termio {
188c2ecf20Sopenharmony_ci	unsigned short c_iflag;		/* input mode flags */
198c2ecf20Sopenharmony_ci	unsigned short c_oflag;		/* output mode flags */
208c2ecf20Sopenharmony_ci	unsigned short c_cflag;		/* control mode flags */
218c2ecf20Sopenharmony_ci	unsigned short c_lflag;		/* local mode flags */
228c2ecf20Sopenharmony_ci	unsigned char c_line;		/* line discipline */
238c2ecf20Sopenharmony_ci	unsigned char c_cc[NCC];	/* control characters */
248c2ecf20Sopenharmony_ci};
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define NCCS 17
278c2ecf20Sopenharmony_cistruct termios {
288c2ecf20Sopenharmony_ci	tcflag_t c_iflag;		/* input mode flags */
298c2ecf20Sopenharmony_ci	tcflag_t c_oflag;		/* output mode flags */
308c2ecf20Sopenharmony_ci	tcflag_t c_cflag;		/* control mode flags */
318c2ecf20Sopenharmony_ci	tcflag_t c_lflag;		/* local mode flags */
328c2ecf20Sopenharmony_ci	cc_t c_line;			/* line discipline */
338c2ecf20Sopenharmony_ci#ifndef __KERNEL__
348c2ecf20Sopenharmony_ci	cc_t c_cc[NCCS];		/* control characters */
358c2ecf20Sopenharmony_ci#else
368c2ecf20Sopenharmony_ci	cc_t c_cc[NCCS+2];	/* kernel needs 2 more to hold vmin/vtime */
378c2ecf20Sopenharmony_ci#define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
388c2ecf20Sopenharmony_ci#endif
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistruct termios2 {
428c2ecf20Sopenharmony_ci	tcflag_t c_iflag;		/* input mode flags */
438c2ecf20Sopenharmony_ci	tcflag_t c_oflag;		/* output mode flags */
448c2ecf20Sopenharmony_ci	tcflag_t c_cflag;		/* control mode flags */
458c2ecf20Sopenharmony_ci	tcflag_t c_lflag;		/* local mode flags */
468c2ecf20Sopenharmony_ci	cc_t c_line;			/* line discipline */
478c2ecf20Sopenharmony_ci	cc_t c_cc[NCCS+2];		/* control characters */
488c2ecf20Sopenharmony_ci	speed_t c_ispeed;		/* input speed */
498c2ecf20Sopenharmony_ci	speed_t c_ospeed;		/* output speed */
508c2ecf20Sopenharmony_ci};
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistruct ktermios {
538c2ecf20Sopenharmony_ci	tcflag_t c_iflag;		/* input mode flags */
548c2ecf20Sopenharmony_ci	tcflag_t c_oflag;		/* output mode flags */
558c2ecf20Sopenharmony_ci	tcflag_t c_cflag;		/* control mode flags */
568c2ecf20Sopenharmony_ci	tcflag_t c_lflag;		/* local mode flags */
578c2ecf20Sopenharmony_ci	cc_t c_line;			/* line discipline */
588c2ecf20Sopenharmony_ci	cc_t c_cc[NCCS+2];		/* control characters */
598c2ecf20Sopenharmony_ci	speed_t c_ispeed;		/* input speed */
608c2ecf20Sopenharmony_ci	speed_t c_ospeed;		/* output speed */
618c2ecf20Sopenharmony_ci};
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* c_cc characters */
648c2ecf20Sopenharmony_ci#define VINTR    0
658c2ecf20Sopenharmony_ci#define VQUIT    1
668c2ecf20Sopenharmony_ci#define VERASE   2
678c2ecf20Sopenharmony_ci#define VKILL    3
688c2ecf20Sopenharmony_ci#define VEOF     4
698c2ecf20Sopenharmony_ci#define VEOL     5
708c2ecf20Sopenharmony_ci#define VEOL2    6
718c2ecf20Sopenharmony_ci#define VSWTC    7
728c2ecf20Sopenharmony_ci#define VSTART   8
738c2ecf20Sopenharmony_ci#define VSTOP    9
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define VSUSP    10
788c2ecf20Sopenharmony_ci#define VDSUSP   11  /* SunOS POSIX nicety I do believe... */
798c2ecf20Sopenharmony_ci#define VREPRINT 12
808c2ecf20Sopenharmony_ci#define VDISCARD 13
818c2ecf20Sopenharmony_ci#define VWERASE  14
828c2ecf20Sopenharmony_ci#define VLNEXT   15
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is
858c2ecf20Sopenharmony_ci * shared with eof/eol
868c2ecf20Sopenharmony_ci */
878c2ecf20Sopenharmony_ci#ifndef __KERNEL__
888c2ecf20Sopenharmony_ci#define VMIN     VEOF
898c2ecf20Sopenharmony_ci#define VTIME    VEOL
908c2ecf20Sopenharmony_ci#endif
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* c_iflag bits */
938c2ecf20Sopenharmony_ci#define IGNBRK	0x00000001
948c2ecf20Sopenharmony_ci#define BRKINT	0x00000002
958c2ecf20Sopenharmony_ci#define IGNPAR	0x00000004
968c2ecf20Sopenharmony_ci#define PARMRK	0x00000008
978c2ecf20Sopenharmony_ci#define INPCK	0x00000010
988c2ecf20Sopenharmony_ci#define ISTRIP	0x00000020
998c2ecf20Sopenharmony_ci#define INLCR	0x00000040
1008c2ecf20Sopenharmony_ci#define IGNCR	0x00000080
1018c2ecf20Sopenharmony_ci#define ICRNL	0x00000100
1028c2ecf20Sopenharmony_ci#define IUCLC	0x00000200
1038c2ecf20Sopenharmony_ci#define IXON	0x00000400
1048c2ecf20Sopenharmony_ci#define IXANY	0x00000800
1058c2ecf20Sopenharmony_ci#define IXOFF	0x00001000
1068c2ecf20Sopenharmony_ci#define IMAXBEL	0x00002000
1078c2ecf20Sopenharmony_ci#define IUTF8   0x00004000
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* c_oflag bits */
1108c2ecf20Sopenharmony_ci#define OPOST	0x00000001
1118c2ecf20Sopenharmony_ci#define OLCUC	0x00000002
1128c2ecf20Sopenharmony_ci#define ONLCR	0x00000004
1138c2ecf20Sopenharmony_ci#define OCRNL	0x00000008
1148c2ecf20Sopenharmony_ci#define ONOCR	0x00000010
1158c2ecf20Sopenharmony_ci#define ONLRET	0x00000020
1168c2ecf20Sopenharmony_ci#define OFILL	0x00000040
1178c2ecf20Sopenharmony_ci#define OFDEL	0x00000080
1188c2ecf20Sopenharmony_ci#define NLDLY	0x00000100
1198c2ecf20Sopenharmony_ci#define   NL0	0x00000000
1208c2ecf20Sopenharmony_ci#define   NL1	0x00000100
1218c2ecf20Sopenharmony_ci#define CRDLY	0x00000600
1228c2ecf20Sopenharmony_ci#define   CR0	0x00000000
1238c2ecf20Sopenharmony_ci#define   CR1	0x00000200
1248c2ecf20Sopenharmony_ci#define   CR2	0x00000400
1258c2ecf20Sopenharmony_ci#define   CR3	0x00000600
1268c2ecf20Sopenharmony_ci#define TABDLY	0x00001800
1278c2ecf20Sopenharmony_ci#define   TAB0	0x00000000
1288c2ecf20Sopenharmony_ci#define   TAB1	0x00000800
1298c2ecf20Sopenharmony_ci#define   TAB2	0x00001000
1308c2ecf20Sopenharmony_ci#define   TAB3	0x00001800
1318c2ecf20Sopenharmony_ci#define   XTABS	0x00001800
1328c2ecf20Sopenharmony_ci#define BSDLY	0x00002000
1338c2ecf20Sopenharmony_ci#define   BS0	0x00000000
1348c2ecf20Sopenharmony_ci#define   BS1	0x00002000
1358c2ecf20Sopenharmony_ci#define VTDLY	0x00004000
1368c2ecf20Sopenharmony_ci#define   VT0	0x00000000
1378c2ecf20Sopenharmony_ci#define   VT1	0x00004000
1388c2ecf20Sopenharmony_ci#define FFDLY	0x00008000
1398c2ecf20Sopenharmony_ci#define   FF0	0x00000000
1408c2ecf20Sopenharmony_ci#define   FF1	0x00008000
1418c2ecf20Sopenharmony_ci#define PAGEOUT 0x00010000  /* SUNOS specific */
1428c2ecf20Sopenharmony_ci#define WRAP    0x00020000  /* SUNOS specific */
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci/* c_cflag bit meaning */
1458c2ecf20Sopenharmony_ci#define CBAUD	  0x0000100f
1468c2ecf20Sopenharmony_ci#define  B0	  0x00000000   /* hang up */
1478c2ecf20Sopenharmony_ci#define  B50	  0x00000001
1488c2ecf20Sopenharmony_ci#define  B75	  0x00000002
1498c2ecf20Sopenharmony_ci#define  B110	  0x00000003
1508c2ecf20Sopenharmony_ci#define  B134	  0x00000004
1518c2ecf20Sopenharmony_ci#define  B150	  0x00000005
1528c2ecf20Sopenharmony_ci#define  B200	  0x00000006
1538c2ecf20Sopenharmony_ci#define  B300	  0x00000007
1548c2ecf20Sopenharmony_ci#define  B600	  0x00000008
1558c2ecf20Sopenharmony_ci#define  B1200	  0x00000009
1568c2ecf20Sopenharmony_ci#define  B1800	  0x0000000a
1578c2ecf20Sopenharmony_ci#define  B2400	  0x0000000b
1588c2ecf20Sopenharmony_ci#define  B4800	  0x0000000c
1598c2ecf20Sopenharmony_ci#define  B9600	  0x0000000d
1608c2ecf20Sopenharmony_ci#define  B19200	  0x0000000e
1618c2ecf20Sopenharmony_ci#define  B38400	  0x0000000f
1628c2ecf20Sopenharmony_ci#define EXTA      B19200
1638c2ecf20Sopenharmony_ci#define EXTB      B38400
1648c2ecf20Sopenharmony_ci#define  CSIZE    0x00000030
1658c2ecf20Sopenharmony_ci#define   CS5	  0x00000000
1668c2ecf20Sopenharmony_ci#define   CS6	  0x00000010
1678c2ecf20Sopenharmony_ci#define   CS7	  0x00000020
1688c2ecf20Sopenharmony_ci#define   CS8	  0x00000030
1698c2ecf20Sopenharmony_ci#define CSTOPB	  0x00000040
1708c2ecf20Sopenharmony_ci#define CREAD	  0x00000080
1718c2ecf20Sopenharmony_ci#define PARENB	  0x00000100
1728c2ecf20Sopenharmony_ci#define PARODD	  0x00000200
1738c2ecf20Sopenharmony_ci#define HUPCL	  0x00000400
1748c2ecf20Sopenharmony_ci#define CLOCAL	  0x00000800
1758c2ecf20Sopenharmony_ci#define CBAUDEX   0x00001000
1768c2ecf20Sopenharmony_ci/* We'll never see these speeds with the Zilogs, but for completeness... */
1778c2ecf20Sopenharmony_ci#define  BOTHER   0x00001000
1788c2ecf20Sopenharmony_ci#define  B57600   0x00001001
1798c2ecf20Sopenharmony_ci#define  B115200  0x00001002
1808c2ecf20Sopenharmony_ci#define  B230400  0x00001003
1818c2ecf20Sopenharmony_ci#define  B460800  0x00001004
1828c2ecf20Sopenharmony_ci/* This is what we can do with the Zilogs. */
1838c2ecf20Sopenharmony_ci#define  B76800   0x00001005
1848c2ecf20Sopenharmony_ci/* This is what we can do with the SAB82532. */
1858c2ecf20Sopenharmony_ci#define  B153600  0x00001006
1868c2ecf20Sopenharmony_ci#define  B307200  0x00001007
1878c2ecf20Sopenharmony_ci#define  B614400  0x00001008
1888c2ecf20Sopenharmony_ci#define  B921600  0x00001009
1898c2ecf20Sopenharmony_ci/* And these are the rest... */
1908c2ecf20Sopenharmony_ci#define  B500000  0x0000100a
1918c2ecf20Sopenharmony_ci#define  B576000  0x0000100b
1928c2ecf20Sopenharmony_ci#define B1000000  0x0000100c
1938c2ecf20Sopenharmony_ci#define B1152000  0x0000100d
1948c2ecf20Sopenharmony_ci#define B1500000  0x0000100e
1958c2ecf20Sopenharmony_ci#define B2000000  0x0000100f
1968c2ecf20Sopenharmony_ci/* These have totally bogus values and nobody uses them
1978c2ecf20Sopenharmony_ci   so far. Later on we'd have to use say 0x10000x and
1988c2ecf20Sopenharmony_ci   adjust CBAUD constant and drivers accordingly.
1998c2ecf20Sopenharmony_ci#define B2500000  0x00001010
2008c2ecf20Sopenharmony_ci#define B3000000  0x00001011
2018c2ecf20Sopenharmony_ci#define B3500000  0x00001012
2028c2ecf20Sopenharmony_ci#define B4000000  0x00001013  */
2038c2ecf20Sopenharmony_ci#define CIBAUD	  0x100f0000  /* input baud rate (not used) */
2048c2ecf20Sopenharmony_ci#define CMSPAR	  0x40000000  /* mark or space (stick) parity */
2058c2ecf20Sopenharmony_ci#define CRTSCTS	  0x80000000  /* flow control */
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci#define IBSHIFT	  16		/* Shift from CBAUD to CIBAUD */
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/* c_lflag bits */
2108c2ecf20Sopenharmony_ci#define ISIG	0x00000001
2118c2ecf20Sopenharmony_ci#define ICANON	0x00000002
2128c2ecf20Sopenharmony_ci#define XCASE	0x00000004
2138c2ecf20Sopenharmony_ci#define ECHO	0x00000008
2148c2ecf20Sopenharmony_ci#define ECHOE	0x00000010
2158c2ecf20Sopenharmony_ci#define ECHOK	0x00000020
2168c2ecf20Sopenharmony_ci#define ECHONL	0x00000040
2178c2ecf20Sopenharmony_ci#define NOFLSH	0x00000080
2188c2ecf20Sopenharmony_ci#define TOSTOP	0x00000100
2198c2ecf20Sopenharmony_ci#define ECHOCTL	0x00000200
2208c2ecf20Sopenharmony_ci#define ECHOPRT	0x00000400
2218c2ecf20Sopenharmony_ci#define ECHOKE	0x00000800
2228c2ecf20Sopenharmony_ci#define DEFECHO 0x00001000  /* SUNOS thing, what is it? */
2238c2ecf20Sopenharmony_ci#define FLUSHO	0x00002000
2248c2ecf20Sopenharmony_ci#define PENDIN	0x00004000
2258c2ecf20Sopenharmony_ci#define IEXTEN	0x00008000
2268c2ecf20Sopenharmony_ci#define EXTPROC	0x00010000
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/* modem lines */
2298c2ecf20Sopenharmony_ci#define TIOCM_LE	0x001
2308c2ecf20Sopenharmony_ci#define TIOCM_DTR	0x002
2318c2ecf20Sopenharmony_ci#define TIOCM_RTS	0x004
2328c2ecf20Sopenharmony_ci#define TIOCM_ST	0x008
2338c2ecf20Sopenharmony_ci#define TIOCM_SR	0x010
2348c2ecf20Sopenharmony_ci#define TIOCM_CTS	0x020
2358c2ecf20Sopenharmony_ci#define TIOCM_CAR	0x040
2368c2ecf20Sopenharmony_ci#define TIOCM_RNG	0x080
2378c2ecf20Sopenharmony_ci#define TIOCM_DSR	0x100
2388c2ecf20Sopenharmony_ci#define TIOCM_CD	TIOCM_CAR
2398c2ecf20Sopenharmony_ci#define TIOCM_RI	TIOCM_RNG
2408c2ecf20Sopenharmony_ci#define TIOCM_OUT1	0x2000
2418c2ecf20Sopenharmony_ci#define TIOCM_OUT2	0x4000
2428c2ecf20Sopenharmony_ci#define TIOCM_LOOP	0x8000
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
2458c2ecf20Sopenharmony_ci#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/* tcflow() and TCXONC use these */
2498c2ecf20Sopenharmony_ci#define	TCOOFF		0
2508c2ecf20Sopenharmony_ci#define	TCOON		1
2518c2ecf20Sopenharmony_ci#define	TCIOFF		2
2528c2ecf20Sopenharmony_ci#define	TCION		3
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci/* tcflush() and TCFLSH use these */
2558c2ecf20Sopenharmony_ci#define	TCIFLUSH	0
2568c2ecf20Sopenharmony_ci#define	TCOFLUSH	1
2578c2ecf20Sopenharmony_ci#define	TCIOFLUSH	2
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci/* tcsetattr uses these */
2608c2ecf20Sopenharmony_ci#define	TCSANOW		0
2618c2ecf20Sopenharmony_ci#define	TCSADRAIN	1
2628c2ecf20Sopenharmony_ci#define	TCSAFLUSH	2
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci#endif /* _UAPI_SPARC_TERMBITS_H */
265