termios.h 5.5 KB

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