termios.h 7.0 KB

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