1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun #ifndef _UAPI_SPARC_TERMBITS_H 3*4882a593Smuzhiyun #define _UAPI_SPARC_TERMBITS_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <linux/posix_types.h> 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun typedef unsigned char cc_t; 8*4882a593Smuzhiyun typedef unsigned int speed_t; 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun #if defined(__sparc__) && defined(__arch64__) 11*4882a593Smuzhiyun typedef unsigned int tcflag_t; 12*4882a593Smuzhiyun #else 13*4882a593Smuzhiyun typedef unsigned long tcflag_t; 14*4882a593Smuzhiyun #endif 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun #define NCC 8 17*4882a593Smuzhiyun struct termio { 18*4882a593Smuzhiyun unsigned short c_iflag; /* input mode flags */ 19*4882a593Smuzhiyun unsigned short c_oflag; /* output mode flags */ 20*4882a593Smuzhiyun unsigned short c_cflag; /* control mode flags */ 21*4882a593Smuzhiyun unsigned short c_lflag; /* local mode flags */ 22*4882a593Smuzhiyun unsigned char c_line; /* line discipline */ 23*4882a593Smuzhiyun unsigned char c_cc[NCC]; /* control characters */ 24*4882a593Smuzhiyun }; 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun #define NCCS 17 27*4882a593Smuzhiyun struct termios { 28*4882a593Smuzhiyun tcflag_t c_iflag; /* input mode flags */ 29*4882a593Smuzhiyun tcflag_t c_oflag; /* output mode flags */ 30*4882a593Smuzhiyun tcflag_t c_cflag; /* control mode flags */ 31*4882a593Smuzhiyun tcflag_t c_lflag; /* local mode flags */ 32*4882a593Smuzhiyun cc_t c_line; /* line discipline */ 33*4882a593Smuzhiyun #ifndef __KERNEL__ 34*4882a593Smuzhiyun cc_t c_cc[NCCS]; /* control characters */ 35*4882a593Smuzhiyun #else 36*4882a593Smuzhiyun cc_t c_cc[NCCS+2]; /* kernel needs 2 more to hold vmin/vtime */ 37*4882a593Smuzhiyun #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t)) 38*4882a593Smuzhiyun #endif 39*4882a593Smuzhiyun }; 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun struct termios2 { 42*4882a593Smuzhiyun tcflag_t c_iflag; /* input mode flags */ 43*4882a593Smuzhiyun tcflag_t c_oflag; /* output mode flags */ 44*4882a593Smuzhiyun tcflag_t c_cflag; /* control mode flags */ 45*4882a593Smuzhiyun tcflag_t c_lflag; /* local mode flags */ 46*4882a593Smuzhiyun cc_t c_line; /* line discipline */ 47*4882a593Smuzhiyun cc_t c_cc[NCCS+2]; /* control characters */ 48*4882a593Smuzhiyun speed_t c_ispeed; /* input speed */ 49*4882a593Smuzhiyun speed_t c_ospeed; /* output speed */ 50*4882a593Smuzhiyun }; 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun struct ktermios { 53*4882a593Smuzhiyun tcflag_t c_iflag; /* input mode flags */ 54*4882a593Smuzhiyun tcflag_t c_oflag; /* output mode flags */ 55*4882a593Smuzhiyun tcflag_t c_cflag; /* control mode flags */ 56*4882a593Smuzhiyun tcflag_t c_lflag; /* local mode flags */ 57*4882a593Smuzhiyun cc_t c_line; /* line discipline */ 58*4882a593Smuzhiyun cc_t c_cc[NCCS+2]; /* control characters */ 59*4882a593Smuzhiyun speed_t c_ispeed; /* input speed */ 60*4882a593Smuzhiyun speed_t c_ospeed; /* output speed */ 61*4882a593Smuzhiyun }; 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun /* c_cc characters */ 64*4882a593Smuzhiyun #define VINTR 0 65*4882a593Smuzhiyun #define VQUIT 1 66*4882a593Smuzhiyun #define VERASE 2 67*4882a593Smuzhiyun #define VKILL 3 68*4882a593Smuzhiyun #define VEOF 4 69*4882a593Smuzhiyun #define VEOL 5 70*4882a593Smuzhiyun #define VEOL2 6 71*4882a593Smuzhiyun #define VSWTC 7 72*4882a593Smuzhiyun #define VSTART 8 73*4882a593Smuzhiyun #define VSTOP 9 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun #define VSUSP 10 78*4882a593Smuzhiyun #define VDSUSP 11 /* SunOS POSIX nicety I do believe... */ 79*4882a593Smuzhiyun #define VREPRINT 12 80*4882a593Smuzhiyun #define VDISCARD 13 81*4882a593Smuzhiyun #define VWERASE 14 82*4882a593Smuzhiyun #define VLNEXT 15 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun /* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is 85*4882a593Smuzhiyun * shared with eof/eol 86*4882a593Smuzhiyun */ 87*4882a593Smuzhiyun #ifndef __KERNEL__ 88*4882a593Smuzhiyun #define VMIN VEOF 89*4882a593Smuzhiyun #define VTIME VEOL 90*4882a593Smuzhiyun #endif 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun /* c_iflag bits */ 93*4882a593Smuzhiyun #define IGNBRK 0x00000001 94*4882a593Smuzhiyun #define BRKINT 0x00000002 95*4882a593Smuzhiyun #define IGNPAR 0x00000004 96*4882a593Smuzhiyun #define PARMRK 0x00000008 97*4882a593Smuzhiyun #define INPCK 0x00000010 98*4882a593Smuzhiyun #define ISTRIP 0x00000020 99*4882a593Smuzhiyun #define INLCR 0x00000040 100*4882a593Smuzhiyun #define IGNCR 0x00000080 101*4882a593Smuzhiyun #define ICRNL 0x00000100 102*4882a593Smuzhiyun #define IUCLC 0x00000200 103*4882a593Smuzhiyun #define IXON 0x00000400 104*4882a593Smuzhiyun #define IXANY 0x00000800 105*4882a593Smuzhiyun #define IXOFF 0x00001000 106*4882a593Smuzhiyun #define IMAXBEL 0x00002000 107*4882a593Smuzhiyun #define IUTF8 0x00004000 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun /* c_oflag bits */ 110*4882a593Smuzhiyun #define OPOST 0x00000001 111*4882a593Smuzhiyun #define OLCUC 0x00000002 112*4882a593Smuzhiyun #define ONLCR 0x00000004 113*4882a593Smuzhiyun #define OCRNL 0x00000008 114*4882a593Smuzhiyun #define ONOCR 0x00000010 115*4882a593Smuzhiyun #define ONLRET 0x00000020 116*4882a593Smuzhiyun #define OFILL 0x00000040 117*4882a593Smuzhiyun #define OFDEL 0x00000080 118*4882a593Smuzhiyun #define NLDLY 0x00000100 119*4882a593Smuzhiyun #define NL0 0x00000000 120*4882a593Smuzhiyun #define NL1 0x00000100 121*4882a593Smuzhiyun #define CRDLY 0x00000600 122*4882a593Smuzhiyun #define CR0 0x00000000 123*4882a593Smuzhiyun #define CR1 0x00000200 124*4882a593Smuzhiyun #define CR2 0x00000400 125*4882a593Smuzhiyun #define CR3 0x00000600 126*4882a593Smuzhiyun #define TABDLY 0x00001800 127*4882a593Smuzhiyun #define TAB0 0x00000000 128*4882a593Smuzhiyun #define TAB1 0x00000800 129*4882a593Smuzhiyun #define TAB2 0x00001000 130*4882a593Smuzhiyun #define TAB3 0x00001800 131*4882a593Smuzhiyun #define XTABS 0x00001800 132*4882a593Smuzhiyun #define BSDLY 0x00002000 133*4882a593Smuzhiyun #define BS0 0x00000000 134*4882a593Smuzhiyun #define BS1 0x00002000 135*4882a593Smuzhiyun #define VTDLY 0x00004000 136*4882a593Smuzhiyun #define VT0 0x00000000 137*4882a593Smuzhiyun #define VT1 0x00004000 138*4882a593Smuzhiyun #define FFDLY 0x00008000 139*4882a593Smuzhiyun #define FF0 0x00000000 140*4882a593Smuzhiyun #define FF1 0x00008000 141*4882a593Smuzhiyun #define PAGEOUT 0x00010000 /* SUNOS specific */ 142*4882a593Smuzhiyun #define WRAP 0x00020000 /* SUNOS specific */ 143*4882a593Smuzhiyun 144*4882a593Smuzhiyun /* c_cflag bit meaning */ 145*4882a593Smuzhiyun #define CBAUD 0x0000100f 146*4882a593Smuzhiyun #define B0 0x00000000 /* hang up */ 147*4882a593Smuzhiyun #define B50 0x00000001 148*4882a593Smuzhiyun #define B75 0x00000002 149*4882a593Smuzhiyun #define B110 0x00000003 150*4882a593Smuzhiyun #define B134 0x00000004 151*4882a593Smuzhiyun #define B150 0x00000005 152*4882a593Smuzhiyun #define B200 0x00000006 153*4882a593Smuzhiyun #define B300 0x00000007 154*4882a593Smuzhiyun #define B600 0x00000008 155*4882a593Smuzhiyun #define B1200 0x00000009 156*4882a593Smuzhiyun #define B1800 0x0000000a 157*4882a593Smuzhiyun #define B2400 0x0000000b 158*4882a593Smuzhiyun #define B4800 0x0000000c 159*4882a593Smuzhiyun #define B9600 0x0000000d 160*4882a593Smuzhiyun #define B19200 0x0000000e 161*4882a593Smuzhiyun #define B38400 0x0000000f 162*4882a593Smuzhiyun #define EXTA B19200 163*4882a593Smuzhiyun #define EXTB B38400 164*4882a593Smuzhiyun #define CSIZE 0x00000030 165*4882a593Smuzhiyun #define CS5 0x00000000 166*4882a593Smuzhiyun #define CS6 0x00000010 167*4882a593Smuzhiyun #define CS7 0x00000020 168*4882a593Smuzhiyun #define CS8 0x00000030 169*4882a593Smuzhiyun #define CSTOPB 0x00000040 170*4882a593Smuzhiyun #define CREAD 0x00000080 171*4882a593Smuzhiyun #define PARENB 0x00000100 172*4882a593Smuzhiyun #define PARODD 0x00000200 173*4882a593Smuzhiyun #define HUPCL 0x00000400 174*4882a593Smuzhiyun #define CLOCAL 0x00000800 175*4882a593Smuzhiyun #define CBAUDEX 0x00001000 176*4882a593Smuzhiyun /* We'll never see these speeds with the Zilogs, but for completeness... */ 177*4882a593Smuzhiyun #define BOTHER 0x00001000 178*4882a593Smuzhiyun #define B57600 0x00001001 179*4882a593Smuzhiyun #define B115200 0x00001002 180*4882a593Smuzhiyun #define B230400 0x00001003 181*4882a593Smuzhiyun #define B460800 0x00001004 182*4882a593Smuzhiyun /* This is what we can do with the Zilogs. */ 183*4882a593Smuzhiyun #define B76800 0x00001005 184*4882a593Smuzhiyun /* This is what we can do with the SAB82532. */ 185*4882a593Smuzhiyun #define B153600 0x00001006 186*4882a593Smuzhiyun #define B307200 0x00001007 187*4882a593Smuzhiyun #define B614400 0x00001008 188*4882a593Smuzhiyun #define B921600 0x00001009 189*4882a593Smuzhiyun /* And these are the rest... */ 190*4882a593Smuzhiyun #define B500000 0x0000100a 191*4882a593Smuzhiyun #define B576000 0x0000100b 192*4882a593Smuzhiyun #define B1000000 0x0000100c 193*4882a593Smuzhiyun #define B1152000 0x0000100d 194*4882a593Smuzhiyun #define B1500000 0x0000100e 195*4882a593Smuzhiyun #define B2000000 0x0000100f 196*4882a593Smuzhiyun /* These have totally bogus values and nobody uses them 197*4882a593Smuzhiyun so far. Later on we'd have to use say 0x10000x and 198*4882a593Smuzhiyun adjust CBAUD constant and drivers accordingly. 199*4882a593Smuzhiyun #define B2500000 0x00001010 200*4882a593Smuzhiyun #define B3000000 0x00001011 201*4882a593Smuzhiyun #define B3500000 0x00001012 202*4882a593Smuzhiyun #define B4000000 0x00001013 */ 203*4882a593Smuzhiyun #define CIBAUD 0x100f0000 /* input baud rate (not used) */ 204*4882a593Smuzhiyun #define CMSPAR 0x40000000 /* mark or space (stick) parity */ 205*4882a593Smuzhiyun #define CRTSCTS 0x80000000 /* flow control */ 206*4882a593Smuzhiyun 207*4882a593Smuzhiyun #define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ 208*4882a593Smuzhiyun 209*4882a593Smuzhiyun /* c_lflag bits */ 210*4882a593Smuzhiyun #define ISIG 0x00000001 211*4882a593Smuzhiyun #define ICANON 0x00000002 212*4882a593Smuzhiyun #define XCASE 0x00000004 213*4882a593Smuzhiyun #define ECHO 0x00000008 214*4882a593Smuzhiyun #define ECHOE 0x00000010 215*4882a593Smuzhiyun #define ECHOK 0x00000020 216*4882a593Smuzhiyun #define ECHONL 0x00000040 217*4882a593Smuzhiyun #define NOFLSH 0x00000080 218*4882a593Smuzhiyun #define TOSTOP 0x00000100 219*4882a593Smuzhiyun #define ECHOCTL 0x00000200 220*4882a593Smuzhiyun #define ECHOPRT 0x00000400 221*4882a593Smuzhiyun #define ECHOKE 0x00000800 222*4882a593Smuzhiyun #define DEFECHO 0x00001000 /* SUNOS thing, what is it? */ 223*4882a593Smuzhiyun #define FLUSHO 0x00002000 224*4882a593Smuzhiyun #define PENDIN 0x00004000 225*4882a593Smuzhiyun #define IEXTEN 0x00008000 226*4882a593Smuzhiyun #define EXTPROC 0x00010000 227*4882a593Smuzhiyun 228*4882a593Smuzhiyun /* modem lines */ 229*4882a593Smuzhiyun #define TIOCM_LE 0x001 230*4882a593Smuzhiyun #define TIOCM_DTR 0x002 231*4882a593Smuzhiyun #define TIOCM_RTS 0x004 232*4882a593Smuzhiyun #define TIOCM_ST 0x008 233*4882a593Smuzhiyun #define TIOCM_SR 0x010 234*4882a593Smuzhiyun #define TIOCM_CTS 0x020 235*4882a593Smuzhiyun #define TIOCM_CAR 0x040 236*4882a593Smuzhiyun #define TIOCM_RNG 0x080 237*4882a593Smuzhiyun #define TIOCM_DSR 0x100 238*4882a593Smuzhiyun #define TIOCM_CD TIOCM_CAR 239*4882a593Smuzhiyun #define TIOCM_RI TIOCM_RNG 240*4882a593Smuzhiyun #define TIOCM_OUT1 0x2000 241*4882a593Smuzhiyun #define TIOCM_OUT2 0x4000 242*4882a593Smuzhiyun #define TIOCM_LOOP 0x8000 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 245*4882a593Smuzhiyun #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 246*4882a593Smuzhiyun 247*4882a593Smuzhiyun 248*4882a593Smuzhiyun /* tcflow() and TCXONC use these */ 249*4882a593Smuzhiyun #define TCOOFF 0 250*4882a593Smuzhiyun #define TCOON 1 251*4882a593Smuzhiyun #define TCIOFF 2 252*4882a593Smuzhiyun #define TCION 3 253*4882a593Smuzhiyun 254*4882a593Smuzhiyun /* tcflush() and TCFLSH use these */ 255*4882a593Smuzhiyun #define TCIFLUSH 0 256*4882a593Smuzhiyun #define TCOFLUSH 1 257*4882a593Smuzhiyun #define TCIOFLUSH 2 258*4882a593Smuzhiyun 259*4882a593Smuzhiyun /* tcsetattr uses these */ 260*4882a593Smuzhiyun #define TCSANOW 0 261*4882a593Smuzhiyun #define TCSADRAIN 1 262*4882a593Smuzhiyun #define TCSAFLUSH 2 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun #endif /* _UAPI_SPARC_TERMBITS_H */ 265