termios.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. /* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  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. /* note: this is fixed to be the same as the kernel, not glibc */
  22. #define NCCS 19
  23. struct termios {
  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_cc[NCCS]; /* control characters */
  29. cc_t c_line; /* line discipline */
  30. speed_t c_ispeed; /* input speed */
  31. speed_t c_ospeed; /* output speed */
  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 VMIN 5
  40. #define VEOL 6
  41. #define VTIME 7
  42. #define VEOL2 8
  43. #define VSWTC 9
  44. #define VWERASE 10
  45. #define VREPRINT 11
  46. #define VSUSP 12
  47. #define VSTART 13
  48. #define VSTOP 14
  49. #define VLNEXT 15
  50. #define VDISCARD 16
  51. /* c_iflag bits */
  52. #define IGNBRK 0000001
  53. #define BRKINT 0000002
  54. #define IGNPAR 0000004
  55. #define PARMRK 0000010
  56. #define INPCK 0000020
  57. #define ISTRIP 0000040
  58. #define INLCR 0000100
  59. #define IGNCR 0000200
  60. #define ICRNL 0000400
  61. #define IXON 0001000
  62. #define IXOFF 0002000
  63. /* POSIX.1 doesn't want these... */
  64. #ifdef __USE_BSD
  65. # define IXANY 0004000
  66. # define IUCLC 0010000
  67. # define IMAXBEL 0020000
  68. #endif
  69. /* c_oflag bits */
  70. #define OPOST 0000001
  71. #define ONLCR 0000002
  72. #define OLCUC 0000004
  73. #define OCRNL 0000010
  74. #define ONOCR 0000020
  75. #define ONLRET 0000040
  76. #define OFILL 00000100
  77. #define OFDEL 00000200
  78. #define NLDLY 00001400
  79. #define NL0 00000000
  80. #define NL1 00000400
  81. #define NL2 00001000
  82. #define NL3 00001400
  83. #define TABDLY 00006000
  84. #define TAB0 00000000
  85. #define TAB1 00002000
  86. #define TAB2 00004000
  87. #define TAB3 00006000
  88. #define CRDLY 00030000
  89. #define CR0 00000000
  90. #define CR1 00010000
  91. #define CR2 00020000
  92. #define CR3 00030000
  93. #define FFDLY 00040000
  94. #define FF0 00000000
  95. #define FF1 00040000
  96. #define BSDLY 00100000
  97. #define BS0 00000000
  98. #define BS1 00100000
  99. #define VTDLY 00200000
  100. #define VT0 00000000
  101. #define VT1 00200000
  102. #define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
  103. /* c_cflag bit meaning */
  104. #define CBAUD 0000377
  105. #define B0 0000000 /* hang up */
  106. #define B50 0000001
  107. #define B75 0000002
  108. #define B110 0000003
  109. #define B134 0000004
  110. #define B150 0000005
  111. #define B200 0000006
  112. #define B300 0000007
  113. #define B600 0000010
  114. #define B1200 0000011
  115. #define B1800 0000012
  116. #define B2400 0000013
  117. #define B4800 0000014
  118. #define B9600 0000015
  119. #define B19200 0000016
  120. #define B38400 0000017
  121. #define EXTA B19200
  122. #define EXTB B38400
  123. #define CBAUDEX 0000020
  124. #define B57600 00020
  125. #define B115200 00021
  126. #define B230400 00022
  127. #define B460800 00023
  128. #define B500000 00024
  129. #define B576000 00025
  130. #define B921600 00026
  131. #define B1000000 00027
  132. #define B1152000 00030
  133. #define B1500000 00031
  134. #define B2000000 00032
  135. #define B2500000 00033
  136. #define B3000000 00034
  137. #define B3500000 00035
  138. #define B4000000 00036
  139. #define __MAX_BAUD B4000000
  140. #define CSIZE 00001400
  141. #define CS5 00000000
  142. #define CS6 00000400
  143. #define CS7 00001000
  144. #define CS8 00001400
  145. #define CSTOPB 00002000
  146. #define CREAD 00004000
  147. #define PARENB 00010000
  148. #define PARODD 00020000
  149. #define HUPCL 00040000
  150. #define CLOCAL 00100000
  151. #define CRTSCTS 020000000000 /* flow control */
  152. /* c_lflag bits */
  153. #define ISIG 0x00000080
  154. #define ICANON 0x00000100
  155. #define XCASE 0x00004000
  156. #define ECHO 0x00000008
  157. #define ECHOE 0x00000002
  158. #define ECHOK 0x00000004
  159. #define ECHONL 0x00000010
  160. #define NOFLSH 0x80000000
  161. #define TOSTOP 0x00400000
  162. #define ECHOCTL 0x00000040
  163. #define ECHOPRT 0x00000020
  164. #define ECHOKE 0x00000001
  165. #define FLUSHO 0x00800000
  166. #define PENDIN 0x20000000
  167. #define IEXTEN 0x00000400
  168. /* Values for the ACTION argument to `tcflow'. */
  169. #define TCOOFF 0
  170. #define TCOON 1
  171. #define TCIOFF 2
  172. #define TCION 3
  173. /* Values for the QUEUE_SELECTOR argument to `tcflush'. */
  174. #define TCIFLUSH 0
  175. #define TCOFLUSH 1
  176. #define TCIOFLUSH 2
  177. /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
  178. #define TCSANOW 0
  179. #define TCSADRAIN 1
  180. #define TCSAFLUSH 2
  181. struct sgttyb {
  182. char sg_ispeed;
  183. char sg_ospeed;
  184. char sg_erase;
  185. char sg_kill;
  186. short sg_flags;
  187. };
  188. struct tchars {
  189. char t_intrc;
  190. char t_quitc;
  191. char t_startc;
  192. char t_stopc;
  193. char t_eofc;
  194. char t_brkc;
  195. };
  196. struct ltchars {
  197. char t_suspc;
  198. char t_dsuspc;
  199. char t_rprntc;
  200. char t_flushc;
  201. char t_werasc;
  202. char t_lnextc;
  203. };
  204. /* Used for packet mode */
  205. #define TIOCPKT_DATA 0
  206. #define TIOCPKT_FLUSHREAD 1
  207. #define TIOCPKT_FLUSHWRITE 2
  208. #define TIOCPKT_STOP 4
  209. #define TIOCPKT_START 8
  210. #define TIOCPKT_NOSTOP 16
  211. #define TIOCPKT_DOSTOP 32
  212. /* c_cc characters */
  213. #define _VINTR 0
  214. #define _VQUIT 1
  215. #define _VERASE 2
  216. #define _VKILL 3
  217. #define _VEOF 4
  218. #define _VMIN 5
  219. #define _VEOL 6
  220. #define _VTIME 7
  221. #define _VEOL2 8
  222. #define _VSWTC 9
  223. /* modem lines */
  224. #define TIOCM_LE 0x001
  225. #define TIOCM_DTR 0x002
  226. #define TIOCM_RTS 0x004
  227. #define TIOCM_ST 0x008
  228. #define TIOCM_SR 0x010
  229. #define TIOCM_CTS 0x020
  230. #define TIOCM_CAR 0x040
  231. #define TIOCM_RNG 0x080
  232. #define TIOCM_DSR 0x100
  233. #define TIOCM_CD TIOCM_CAR
  234. #define TIOCM_RI TIOCM_RNG
  235. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  236. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  237. /* line disciplines */
  238. #define N_TTY 0
  239. #define N_SLIP 1
  240. #define N_MOUSE 2
  241. #define N_PPP 3
  242. #define N_STRIP 4
  243. #define N_AX25 5
  244. #define N_X25 6 /* X.25 async */
  245. #define N_6PACK 7
  246. #define N_MASC 8 /* Mobitex module */
  247. #define N_R3964 9 /* Simatic R3964 module */
  248. #define N_PROFIBUS_FDL 10 /* Profibus */
  249. #define N_IRDA 11 /* Linux IR */
  250. #define N_SMSBLOCK 12 /* SMS block mode */
  251. #define N_HDLC 13 /* synchronous HDLC */
  252. #define N_SYNC_PPP 14 /* synchronous PPP */