termios.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _TERMIOS_H
  15. # error "Never include <bits/termios.h> directly; use <termios.h> instead."
  16. #endif
  17. typedef unsigned char cc_t;
  18. typedef unsigned int speed_t;
  19. typedef unsigned int tcflag_t;
  20. /*
  21. * termios type and macro definitions. Be careful about adding stuff
  22. * to this file since it's used in GNU libc and there are strict rules
  23. * concerning namespace pollution.
  24. */
  25. #define NCCS 32
  26. struct termios {
  27. tcflag_t c_iflag; /* input mode flags */
  28. tcflag_t c_oflag; /* output mode flags */
  29. tcflag_t c_cflag; /* control mode flags */
  30. tcflag_t c_lflag; /* local mode flags */
  31. cc_t c_line; /* line discipline (== c_cc[19]) */
  32. cc_t c_cc[NCCS]; /* control characters */
  33. speed_t c_ispeed; /* input speed */
  34. speed_t c_ospeed; /* output speed */
  35. #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
  36. #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
  37. };
  38. /* c_cc characters */
  39. #define VINTR 0
  40. #define VQUIT 1
  41. #define VERASE 2
  42. #define VKILL 3
  43. #define VEOF 4
  44. #define VMIN 5
  45. #define VEOL 6
  46. #define VTIME 7
  47. #define VEOL2 8
  48. #define VSWTC 9
  49. #define VWERASE 10
  50. #define VREPRINT 11
  51. #define VSUSP 12
  52. #define VSTART 13
  53. #define VSTOP 14
  54. #define VLNEXT 15
  55. #define VDISCARD 16
  56. /* c_iflag bits */
  57. #define IGNBRK 0000001
  58. #define BRKINT 0000002
  59. #define IGNPAR 0000004
  60. #define PARMRK 0000010
  61. #define INPCK 0000020
  62. #define ISTRIP 0000040
  63. #define INLCR 0000100
  64. #define IGNCR 0000200
  65. #define ICRNL 0000400
  66. #define IXON 0001000
  67. #define IXOFF 0002000
  68. #define IXANY 0004000
  69. #define IUCLC 0010000
  70. #define IMAXBEL 0020000
  71. #define IUTF8 0040000
  72. /* c_oflag bits */
  73. #define OPOST 0000001
  74. #define ONLCR 0000002
  75. #define OLCUC 0000004
  76. #define OCRNL 0000010
  77. #define ONOCR 0000020
  78. #define ONLRET 0000040
  79. #define OFILL 00000100
  80. #define OFDEL 00000200
  81. #if defined __USE_MISC || defined __USE_XOPEN
  82. # define NLDLY 00001400
  83. # define NL0 00000000
  84. # define NL1 00000400
  85. # define NL2 00001000
  86. # define NL3 00001400
  87. # define TABDLY 00006000
  88. # define TAB0 00000000
  89. # define TAB1 00002000
  90. # define TAB2 00004000
  91. # define TAB3 00006000
  92. # define CRDLY 00030000
  93. # define CR0 00000000
  94. # define CR1 00010000
  95. # define CR2 00020000
  96. # define CR3 00030000
  97. # define FFDLY 00040000
  98. # define FF0 00000000
  99. # define FF1 00040000
  100. # define BSDLY 00100000
  101. # define BS0 00000000
  102. # define BS1 00100000
  103. #endif
  104. #define VTDLY 00200000
  105. #define VT0 00000000
  106. #define VT1 00200000
  107. #ifdef __USE_MISC
  108. # define XTABS 00006000
  109. #endif
  110. /* c_cflag bit meaning */
  111. #ifdef __USE_MISC
  112. # define CBAUD 0000377
  113. #endif
  114. #define B0 0000000 /* hang up */
  115. #define B50 0000001
  116. #define B75 0000002
  117. #define B110 0000003
  118. #define B134 0000004
  119. #define B150 0000005
  120. #define B200 0000006
  121. #define B300 0000007
  122. #define B600 0000010
  123. #define B1200 0000011
  124. #define B1800 0000012
  125. #define B2400 0000013
  126. #define B4800 0000014
  127. #define B9600 0000015
  128. #define B19200 0000016
  129. #define B38400 0000017
  130. #ifdef __USE_MISC
  131. # define EXTA B19200
  132. # define EXTB B38400
  133. # define CBAUDEX 0000020
  134. #endif
  135. #define B57600 00020
  136. #define B115200 00021
  137. #define B230400 00022
  138. #define B460800 00023
  139. #define B500000 00024
  140. #define B576000 00025
  141. #define B921600 00026
  142. #define B1000000 00027
  143. #define B1152000 00030
  144. #define B1500000 00031
  145. #define B2000000 00032
  146. #define B2500000 00033
  147. #define B3000000 00034
  148. #define B3500000 00035
  149. #define B4000000 00036
  150. #define __MAX_BAUD B4000000
  151. #define CSIZE 00001400
  152. #define CS5 00000000
  153. #define CS6 00000400
  154. #define CS7 00001000
  155. #define CS8 00001400
  156. #define CSTOPB 00002000
  157. #define CREAD 00004000
  158. #define PARENB 00010000
  159. #define PARODD 00020000
  160. #define HUPCL 00040000
  161. #define CLOCAL 00100000
  162. #ifdef __USE_MISC
  163. # define CMSPAR 010000000000 /* mark or space (stick) parity */
  164. # define CRTSCTS 020000000000 /* flow control */
  165. #endif
  166. /* c_lflag bits */
  167. #define ISIG 0x00000080
  168. #define ICANON 0x00000100
  169. #if defined __USE_MISC || defined __USE_XOPEN
  170. # define XCASE 0x00004000
  171. #endif
  172. #define ECHO 0x00000008
  173. #define ECHOE 0x00000002
  174. #define ECHOK 0x00000004
  175. #define ECHONL 0x00000010
  176. #define NOFLSH 0x80000000
  177. #define TOSTOP 0x00400000
  178. #ifdef __USE_MISC
  179. # define ECHOCTL 0x00000040
  180. # define ECHOPRT 0x00000020
  181. # define ECHOKE 0x00000001
  182. # define FLUSHO 0x00800000
  183. # define PENDIN 0x20000000
  184. #endif
  185. #define IEXTEN 0x00000400
  186. /* Values for the ACTION argument to `tcflow'. */
  187. #define TCOOFF 0
  188. #define TCOON 1
  189. #define TCIOFF 2
  190. #define TCION 3
  191. /* Values for the QUEUE_SELECTOR argument to `tcflush'. */
  192. #define TCIFLUSH 0
  193. #define TCOFLUSH 1
  194. #define TCIOFLUSH 2
  195. /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
  196. #define TCSANOW 0
  197. #define TCSADRAIN 1
  198. #define TCSAFLUSH 2
  199. #ifndef __UCLIBC_STRICT_HEADERS__
  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. #endif
  208. struct tchars {
  209. char t_intrc;
  210. char t_quitc;
  211. char t_startc;
  212. char t_stopc;
  213. char t_eofc;
  214. char t_brkc;
  215. };
  216. struct ltchars {
  217. char t_suspc;
  218. char t_dsuspc;
  219. char t_rprntc;
  220. char t_flushc;
  221. char t_werasc;
  222. char t_lnextc;
  223. };
  224. /* Used for packet mode */
  225. #define TIOCPKT_DATA 0
  226. #define TIOCPKT_FLUSHREAD 1
  227. #define TIOCPKT_FLUSHWRITE 2
  228. #define TIOCPKT_STOP 4
  229. #define TIOCPKT_START 8
  230. #define TIOCPKT_NOSTOP 16
  231. #define TIOCPKT_DOSTOP 32
  232. /* c_cc characters */
  233. #define _VINTR 0
  234. #define _VQUIT 1
  235. #define _VERASE 2
  236. #define _VKILL 3
  237. #define _VEOF 4
  238. #define _VMIN 5
  239. #define _VEOL 6
  240. #define _VTIME 7
  241. #define _VEOL2 8
  242. #define _VSWTC 9
  243. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  244. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */