termbits.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1995, 96, 99, 2001, 06 Ralf Baechle
  7. * Copyright (C) 1999 Silicon Graphics, Inc.
  8. * Copyright (C) 2001 MIPS Technologies, Inc.
  9. */
  10. #ifndef _ASM_TERMBITS_H
  11. #define _ASM_TERMBITS_H
  12. #include <linux/posix_types.h>
  13. typedef unsigned char cc_t;
  14. typedef unsigned int speed_t;
  15. typedef unsigned int tcflag_t;
  16. /*
  17. * The ABI says nothing about NCC but seems to use NCCS as
  18. * replacement for it in struct termio
  19. */
  20. #define NCCS 23
  21. struct termios {
  22. tcflag_t c_iflag; /* input mode flags */
  23. tcflag_t c_oflag; /* output mode flags */
  24. tcflag_t c_cflag; /* control mode flags */
  25. tcflag_t c_lflag; /* local mode flags */
  26. cc_t c_line; /* line discipline */
  27. cc_t c_cc[NCCS]; /* control characters */
  28. };
  29. struct termios2 {
  30. tcflag_t c_iflag; /* input mode flags */
  31. tcflag_t c_oflag; /* output mode flags */
  32. tcflag_t c_cflag; /* control mode flags */
  33. tcflag_t c_lflag; /* local mode flags */
  34. cc_t c_line; /* line discipline */
  35. cc_t c_cc[NCCS]; /* control characters */
  36. speed_t c_ispeed; /* input speed */
  37. speed_t c_ospeed; /* output speed */
  38. };
  39. struct ktermios {
  40. tcflag_t c_iflag; /* input mode flags */
  41. tcflag_t c_oflag; /* output mode flags */
  42. tcflag_t c_cflag; /* control mode flags */
  43. tcflag_t c_lflag; /* local mode flags */
  44. cc_t c_line; /* line discipline */
  45. cc_t c_cc[NCCS]; /* control characters */
  46. speed_t c_ispeed; /* input speed */
  47. speed_t c_ospeed; /* output speed */
  48. };
  49. /* c_cc characters */
  50. #define VINTR 0 /* Interrupt character [ISIG]. */
  51. #define VQUIT 1 /* Quit character [ISIG]. */
  52. #define VERASE 2 /* Erase character [ICANON]. */
  53. #define VKILL 3 /* Kill-line character [ICANON]. */
  54. #define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */
  55. #define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */
  56. #define VEOL2 6 /* Second EOL character [ICANON]. */
  57. #define VSWTC 7 /* ??? */
  58. #define VSWTCH VSWTC
  59. #define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */
  60. #define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */
  61. #define VSUSP 10 /* Suspend character [ISIG]. */
  62. #if 0
  63. /*
  64. * VDSUSP is not supported
  65. */
  66. #define VDSUSP 11 /* Delayed suspend character [ISIG]. */
  67. #endif
  68. #define VREPRINT 12 /* Reprint-line character [ICANON]. */
  69. #define VDISCARD 13 /* Discard character [IEXTEN]. */
  70. #define VWERASE 14 /* Word-erase character [ICANON]. */
  71. #define VLNEXT 15 /* Literal-next character [IEXTEN]. */
  72. #define VEOF 16 /* End-of-file character [ICANON]. */
  73. #define VEOL 17 /* End-of-line character [ICANON]. */
  74. /* c_iflag bits */
  75. #define IGNBRK 0000001 /* Ignore break condition. */
  76. #define BRKINT 0000002 /* Signal interrupt on break. */
  77. #define IGNPAR 0000004 /* Ignore characters with parity errors. */
  78. #define PARMRK 0000010 /* Mark parity and framing errors. */
  79. #define INPCK 0000020 /* Enable input parity check. */
  80. #define ISTRIP 0000040 /* Strip 8th bit off characters. */
  81. #define INLCR 0000100 /* Map NL to CR on input. */
  82. #define IGNCR 0000200 /* Ignore CR. */
  83. #define ICRNL 0000400 /* Map CR to NL on input. */
  84. #define IUCLC 0001000 /* Map upper case to lower case on input. */
  85. #define IXON 0002000 /* Enable start/stop output control. */
  86. #define IXANY 0004000 /* Any character will restart after stop. */
  87. #define IXOFF 0010000 /* Enable start/stop input control. */
  88. #define IMAXBEL 0020000 /* Ring bell when input queue is full. */
  89. #define IUTF8 0040000 /* Input is UTF-8 */
  90. /* c_oflag bits */
  91. #define OPOST 0000001 /* Perform output processing. */
  92. #define OLCUC 0000002 /* Map lower case to upper case on output. */
  93. #define ONLCR 0000004 /* Map NL to CR-NL on output. */
  94. #define OCRNL 0000010
  95. #define ONOCR 0000020
  96. #define ONLRET 0000040
  97. #define OFILL 0000100
  98. #define OFDEL 0000200
  99. #define NLDLY 0000400
  100. #define NL0 0000000
  101. #define NL1 0000400
  102. #define CRDLY 0003000
  103. #define CR0 0000000
  104. #define CR1 0001000
  105. #define CR2 0002000
  106. #define CR3 0003000
  107. #define TABDLY 0014000
  108. #define TAB0 0000000
  109. #define TAB1 0004000
  110. #define TAB2 0010000
  111. #define TAB3 0014000
  112. #define XTABS 0014000
  113. #define BSDLY 0020000
  114. #define BS0 0000000
  115. #define BS1 0020000
  116. #define VTDLY 0040000
  117. #define VT0 0000000
  118. #define VT1 0040000
  119. #define FFDLY 0100000
  120. #define FF0 0000000
  121. #define FF1 0100000
  122. /*
  123. #define PAGEOUT ???
  124. #define WRAP ???
  125. */
  126. /* c_cflag bit meaning */
  127. #define CBAUD 0010017
  128. #define B0 0000000 /* hang up */
  129. #define B50 0000001
  130. #define B75 0000002
  131. #define B110 0000003
  132. #define B134 0000004
  133. #define B150 0000005
  134. #define B200 0000006
  135. #define B300 0000007
  136. #define B600 0000010
  137. #define B1200 0000011
  138. #define B1800 0000012
  139. #define B2400 0000013
  140. #define B4800 0000014
  141. #define B9600 0000015
  142. #define B19200 0000016
  143. #define B38400 0000017
  144. #define EXTA B19200
  145. #define EXTB B38400
  146. #define CSIZE 0000060 /* Number of bits per byte (mask). */
  147. #define CS5 0000000 /* 5 bits per byte. */
  148. #define CS6 0000020 /* 6 bits per byte. */
  149. #define CS7 0000040 /* 7 bits per byte. */
  150. #define CS8 0000060 /* 8 bits per byte. */
  151. #define CSTOPB 0000100 /* Two stop bits instead of one. */
  152. #define CREAD 0000200 /* Enable receiver. */
  153. #define PARENB 0000400 /* Parity enable. */
  154. #define PARODD 0001000 /* Odd parity instead of even. */
  155. #define HUPCL 0002000 /* Hang up on last close. */
  156. #define CLOCAL 0004000 /* Ignore modem status lines. */
  157. #define CBAUDEX 0010000
  158. #define BOTHER 0010000
  159. #define B57600 0010001
  160. #define B115200 0010002
  161. #define B230400 0010003
  162. #define B460800 0010004
  163. #define B500000 0010005
  164. #define B576000 0010006
  165. #define B921600 0010007
  166. #define B1000000 0010010
  167. #define B1152000 0010011
  168. #define B1500000 0010012
  169. #define B2000000 0010013
  170. #define B2500000 0010014
  171. #define B3000000 0010015
  172. #define B3500000 0010016
  173. #define B4000000 0010017
  174. #define CIBAUD 002003600000 /* input baud rate */
  175. #define CMSPAR 010000000000 /* mark or space (stick) parity */
  176. #define CRTSCTS 020000000000 /* flow control */
  177. #define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
  178. /* c_lflag bits */
  179. #define ISIG 0000001 /* Enable signals. */
  180. #define ICANON 0000002 /* Do erase and kill processing. */
  181. #define XCASE 0000004
  182. #define ECHO 0000010 /* Enable echo. */
  183. #define ECHOE 0000020 /* Visual erase for ERASE. */
  184. #define ECHOK 0000040 /* Echo NL after KILL. */
  185. #define ECHONL 0000100 /* Echo NL even if ECHO is off. */
  186. #define NOFLSH 0000200 /* Disable flush after interrupt. */
  187. #define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */
  188. #define ECHOCTL 0001000 /* Echo control characters as ^X. */
  189. #define ECHOPRT 0002000 /* Hardcopy visual erase. */
  190. #define ECHOKE 0004000 /* Visual erase for KILL. */
  191. #define FLUSHO 0020000
  192. #define PENDIN 0040000 /* Retype pending input (state). */
  193. #define TOSTOP 0100000 /* Send SIGTTOU for background output. */
  194. #define ITOSTOP TOSTOP
  195. #define EXTPROC 0200000 /* External processing on pty */
  196. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  197. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  198. /* tcflow() and TCXONC use these */
  199. #define TCOOFF 0 /* Suspend output. */
  200. #define TCOON 1 /* Restart suspended output. */
  201. #define TCIOFF 2 /* Send a STOP character. */
  202. #define TCION 3 /* Send a START character. */
  203. /* tcflush() and TCFLSH use these */
  204. #define TCIFLUSH 0 /* Discard data received but not yet read. */
  205. #define TCOFLUSH 1 /* Discard data written but not yet sent. */
  206. #define TCIOFLUSH 2 /* Discard all pending data. */
  207. /* tcsetattr uses these */
  208. #define TCSANOW TCSETS /* Change immediately. */
  209. #define TCSADRAIN TCSETSW /* Change when pending output is written. */
  210. #define TCSAFLUSH TCSETSF /* Flush pending input before changing. */
  211. #endif /* _ASM_TERMBITS_H */