termios.h 6.0 KB

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