termios.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /* termios type and macro definitions. Linux version.
  2. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005
  3. Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. #ifndef _TERMIOS_H
  18. # error "Never include <bits/termios.h> directly; use <termios.h> instead."
  19. #endif
  20. typedef unsigned char cc_t;
  21. typedef unsigned int speed_t;
  22. typedef unsigned int tcflag_t;
  23. #define NCCS 32
  24. struct termios
  25. {
  26. tcflag_t c_iflag; /* input mode flags */
  27. tcflag_t c_oflag; /* output mode flags */
  28. tcflag_t c_cflag; /* control mode flags */
  29. tcflag_t c_lflag; /* local mode flags */
  30. cc_t c_line; /* line discipline */
  31. cc_t c_cc[NCCS]; /* control characters */
  32. speed_t c_ispeed; /* input speed */
  33. speed_t c_ospeed; /* output speed */
  34. #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
  35. #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
  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. #if defined __USE_MISC || defined __USE_XOPEN
  81. # define NLDLY 0000400
  82. # define NL0 0000000
  83. # define NL1 0000400
  84. # define CRDLY 0003000
  85. # define CR0 0000000
  86. # define CR1 0001000
  87. # define CR2 0002000
  88. # define CR3 0003000
  89. # define TABDLY 0014000
  90. # define TAB0 0000000
  91. # define TAB1 0004000
  92. # define TAB2 0010000
  93. # define TAB3 0014000
  94. # define BSDLY 0020000
  95. # define BS0 0000000
  96. # define BS1 0020000
  97. # define FFDLY 0100000
  98. # define FF0 0000000
  99. # define FF1 0100000
  100. #endif
  101. #define VTDLY 0040000
  102. #define VT0 0000000
  103. #define VT1 0040000
  104. #ifdef __USE_MISC
  105. # define XTABS 0014000
  106. #endif
  107. /* c_cflag bit meaning */
  108. #ifdef __USE_MISC
  109. # define CBAUD 0010017
  110. #endif
  111. #define B0 0000000 /* hang up */
  112. #define B50 0000001
  113. #define B75 0000002
  114. #define B110 0000003
  115. #define B134 0000004
  116. #define B150 0000005
  117. #define B200 0000006
  118. #define B300 0000007
  119. #define B600 0000010
  120. #define B1200 0000011
  121. #define B1800 0000012
  122. #define B2400 0000013
  123. #define B4800 0000014
  124. #define B9600 0000015
  125. #define B19200 0000016
  126. #define B38400 0000017
  127. #ifdef __USE_MISC
  128. # define EXTA B19200
  129. # define EXTB B38400
  130. #endif
  131. #define CSIZE 0000060
  132. #define CS5 0000000
  133. #define CS6 0000020
  134. #define CS7 0000040
  135. #define CS8 0000060
  136. #define CSTOPB 0000100
  137. #define CREAD 0000200
  138. #define PARENB 0000400
  139. #define PARODD 0001000
  140. #define HUPCL 0002000
  141. #define CLOCAL 0004000
  142. #ifdef __USE_MISC
  143. # define CBAUDEX 0010000
  144. #endif
  145. #define B57600 0010001
  146. #define B115200 0010002
  147. #define B230400 0010003
  148. #define B460800 0010004
  149. #define B921600 0010005
  150. #define B1843200 0010006
  151. #define B6250000 0010007
  152. #ifdef __arch_v32
  153. #define B12500000 0010010
  154. #define __MAX_BAUD B12500000
  155. #else
  156. #define __MAX_BAUD B6250000
  157. #endif
  158. #ifdef __USE_MISC
  159. # define CIBAUD 002003600000 /* input baud rate (not used) */
  160. # define CMSPAR 010000000000 /* mark or space (stick) parity */
  161. # define CRTSCTS 020000000000 /* flow control */
  162. #endif
  163. /* c_lflag bits */
  164. #define ISIG 0000001
  165. #define ICANON 0000002
  166. #if defined __USE_MISC || defined __USE_XOPEN
  167. # define XCASE 0000004
  168. #endif
  169. #define ECHO 0000010
  170. #define ECHOE 0000020
  171. #define ECHOK 0000040
  172. #define ECHONL 0000100
  173. #define NOFLSH 0000200
  174. #define TOSTOP 0000400
  175. #ifdef __USE_MISC
  176. # define ECHOCTL 0001000
  177. # define ECHOPRT 0002000
  178. # define ECHOKE 0004000
  179. # define FLUSHO 0010000
  180. # define PENDIN 0040000
  181. #endif
  182. #define IEXTEN 0100000
  183. /* tcflow() and TCXONC use these */
  184. #define TCOOFF 0
  185. #define TCOON 1
  186. #define TCIOFF 2
  187. #define TCION 3
  188. /* tcflush() and TCFLSH use these */
  189. #define TCIFLUSH 0
  190. #define TCOFLUSH 1
  191. #define TCIOFLUSH 2
  192. /* tcsetattr uses these */
  193. #define TCSANOW 0
  194. #define TCSADRAIN 1
  195. #define TCSAFLUSH 2
  196. #define _IOT_termios /* Hurd ioctl type field. */ \
  197. _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)