termbits.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef __ASM_GENERIC_TERMBITS_H
  3. #define __ASM_GENERIC_TERMBITS_H
  4. #include <linux/posix_types.h>
  5. typedef unsigned char cc_t;
  6. typedef unsigned int speed_t;
  7. typedef unsigned int tcflag_t;
  8. #define NCCS 19
  9. struct termios {
  10. tcflag_t c_iflag; /* input mode flags */
  11. tcflag_t c_oflag; /* output mode flags */
  12. tcflag_t c_cflag; /* control mode flags */
  13. tcflag_t c_lflag; /* local mode flags */
  14. cc_t c_line; /* line discipline */
  15. cc_t c_cc[NCCS]; /* control characters */
  16. };
  17. struct termios2 {
  18. tcflag_t c_iflag; /* input mode flags */
  19. tcflag_t c_oflag; /* output mode flags */
  20. tcflag_t c_cflag; /* control mode flags */
  21. tcflag_t c_lflag; /* local mode flags */
  22. cc_t c_line; /* line discipline */
  23. cc_t c_cc[NCCS]; /* control characters */
  24. speed_t c_ispeed; /* input speed */
  25. speed_t c_ospeed; /* output speed */
  26. };
  27. struct ktermios {
  28. tcflag_t c_iflag; /* input mode flags */
  29. tcflag_t c_oflag; /* output mode flags */
  30. tcflag_t c_cflag; /* control mode flags */
  31. tcflag_t c_lflag; /* local mode flags */
  32. cc_t c_line; /* line discipline */
  33. cc_t c_cc[NCCS]; /* control characters */
  34. speed_t c_ispeed; /* input speed */
  35. speed_t c_ospeed; /* output speed */
  36. };
  37. /* c_cc characters */
  38. #define VINTR 0
  39. #define VQUIT 1
  40. #define VERASE 2
  41. #define VKILL 3
  42. #define VEOF 4
  43. #define VTIME 5
  44. #define VMIN 6
  45. #define VSWTC 7
  46. #define VSTART 8
  47. #define VSTOP 9
  48. #define VSUSP 10
  49. #define VEOL 11
  50. #define VREPRINT 12
  51. #define VDISCARD 13
  52. #define VWERASE 14
  53. #define VLNEXT 15
  54. #define VEOL2 16
  55. /* c_iflag bits */
  56. #define IGNBRK 0000001
  57. #define BRKINT 0000002
  58. #define IGNPAR 0000004
  59. #define PARMRK 0000010
  60. #define INPCK 0000020
  61. #define ISTRIP 0000040
  62. #define INLCR 0000100
  63. #define IGNCR 0000200
  64. #define ICRNL 0000400
  65. #define IUCLC 0001000
  66. #define IXON 0002000
  67. #define IXANY 0004000
  68. #define IXOFF 0010000
  69. #define IMAXBEL 0020000
  70. #define IUTF8 0040000
  71. /* c_oflag bits */
  72. #define OPOST 0000001
  73. #define OLCUC 0000002
  74. #define ONLCR 0000004
  75. #define OCRNL 0000010
  76. #define ONOCR 0000020
  77. #define ONLRET 0000040
  78. #define OFILL 0000100
  79. #define OFDEL 0000200
  80. #define NLDLY 0000400
  81. #define NL0 0000000
  82. #define NL1 0000400
  83. #define CRDLY 0003000
  84. #define CR0 0000000
  85. #define CR1 0001000
  86. #define CR2 0002000
  87. #define CR3 0003000
  88. #define TABDLY 0014000
  89. #define TAB0 0000000
  90. #define TAB1 0004000
  91. #define TAB2 0010000
  92. #define TAB3 0014000
  93. #define XTABS 0014000
  94. #define BSDLY 0020000
  95. #define BS0 0000000
  96. #define BS1 0020000
  97. #define VTDLY 0040000
  98. #define VT0 0000000
  99. #define VT1 0040000
  100. #define FFDLY 0100000
  101. #define FF0 0000000
  102. #define FF1 0100000
  103. /* c_cflag bit meaning */
  104. #define CBAUD 0010017
  105. #define B0 0000000 /* hang up */
  106. #define B50 0000001
  107. #define B75 0000002
  108. #define B110 0000003
  109. #define B134 0000004
  110. #define B150 0000005
  111. #define B200 0000006
  112. #define B300 0000007
  113. #define B600 0000010
  114. #define B1200 0000011
  115. #define B1800 0000012
  116. #define B2400 0000013
  117. #define B4800 0000014
  118. #define B9600 0000015
  119. #define B19200 0000016
  120. #define B38400 0000017
  121. #define EXTA B19200
  122. #define EXTB B38400
  123. #define CSIZE 0000060
  124. #define CS5 0000000
  125. #define CS6 0000020
  126. #define CS7 0000040
  127. #define CS8 0000060
  128. #define CSTOPB 0000100
  129. #define CREAD 0000200
  130. #define PARENB 0000400
  131. #define PARODD 0001000
  132. #define HUPCL 0002000
  133. #define CLOCAL 0004000
  134. #define CBAUDEX 0010000
  135. #define BOTHER 0010000
  136. #define B57600 0010001
  137. #define B115200 0010002
  138. #define B230400 0010003
  139. #define B460800 0010004
  140. #define B500000 0010005
  141. #define B576000 0010006
  142. #define B921600 0010007
  143. #define B1000000 0010010
  144. #define B1152000 0010011
  145. #define B1500000 0010012
  146. #define B2000000 0010013
  147. #define B2500000 0010014
  148. #define B3000000 0010015
  149. #define B3500000 0010016
  150. #define B4000000 0010017
  151. #define CIBAUD 002003600000 /* input baud rate */
  152. #define CMSPAR 010000000000 /* mark or space (stick) parity */
  153. #define CRTSCTS 020000000000 /* flow control */
  154. #define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
  155. /* c_lflag bits */
  156. #define ISIG 0000001
  157. #define ICANON 0000002
  158. #define XCASE 0000004
  159. #define ECHO 0000010
  160. #define ECHOE 0000020
  161. #define ECHOK 0000040
  162. #define ECHONL 0000100
  163. #define NOFLSH 0000200
  164. #define TOSTOP 0000400
  165. #define ECHOCTL 0001000
  166. #define ECHOPRT 0002000
  167. #define ECHOKE 0004000
  168. #define FLUSHO 0010000
  169. #define PENDIN 0040000
  170. #define IEXTEN 0100000
  171. #define EXTPROC 0200000
  172. /* tcflow() and TCXONC use these */
  173. #define TCOOFF 0
  174. #define TCOON 1
  175. #define TCIOFF 2
  176. #define TCION 3
  177. /* tcflush() and TCFLSH use these */
  178. #define TCIFLUSH 0
  179. #define TCOFLUSH 1
  180. #define TCIOFLUSH 2
  181. /* tcsetattr uses these */
  182. #define TCSANOW 0
  183. #define TCSADRAIN 1
  184. #define TCSAFLUSH 2
  185. #endif /* __ASM_GENERIC_TERMBITS_H */