termios.h 5.9 KB

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