termios.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /* termios type and macro definitions. Linux/SPARC version.
  2. Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  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. /* 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. #define NLDLY 0x00000100
  77. #define NL0 0x00000000
  78. #define NL1 0x00000100
  79. #define CRDLY 0x00000600
  80. #define CR0 0x00000000
  81. #define CR1 0x00000200
  82. #define CR2 0x00000400
  83. #define CR3 0x00000600
  84. #define TABDLY 0x00001800
  85. #define TAB0 0x00000000
  86. #define TAB1 0x00000800
  87. #define TAB2 0x00001000
  88. #define TAB3 0x00001800
  89. #define XTABS 0x00001800
  90. #define BSDLY 0x00002000
  91. #define BS0 0x00000000
  92. #define BS1 0x00002000
  93. #define VTDLY 0x00004000
  94. #define VT0 0x00000000
  95. #define VT1 0x00004000
  96. #define FFDLY 0x00008000
  97. #define FF0 0x00000000
  98. #define FF1 0x00008000
  99. #define PAGEOUT 0x00010000 /* SUNOS specific */
  100. #define WRAP 0x00020000 /* SUNOS specific */
  101. /* c_cflag bit meaning */
  102. #define CBAUD 0x0000100f
  103. #define B0 0x00000000 /* hang up */
  104. #define B50 0x00000001
  105. #define B75 0x00000002
  106. #define B110 0x00000003
  107. #define B134 0x00000004
  108. #define B150 0x00000005
  109. #define B200 0x00000006
  110. #define B300 0x00000007
  111. #define B600 0x00000008
  112. #define B1200 0x00000009
  113. #define B1800 0x0000000a
  114. #define B2400 0x0000000b
  115. #define B4800 0x0000000c
  116. #define B9600 0x0000000d
  117. #define B19200 0x0000000e
  118. #define B38400 0x0000000f
  119. #define EXTA B19200
  120. #define EXTB B38400
  121. #define CSIZE 0x00000030
  122. #define CS5 0x00000000
  123. #define CS6 0x00000010
  124. #define CS7 0x00000020
  125. #define CS8 0x00000030
  126. #define CSTOPB 0x00000040
  127. #define CREAD 0x00000080
  128. #define PARENB 0x00000100
  129. #define PARODD 0x00000200
  130. #define HUPCL 0x00000400
  131. #define CLOCAL 0x00000800
  132. #define CBAUDEX 0x00001000
  133. #define B57600 0x00001001
  134. #define B115200 0x00001002
  135. #define B230400 0x00001003
  136. #define B460800 0x00001004
  137. #define B76800 0x00001005
  138. #define B153600 0x00001006
  139. #define B307200 0x00001007
  140. #define B614400 0x00001008
  141. #define B921600 0x00001009
  142. #define B500000 0x0000100a
  143. #define B576000 0x0000100b
  144. #define B1000000 0x0000100c
  145. #define B1152000 0x0000100d
  146. #define B1500000 0x0000100e
  147. #define B2000000 0x0000100f
  148. #define __MAX_BAUD B2000000
  149. #define CIBAUD 0x100f0000 /* input baud rate (not used) */
  150. #define CMSPAR 0x40000000 /* mark or space (stick) parity */
  151. #define CRTSCTS 0x80000000 /* flow control */
  152. /* c_lflag bits */
  153. #define ISIG 0x00000001
  154. #define ICANON 0x00000002
  155. #define XCASE 0x00000004
  156. #define ECHO 0x00000008
  157. #define ECHOE 0x00000010
  158. #define ECHOK 0x00000020
  159. #define ECHONL 0x00000040
  160. #define NOFLSH 0x00000080
  161. #define TOSTOP 0x00000100
  162. #define ECHOCTL 0x00000200
  163. #define ECHOPRT 0x00000400
  164. #define ECHOKE 0x00000800
  165. #define DEFECHO 0x00001000 /* SUNOS thing, what is it? */
  166. #define FLUSHO 0x00002000
  167. #define PENDIN 0x00004000
  168. #define IEXTEN 0x00008000
  169. /* modem lines */
  170. #define TIOCM_LE 0x001
  171. #define TIOCM_DTR 0x002
  172. #define TIOCM_RTS 0x004
  173. #define TIOCM_ST 0x008
  174. #define TIOCM_SR 0x010
  175. #define TIOCM_CTS 0x020
  176. #define TIOCM_CAR 0x040
  177. #define TIOCM_RNG 0x080
  178. #define TIOCM_DSR 0x100
  179. #define TIOCM_CD TIOCM_CAR
  180. #define TIOCM_RI TIOCM_RNG
  181. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  182. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  183. /* tcflow() and TCXONC use these */
  184. #define TCOOFF 0
  185. #define TCOON 1
  186. #define TCIOFF 2
  187. #define TCION 3
  188. /* tcflush() and TCFLSH use these */
  189. #define TCIFLUSH 0
  190. #define TCOFLUSH 1
  191. #define TCIOFLUSH 2
  192. /* tcsetattr uses these */
  193. #define TCSANOW 0
  194. #define TCSADRAIN 1
  195. #define TCSAFLUSH 2