termios.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /* termios type and macro definitions. Linux/SPARC version.
  2. Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 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 17
  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_line; /* line discipline */
  30. cc_t c_cc[NCCS]; /* control characters */
  31. };
  32. /* c_cc characters */
  33. #define VINTR 0
  34. #define VQUIT 1
  35. #define VERASE 2
  36. #define VKILL 3
  37. #define VEOF 4
  38. #define VEOL 5
  39. #define VEOL2 6
  40. #define VSWTC 7
  41. #define VSTART 8
  42. #define VSTOP 9
  43. #define VSUSP 10
  44. #define VDSUSP 11 /* SunOS POSIX nicety I do believe... */
  45. #define VREPRINT 12
  46. #define VDISCARD 13
  47. #define VWERASE 14
  48. #define VLNEXT 15
  49. /* User apps assume vmin/vtime is shared with eof/eol */
  50. #define VMIN VEOF
  51. #define VTIME VEOL
  52. /* c_iflag bits */
  53. #define IGNBRK 0x00000001
  54. #define BRKINT 0x00000002
  55. #define IGNPAR 0x00000004
  56. #define PARMRK 0x00000008
  57. #define INPCK 0x00000010
  58. #define ISTRIP 0x00000020
  59. #define INLCR 0x00000040
  60. #define IGNCR 0x00000080
  61. #define ICRNL 0x00000100
  62. #define IUCLC 0x00000200
  63. #define IXON 0x00000400
  64. #define IXANY 0x00000800
  65. #define IXOFF 0x00001000
  66. #define IMAXBEL 0x00002000
  67. #define IUTF8 0x00004000
  68. /* c_oflag bits */
  69. #define OPOST 0x00000001
  70. #define OLCUC 0x00000002
  71. #define ONLCR 0x00000004
  72. #define OCRNL 0x00000008
  73. #define ONOCR 0x00000010
  74. #define ONLRET 0x00000020
  75. #define OFILL 0x00000040
  76. #define OFDEL 0x00000080
  77. #if defined __USE_MISC || defined __USE_XOPEN
  78. # define NLDLY 0x00000100
  79. # define NL0 0x00000000
  80. # define NL1 0x00000100
  81. # define CRDLY 0x00000600
  82. # define CR0 0x00000000
  83. # define CR1 0x00000200
  84. # define CR2 0x00000400
  85. # define CR3 0x00000600
  86. # define TABDLY 0x00001800
  87. # define TAB0 0x00000000
  88. # define TAB1 0x00000800
  89. # define TAB2 0x00001000
  90. # define TAB3 0x00001800
  91. # define BSDLY 0x00002000
  92. # define BS0 0x00000000
  93. # define BS1 0x00002000
  94. #define FFDLY 0x00008000
  95. #define FF0 0x00000000
  96. #define FF1 0x00008000
  97. #endif
  98. #define VTDLY 0x00004000
  99. #define VT0 0x00000000
  100. #define VT1 0x00004000
  101. #define PAGEOUT 0x00010000 /* SUNOS specific */
  102. #define WRAP 0x00020000 /* SUNOS specific */
  103. #ifdef __USE_MISC
  104. # define XTABS 0x00001800
  105. #endif
  106. /* c_cflag bit meaning */
  107. #ifdef __USE_MISC
  108. # define CBAUD 0x0000100f
  109. #endif
  110. #define B0 0x00000000 /* hang up */
  111. #define B50 0x00000001
  112. #define B75 0x00000002
  113. #define B110 0x00000003
  114. #define B134 0x00000004
  115. #define B150 0x00000005
  116. #define B200 0x00000006
  117. #define B300 0x00000007
  118. #define B600 0x00000008
  119. #define B1200 0x00000009
  120. #define B1800 0x0000000a
  121. #define B2400 0x0000000b
  122. #define B4800 0x0000000c
  123. #define B9600 0x0000000d
  124. #define B19200 0x0000000e
  125. #define B38400 0x0000000f
  126. #ifdef __USE_MISC
  127. # define EXTA B19200
  128. # define EXTB B38400
  129. #endif
  130. #define CSIZE 0x00000030
  131. #define CS5 0x00000000
  132. #define CS6 0x00000010
  133. #define CS7 0x00000020
  134. #define CS8 0x00000030
  135. #define CSTOPB 0x00000040
  136. #define CREAD 0x00000080
  137. #define PARENB 0x00000100
  138. #define PARODD 0x00000200
  139. #define HUPCL 0x00000400
  140. #define CLOCAL 0x00000800
  141. #ifdef __USE_MISC
  142. # define CBAUDEX 0x00001000
  143. #endif
  144. #define B57600 0x00001001
  145. #define B115200 0x00001002
  146. #define B230400 0x00001003
  147. #define B460800 0x00001004
  148. #define B76800 0x00001005
  149. #define B153600 0x00001006
  150. #define B307200 0x00001007
  151. #define B614400 0x00001008
  152. #define B921600 0x00001009
  153. #define B500000 0x0000100a
  154. #define B576000 0x0000100b
  155. #define B1000000 0x0000100c
  156. #define B1152000 0x0000100d
  157. #define B1500000 0x0000100e
  158. #define B2000000 0x0000100f
  159. #define __MAX_BAUD B2000000
  160. #ifdef __USE_MISC
  161. # define CIBAUD 0x100f0000 /* input baud rate (not used) */
  162. # define CMSPAR 0x40000000 /* mark or space (stick) parity */
  163. # define CRTSCTS 0x80000000 /* flow control */
  164. #endif
  165. /* c_lflag bits */
  166. #define ISIG 0x00000001
  167. #define ICANON 0x00000002
  168. #if defined __USE_MISC || defined __USE_XOPEN
  169. # define XCASE 0x00000004
  170. #endif
  171. #define ECHO 0x00000008
  172. #define ECHOE 0x00000010
  173. #define ECHOK 0x00000020
  174. #define ECHONL 0x00000040
  175. #define NOFLSH 0x00000080
  176. #define TOSTOP 0x00000100
  177. #ifdef __USE_MISC
  178. # define ECHOCTL 0x00000200
  179. # define ECHOPRT 0x00000400
  180. # define ECHOKE 0x00000800
  181. # define DEFECHO 0x00001000 /* SUNOS thing, what is it? */
  182. # define FLUSHO 0x00002000
  183. # define PENDIN 0x00004000
  184. #endif
  185. #define IEXTEN 0x00008000
  186. /* modem lines */
  187. #define TIOCM_LE 0x001
  188. #define TIOCM_DTR 0x002
  189. #define TIOCM_RTS 0x004
  190. #define TIOCM_ST 0x008
  191. #define TIOCM_SR 0x010
  192. #define TIOCM_CTS 0x020
  193. #define TIOCM_CAR 0x040
  194. #define TIOCM_RNG 0x080
  195. #define TIOCM_DSR 0x100
  196. #define TIOCM_CD TIOCM_CAR
  197. #define TIOCM_RI TIOCM_RNG
  198. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  199. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  200. /* tcflow() and TCXONC use these */
  201. #define TCOOFF 0
  202. #define TCOON 1
  203. #define TCIOFF 2
  204. #define TCION 3
  205. /* tcflush() and TCFLSH use these */
  206. #define TCIFLUSH 0
  207. #define TCOFLUSH 1
  208. #define TCIOFLUSH 2
  209. /* tcsetattr uses these */
  210. #define TCSANOW 0
  211. #define TCSADRAIN 1
  212. #define TCSAFLUSH 2