termbits.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * This file is subject to the terms and conditions of the GNU General Public
  4. * License. See the file "COPYING" in the main directory of this archive
  5. * for more details.
  6. *
  7. * Copyright (C) 1995, 96, 99, 2001, 06 Ralf Baechle
  8. * Copyright (C) 1999 Silicon Graphics, Inc.
  9. * Copyright (C) 2001 MIPS Technologies, Inc.
  10. */
  11. #ifndef _ASM_TERMBITS_H
  12. #define _ASM_TERMBITS_H
  13. #include <asm-generic/termbits-common.h>
  14. typedef unsigned int tcflag_t;
  15. /*
  16. * The ABI says nothing about NCC but seems to use NCCS as
  17. * replacement for it in struct termio
  18. */
  19. #define NCCS 23
  20. struct termios {
  21. tcflag_t c_iflag; /* input mode flags */
  22. tcflag_t c_oflag; /* output mode flags */
  23. tcflag_t c_cflag; /* control mode flags */
  24. tcflag_t c_lflag; /* local mode flags */
  25. cc_t c_line; /* line discipline */
  26. cc_t c_cc[NCCS]; /* control characters */
  27. };
  28. struct termios2 {
  29. tcflag_t c_iflag; /* input mode flags */
  30. tcflag_t c_oflag; /* output mode flags */
  31. tcflag_t c_cflag; /* control mode flags */
  32. tcflag_t c_lflag; /* local mode flags */
  33. cc_t c_line; /* line discipline */
  34. cc_t c_cc[NCCS]; /* control characters */
  35. speed_t c_ispeed; /* input speed */
  36. speed_t c_ospeed; /* output speed */
  37. };
  38. struct ktermios {
  39. tcflag_t c_iflag; /* input mode flags */
  40. tcflag_t c_oflag; /* output mode flags */
  41. tcflag_t c_cflag; /* control mode flags */
  42. tcflag_t c_lflag; /* local mode flags */
  43. cc_t c_line; /* line discipline */
  44. cc_t c_cc[NCCS]; /* control characters */
  45. speed_t c_ispeed; /* input speed */
  46. speed_t c_ospeed; /* output speed */
  47. };
  48. /* c_cc characters */
  49. #define VINTR 0 /* Interrupt character [ISIG] */
  50. #define VQUIT 1 /* Quit character [ISIG] */
  51. #define VERASE 2 /* Erase character [ICANON] */
  52. #define VKILL 3 /* Kill-line character [ICANON] */
  53. #define VMIN 4 /* Minimum number of bytes read at once [!ICANON] */
  54. #define VTIME 5 /* Time-out value (tenths of a second) [!ICANON] */
  55. #define VEOL2 6 /* Second EOL character [ICANON] */
  56. #define VSWTC 7 /* ??? */
  57. #define VSWTCH VSWTC
  58. #define VSTART 8 /* Start (X-ON) character [IXON, IXOFF] */
  59. #define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF] */
  60. #define VSUSP 10 /* Suspend character [ISIG] */
  61. #if 0
  62. /*
  63. * VDSUSP is not supported
  64. */
  65. #define VDSUSP 11 /* Delayed suspend character [ISIG] */
  66. #endif
  67. #define VREPRINT 12 /* Reprint-line character [ICANON] */
  68. #define VDISCARD 13 /* Discard character [IEXTEN] */
  69. #define VWERASE 14 /* Word-erase character [ICANON] */
  70. #define VLNEXT 15 /* Literal-next character [IEXTEN] */
  71. #define VEOF 16 /* End-of-file character [ICANON] */
  72. #define VEOL 17 /* End-of-line character [ICANON] */
  73. /* c_iflag bits */
  74. #define IUCLC 0x0200 /* Map upper case to lower case on input */
  75. #define IXON 0x0400 /* Enable start/stop output control */
  76. #define IXOFF 0x1000 /* Enable start/stop input control */
  77. #define IMAXBEL 0x2000 /* Ring bell when input queue is full */
  78. #define IUTF8 0x4000 /* Input is UTF-8 */
  79. /* c_oflag bits */
  80. #define OLCUC 0x00002 /* Map lower case to upper case on output */
  81. #define ONLCR 0x00004 /* Map NL to CR-NL on output */
  82. #define NLDLY 0x00100
  83. #define NL0 0x00000
  84. #define NL1 0x00100
  85. #define CRDLY 0x00600
  86. #define CR0 0x00000
  87. #define CR1 0x00200
  88. #define CR2 0x00400
  89. #define CR3 0x00600
  90. #define TABDLY 0x01800
  91. #define TAB0 0x00000
  92. #define TAB1 0x00800
  93. #define TAB2 0x01000
  94. #define TAB3 0x01800
  95. #define XTABS 0x01800
  96. #define BSDLY 0x02000
  97. #define BS0 0x00000
  98. #define BS1 0x02000
  99. #define VTDLY 0x04000
  100. #define VT0 0x00000
  101. #define VT1 0x04000
  102. #define FFDLY 0x08000
  103. #define FF0 0x00000
  104. #define FF1 0x08000
  105. /*
  106. #define PAGEOUT ???
  107. #define WRAP ???
  108. */
  109. /* c_cflag bit meaning */
  110. #define CBAUD 0x0000100f
  111. #define CSIZE 0x00000030 /* Number of bits per byte (mask) */
  112. #define CS5 0x00000000 /* 5 bits per byte */
  113. #define CS6 0x00000010 /* 6 bits per byte */
  114. #define CS7 0x00000020 /* 7 bits per byte */
  115. #define CS8 0x00000030 /* 8 bits per byte */
  116. #define CSTOPB 0x00000040 /* Two stop bits instead of one */
  117. #define CREAD 0x00000080 /* Enable receiver */
  118. #define PARENB 0x00000100 /* Parity enable */
  119. #define PARODD 0x00000200 /* Odd parity instead of even */
  120. #define HUPCL 0x00000400 /* Hang up on last close */
  121. #define CLOCAL 0x00000800 /* Ignore modem status lines */
  122. #define CBAUDEX 0x00001000
  123. #define BOTHER 0x00001000
  124. #define B57600 0x00001001
  125. #define B115200 0x00001002
  126. #define B230400 0x00001003
  127. #define B460800 0x00001004
  128. #define B500000 0x00001005
  129. #define B576000 0x00001006
  130. #define B921600 0x00001007
  131. #define B1000000 0x00001008
  132. #define B1152000 0x00001009
  133. #define B1500000 0x0000100a
  134. #define B2000000 0x0000100b
  135. #define B2500000 0x0000100c
  136. #define B3000000 0x0000100d
  137. #define B3500000 0x0000100e
  138. #define B4000000 0x0000100f
  139. #define CIBAUD 0x100f0000 /* input baud rate */
  140. /* c_lflag bits */
  141. #define ISIG 0x00001 /* Enable signals */
  142. #define ICANON 0x00002 /* Do erase and kill processing */
  143. #define XCASE 0x00004
  144. #define ECHO 0x00008 /* Enable echo */
  145. #define ECHOE 0x00010 /* Visual erase for ERASE */
  146. #define ECHOK 0x00020 /* Echo NL after KILL */
  147. #define ECHONL 0x00040 /* Echo NL even if ECHO is off */
  148. #define NOFLSH 0x00080 /* Disable flush after interrupt */
  149. #define IEXTEN 0x00100 /* Enable DISCARD and LNEXT */
  150. #define ECHOCTL 0x00200 /* Echo control characters as ^X */
  151. #define ECHOPRT 0x00400 /* Hardcopy visual erase */
  152. #define ECHOKE 0x00800 /* Visual erase for KILL */
  153. #define FLUSHO 0x02000
  154. #define PENDIN 0x04000 /* Retype pending input (state) */
  155. #define TOSTOP 0x08000 /* Send SIGTTOU for background output */
  156. #define ITOSTOP TOSTOP
  157. #define EXTPROC 0x10000 /* External processing on pty */
  158. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  159. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  160. /* tcsetattr uses these */
  161. #define TCSANOW TCSETS /* Change immediately */
  162. #define TCSADRAIN TCSETSW /* Change when pending output is written */
  163. #define TCSAFLUSH TCSETSF /* Flush pending input before changing */
  164. #endif /* _ASM_TERMBITS_H */