termios.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /* Copyright (C) 1997,1999,2001,2003,2004,2005 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. #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
  37. #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
  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. #define IXANY 0004000
  70. #define IUCLC 0010000
  71. #define IMAXBEL 0020000
  72. #define IUTF8 0040000
  73. /* c_oflag bits */
  74. #define OPOST 0000001
  75. #define ONLCR 0000002
  76. #define OLCUC 0000004
  77. #define OCRNL 0000010
  78. #define ONOCR 0000020
  79. #define ONLRET 0000040
  80. #define OFILL 00000100
  81. #define OFDEL 00000200
  82. #if defined __USE_MISC || defined __USE_XOPEN
  83. # define NLDLY 00001400
  84. # define NL0 00000000
  85. # define NL1 00000400
  86. # define NL2 00001000
  87. # define NL3 00001400
  88. # define TABDLY 00006000
  89. # define TAB0 00000000
  90. # define TAB1 00002000
  91. # define TAB2 00004000
  92. # define TAB3 00006000
  93. # define CRDLY 00030000
  94. # define CR0 00000000
  95. # define CR1 00010000
  96. # define CR2 00020000
  97. # define CR3 00030000
  98. # define FFDLY 00040000
  99. # define FF0 00000000
  100. # define FF1 00040000
  101. # define BSDLY 00100000
  102. # define BS0 00000000
  103. # define BS1 00100000
  104. #endif
  105. #define VTDLY 00200000
  106. #define VT0 00000000
  107. #define VT1 00200000
  108. #ifdef __USE_MISC
  109. # define XTABS 00006000
  110. #endif
  111. /* c_cflag bit meaning */
  112. #ifdef __USE_MISC
  113. # define CBAUD 0000377
  114. #endif
  115. #define B0 0000000 /* hang up */
  116. #define B50 0000001
  117. #define B75 0000002
  118. #define B110 0000003
  119. #define B134 0000004
  120. #define B150 0000005
  121. #define B200 0000006
  122. #define B300 0000007
  123. #define B600 0000010
  124. #define B1200 0000011
  125. #define B1800 0000012
  126. #define B2400 0000013
  127. #define B4800 0000014
  128. #define B9600 0000015
  129. #define B19200 0000016
  130. #define B38400 0000017
  131. #ifdef __USE_MISC
  132. # define EXTA B19200
  133. # define EXTB B38400
  134. # define CBAUDEX 0000020
  135. #endif
  136. #define B57600 00020
  137. #define B115200 00021
  138. #define B230400 00022
  139. #define B460800 00023
  140. #define B500000 00024
  141. #define B576000 00025
  142. #define B921600 00026
  143. #define B1000000 00027
  144. #define B1152000 00030
  145. #define B1500000 00031
  146. #define B2000000 00032
  147. #define B2500000 00033
  148. #define B3000000 00034
  149. #define B3500000 00035
  150. #define B4000000 00036
  151. #define __MAX_BAUD B4000000
  152. #define CSIZE 00001400
  153. #define CS5 00000000
  154. #define CS6 00000400
  155. #define CS7 00001000
  156. #define CS8 00001400
  157. #define CSTOPB 00002000
  158. #define CREAD 00004000
  159. #define PARENB 00010000
  160. #define PARODD 00020000
  161. #define HUPCL 00040000
  162. #define CLOCAL 00100000
  163. #ifdef __USE_MISC
  164. # define CMSPAR 010000000000 /* mark or space (stick) parity */
  165. # define CRTSCTS 020000000000 /* flow control */
  166. #endif
  167. /* c_lflag bits */
  168. #define ISIG 0x00000080
  169. #define ICANON 0x00000100
  170. #if defined __USE_MISC || defined __USE_XOPEN
  171. # define XCASE 0x00004000
  172. #endif
  173. #define ECHO 0x00000008
  174. #define ECHOE 0x00000002
  175. #define ECHOK 0x00000004
  176. #define ECHONL 0x00000010
  177. #define NOFLSH 0x80000000
  178. #define TOSTOP 0x00400000
  179. #ifdef __USE_MISC
  180. # define ECHOCTL 0x00000040
  181. # define ECHOPRT 0x00000020
  182. # define ECHOKE 0x00000001
  183. # define FLUSHO 0x00800000
  184. # define PENDIN 0x20000000
  185. #endif
  186. #define IEXTEN 0x00000400
  187. /* Values for the ACTION argument to `tcflow'. */
  188. #define TCOOFF 0
  189. #define TCOON 1
  190. #define TCIOFF 2
  191. #define TCION 3
  192. /* Values for the QUEUE_SELECTOR argument to `tcflush'. */
  193. #define TCIFLUSH 0
  194. #define TCOFLUSH 1
  195. #define TCIOFLUSH 2
  196. /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
  197. #define TCSANOW 0
  198. #define TCSADRAIN 1
  199. #define TCSAFLUSH 2
  200. struct sgttyb {
  201. char sg_ispeed;
  202. char sg_ospeed;
  203. char sg_erase;
  204. char sg_kill;
  205. short sg_flags;
  206. };
  207. struct tchars {
  208. char t_intrc;
  209. char t_quitc;
  210. char t_startc;
  211. char t_stopc;
  212. char t_eofc;
  213. char t_brkc;
  214. };
  215. struct ltchars {
  216. char t_suspc;
  217. char t_dsuspc;
  218. char t_rprntc;
  219. char t_flushc;
  220. char t_werasc;
  221. char t_lnextc;
  222. };
  223. /* Used for packet mode */
  224. #define TIOCPKT_DATA 0
  225. #define TIOCPKT_FLUSHREAD 1
  226. #define TIOCPKT_FLUSHWRITE 2
  227. #define TIOCPKT_STOP 4
  228. #define TIOCPKT_START 8
  229. #define TIOCPKT_NOSTOP 16
  230. #define TIOCPKT_DOSTOP 32
  231. struct winsize {
  232. unsigned short ws_row;
  233. unsigned short ws_col;
  234. unsigned short ws_xpixel;
  235. unsigned short ws_ypixel;
  236. };
  237. #define NCC 10
  238. struct termio {
  239. unsigned short c_iflag; /* input mode flags */
  240. unsigned short c_oflag; /* output mode flags */
  241. unsigned short c_cflag; /* control mode flags */
  242. unsigned short c_lflag; /* local mode flags */
  243. unsigned char c_line; /* line discipline */
  244. unsigned char c_cc[NCC]; /* control characters */
  245. };
  246. /* c_cc characters */
  247. #define _VINTR 0
  248. #define _VQUIT 1
  249. #define _VERASE 2
  250. #define _VKILL 3
  251. #define _VEOF 4
  252. #define _VMIN 5
  253. #define _VEOL 6
  254. #define _VTIME 7
  255. #define _VEOL2 8
  256. #define _VSWTC 9
  257. /* modem lines */
  258. #define TIOCM_LE 0x001
  259. #define TIOCM_DTR 0x002
  260. #define TIOCM_RTS 0x004
  261. #define TIOCM_ST 0x008
  262. #define TIOCM_SR 0x010
  263. #define TIOCM_CTS 0x020
  264. #define TIOCM_CAR 0x040
  265. #define TIOCM_RNG 0x080
  266. #define TIOCM_DSR 0x100
  267. #define TIOCM_CD TIOCM_CAR
  268. #define TIOCM_RI TIOCM_RNG
  269. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  270. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  271. /* line disciplines */
  272. #define N_TTY 0
  273. #define N_SLIP 1
  274. #define N_MOUSE 2
  275. #define N_PPP 3
  276. #define N_STRIP 4
  277. #define N_AX25 5
  278. #define N_X25 6 /* X.25 async */
  279. #define N_6PACK 7
  280. #define N_MASC 8 /* Mobitex module */
  281. #define N_R3964 9 /* Simatic R3964 module */
  282. #define N_PROFIBUS_FDL 10 /* Profibus */
  283. #define N_IRDA 11 /* Linux IR */
  284. #define N_SMSBLOCK 12 /* SMS block mode */
  285. #define N_HDLC 13 /* synchronous HDLC */
  286. #define N_SYNC_PPP 14 /* synchronous PPP */
  287. #define N_HCI 15 /* Bluetooth HCI UART */