termios.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /* termios type and macro definitions. Linux version.
  2. Copyright (C) 1993, 1994, 1995, 1996, 1997, 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, see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef _TERMIOS_H
  17. # error "Never include <bits/termios.h> directly; use <termios.h> instead."
  18. #endif
  19. typedef unsigned char cc_t;
  20. typedef unsigned int speed_t;
  21. typedef unsigned int tcflag_t;
  22. #define NCCS 32
  23. struct termios
  24. {
  25. tcflag_t c_iflag; /* input mode flags */
  26. tcflag_t c_oflag; /* output mode flags */
  27. tcflag_t c_cflag; /* control mode flags */
  28. tcflag_t c_lflag; /* local mode flags */
  29. cc_t c_cc[NCCS]; /* control characters */
  30. cc_t c_line; /* line discipline (== c_cc[33]) */
  31. speed_t c_ispeed; /* input speed */
  32. speed_t c_ospeed; /* output speed */
  33. #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
  34. #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
  35. };
  36. /* c_cc characters */
  37. #define VEOF 0
  38. #define VEOL 1
  39. #define VEOL2 2
  40. #define VERASE 3
  41. #define VWERASE 4
  42. #define VKILL 5
  43. #define VREPRINT 6
  44. #define VSWTC 7
  45. #define VINTR 8
  46. #define VQUIT 9
  47. #define VSUSP 10
  48. #define VSTART 12
  49. #define VSTOP 13
  50. #define VLNEXT 14
  51. #define VDISCARD 15
  52. #define VMIN 16
  53. #define VTIME 17
  54. /* c_iflag bits */
  55. #define IGNBRK 0000001
  56. #define BRKINT 0000002
  57. #define IGNPAR 0000004
  58. #define PARMRK 0000010
  59. #define INPCK 0000020
  60. #define ISTRIP 0000040
  61. #define INLCR 0000100
  62. #define IGNCR 0000200
  63. #define ICRNL 0000400
  64. #define IXON 0001000
  65. #define IXOFF 0002000
  66. #ifdef __USE_BSD
  67. /* POSIX.1 doesn't want these... */
  68. # define IXANY 0004000
  69. # define IUCLC 0010000
  70. # define IMAXBEL 0020000
  71. # define IUTF8 0040000
  72. #endif
  73. /* c_oflag bits */
  74. #define OPOST 0000001
  75. #define ONLCR 0000002
  76. #define OLCUC 0000004
  77. #define OCRNL 0000010
  78. #define ONOCR 0000020
  79. #define ONLRET 0000040
  80. #define OFILL 00000100
  81. #define OFDEL 00000200
  82. #if defined __USE_MISC || defined __USE_XOPEN
  83. # define NLDLY 00001400
  84. # define NL0 00000000
  85. # define NL1 00000400
  86. # define NL2 00001000
  87. # define NL3 00001400
  88. # define TABDLY 00006000
  89. # define TAB0 00000000
  90. # define TAB1 00002000
  91. # define TAB2 00004000
  92. # define TAB3 00006000
  93. # define CRDLY 00030000
  94. # define CR0 00000000
  95. # define CR1 00010000
  96. # define CR2 00020000
  97. # define CR3 00030000
  98. # define FFDLY 00040000
  99. # define FF0 00000000
  100. # define FF1 00040000
  101. # define BSDLY 00100000
  102. # define BS0 00000000
  103. # define BS1 00100000
  104. #endif
  105. #define VTDLY 00200000
  106. #define VT0 00000000
  107. #define VT1 00200000
  108. #ifdef __USE_MISC
  109. # define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
  110. #endif
  111. /* c_cflag bit meaning */
  112. #ifdef __USE_MISC
  113. # define CBAUD 0000037
  114. #endif
  115. #define B0 0000000 /* hang up */
  116. #define B50 0000001
  117. #define B75 0000002
  118. #define B110 0000003
  119. #define B134 0000004
  120. #define B150 0000005
  121. #define B200 0000006
  122. #define B300 0000007
  123. #define B600 0000010
  124. #define B1200 0000011
  125. #define B1800 0000012
  126. #define B2400 0000013
  127. #define B4800 0000014
  128. #define B9600 0000015
  129. #define B19200 0000016
  130. #define B38400 0000017
  131. #ifdef __USE_MISC
  132. # define EXTA B19200
  133. # define EXTB B38400
  134. # define CBAUDEX 0000000
  135. #endif
  136. #define B57600 00020
  137. #define B115200 00021
  138. #define B230400 00022
  139. #define B460800 00023
  140. #define B500000 00024
  141. #define B576000 00025
  142. #define B921600 00026
  143. #define B1000000 00027
  144. #define B1152000 00030
  145. #define B1500000 00031
  146. #define B2000000 00032
  147. #define B2500000 00033
  148. #define B3000000 00034
  149. #define B3500000 00035
  150. #define B4000000 00036
  151. #define __MAX_BAUD B4000000
  152. #define CSIZE 00001400
  153. #define CS5 00000000
  154. #define CS6 00000400
  155. #define CS7 00001000
  156. #define CS8 00001400
  157. #define CSTOPB 00002000
  158. #define CREAD 00004000
  159. #define PARENB 00010000
  160. #define PARODD 00020000
  161. #define HUPCL 00040000
  162. #define CLOCAL 00100000
  163. #ifdef __USE_MISC
  164. # define CMSPAR 010000000000 /* mark or space (stick) parity */
  165. # define CRTSCTS 020000000000 /* flow control */
  166. #endif
  167. /* c_lflag bits */
  168. #define ISIG 0x00000080
  169. #define ICANON 0x00000100
  170. #if defined __USE_MISC || defined __USE_XOPEN
  171. # define XCASE 0x00004000
  172. #endif
  173. #define ECHO 0x00000008
  174. #define ECHOE 0x00000002
  175. #define ECHOK 0x00000004
  176. #define ECHONL 0x00000010
  177. #define NOFLSH 0x80000000
  178. #define TOSTOP 0x00400000
  179. #ifdef __USE_MISC
  180. # define ECHOCTL 0x00000040
  181. # define ECHOPRT 0x00000020
  182. # define ECHOKE 0x00000001
  183. # define FLUSHO 0x00800000
  184. # define PENDIN 0x20000000
  185. #endif
  186. #define IEXTEN 0x00000400
  187. /* Values for the ACTION argument to `tcflow'. */
  188. #define TCOOFF 0
  189. #define TCOON 1
  190. #define TCIOFF 2
  191. #define TCION 3
  192. /* Values for the QUEUE_SELECTOR argument to `tcflush'. */
  193. #define TCIFLUSH 0
  194. #define TCOFLUSH 1
  195. #define TCIOFLUSH 2
  196. /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
  197. #define TCSANOW 0
  198. #define TCSADRAIN 1
  199. #define TCSAFLUSH 2
  200. #define _IOT_termios /* Hurd ioctl type field. */ \
  201. _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)