termios.h 6.6 KB

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