termios.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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. #ifndef __UCLIBC_STRICT_HEADERS__
  201. struct sgttyb {
  202. char sg_ispeed;
  203. char sg_ospeed;
  204. char sg_erase;
  205. char sg_kill;
  206. short sg_flags;
  207. };
  208. #endif
  209. struct tchars {
  210. char t_intrc;
  211. char t_quitc;
  212. char t_startc;
  213. char t_stopc;
  214. char t_eofc;
  215. char t_brkc;
  216. };
  217. struct ltchars {
  218. char t_suspc;
  219. char t_dsuspc;
  220. char t_rprntc;
  221. char t_flushc;
  222. char t_werasc;
  223. char t_lnextc;
  224. };
  225. /* Used for packet mode */
  226. #define TIOCPKT_DATA 0
  227. #define TIOCPKT_FLUSHREAD 1
  228. #define TIOCPKT_FLUSHWRITE 2
  229. #define TIOCPKT_STOP 4
  230. #define TIOCPKT_START 8
  231. #define TIOCPKT_NOSTOP 16
  232. #define TIOCPKT_DOSTOP 32
  233. struct winsize {
  234. unsigned short ws_row;
  235. unsigned short ws_col;
  236. unsigned short ws_xpixel;
  237. unsigned short ws_ypixel;
  238. };
  239. #define NCC 10
  240. struct termio {
  241. unsigned short c_iflag; /* input mode flags */
  242. unsigned short c_oflag; /* output mode flags */
  243. unsigned short c_cflag; /* control mode flags */
  244. unsigned short c_lflag; /* local mode flags */
  245. unsigned char c_line; /* line discipline */
  246. unsigned char c_cc[NCC]; /* control characters */
  247. };
  248. /* c_cc characters */
  249. #define _VINTR 0
  250. #define _VQUIT 1
  251. #define _VERASE 2
  252. #define _VKILL 3
  253. #define _VEOF 4
  254. #define _VMIN 5
  255. #define _VEOL 6
  256. #define _VTIME 7
  257. #define _VEOL2 8
  258. #define _VSWTC 9
  259. /* modem lines */
  260. #define TIOCM_LE 0x001
  261. #define TIOCM_DTR 0x002
  262. #define TIOCM_RTS 0x004
  263. #define TIOCM_ST 0x008
  264. #define TIOCM_SR 0x010
  265. #define TIOCM_CTS 0x020
  266. #define TIOCM_CAR 0x040
  267. #define TIOCM_RNG 0x080
  268. #define TIOCM_DSR 0x100
  269. #define TIOCM_CD TIOCM_CAR
  270. #define TIOCM_RI TIOCM_RNG
  271. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  272. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  273. /* line disciplines */
  274. #define N_TTY 0
  275. #define N_SLIP 1
  276. #define N_MOUSE 2
  277. #define N_PPP 3
  278. #define N_STRIP 4
  279. #define N_AX25 5
  280. #define N_X25 6 /* X.25 async */
  281. #define N_6PACK 7
  282. #define N_MASC 8 /* Mobitex module */
  283. #define N_R3964 9 /* Simatic R3964 module */
  284. #define N_PROFIBUS_FDL 10 /* Profibus */
  285. #define N_IRDA 11 /* Linux IR */
  286. #define N_SMSBLOCK 12 /* SMS block mode */
  287. #define N_HDLC 13 /* synchronous HDLC */
  288. #define N_SYNC_PPP 14 /* synchronous PPP */
  289. #define N_HCI 15 /* Bluetooth HCI UART */