termbits.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. #ifndef _SPARC_TERMBITS_H
  2. #define _SPARC_TERMBITS_H
  3. #include <linux/posix_types.h>
  4. typedef unsigned char cc_t;
  5. typedef unsigned int speed_t;
  6. typedef unsigned long tcflag_t;
  7. #define NCC 8
  8. struct termio {
  9. unsigned short c_iflag; /* input mode flags */
  10. unsigned short c_oflag; /* output mode flags */
  11. unsigned short c_cflag; /* control mode flags */
  12. unsigned short c_lflag; /* local mode flags */
  13. unsigned char c_line; /* line discipline */
  14. unsigned char c_cc[NCC]; /* control characters */
  15. };
  16. #define NCCS 17
  17. struct termios {
  18. tcflag_t c_iflag; /* input mode flags */
  19. tcflag_t c_oflag; /* output mode flags */
  20. tcflag_t c_cflag; /* control mode flags */
  21. tcflag_t c_lflag; /* local mode flags */
  22. cc_t c_line; /* line discipline */
  23. cc_t c_cc[NCCS]; /* control characters */
  24. #ifdef __KERNEL__
  25. #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
  26. cc_t _x_cc[2]; /* We need them to hold vmin/vtime */
  27. #endif
  28. };
  29. struct ktermios {
  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_line; /* line discipline */
  35. cc_t c_cc[NCCS]; /* control characters */
  36. cc_t _x_cc[2]; /* We need them to hold vmin/vtime */
  37. speed_t c_ispeed; /* input speed */
  38. speed_t c_ospeed; /* output speed */
  39. };
  40. /* c_cc characters */
  41. #define VINTR 0
  42. #define VQUIT 1
  43. #define VERASE 2
  44. #define VKILL 3
  45. #define VEOF 4
  46. #define VEOL 5
  47. #define VEOL2 6
  48. #define VSWTC 7
  49. #define VSTART 8
  50. #define VSTOP 9
  51. #define VSUSP 10
  52. #define VDSUSP 11 /* SunOS POSIX nicety I do believe... */
  53. #define VREPRINT 12
  54. #define VDISCARD 13
  55. #define VWERASE 14
  56. #define VLNEXT 15
  57. /* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is
  58. * shared with eof/eol
  59. */
  60. #ifdef __KERNEL__
  61. #define VMIN 16
  62. #define VTIME 17
  63. #else
  64. #define VMIN VEOF
  65. #define VTIME VEOL
  66. #endif
  67. /* c_iflag bits */
  68. #define IGNBRK 0x00000001
  69. #define BRKINT 0x00000002
  70. #define IGNPAR 0x00000004
  71. #define PARMRK 0x00000008
  72. #define INPCK 0x00000010
  73. #define ISTRIP 0x00000020
  74. #define INLCR 0x00000040
  75. #define IGNCR 0x00000080
  76. #define ICRNL 0x00000100
  77. #define IUCLC 0x00000200
  78. #define IXON 0x00000400
  79. #define IXANY 0x00000800
  80. #define IXOFF 0x00001000
  81. #define IMAXBEL 0x00002000
  82. #define IUTF8 0x00004000
  83. /* c_oflag bits */
  84. #define OPOST 0x00000001
  85. #define OLCUC 0x00000002
  86. #define ONLCR 0x00000004
  87. #define OCRNL 0x00000008
  88. #define ONOCR 0x00000010
  89. #define ONLRET 0x00000020
  90. #define OFILL 0x00000040
  91. #define OFDEL 0x00000080
  92. #define NLDLY 0x00000100
  93. #define NL0 0x00000000
  94. #define NL1 0x00000100
  95. #define CRDLY 0x00000600
  96. #define CR0 0x00000000
  97. #define CR1 0x00000200
  98. #define CR2 0x00000400
  99. #define CR3 0x00000600
  100. #define TABDLY 0x00001800
  101. #define TAB0 0x00000000
  102. #define TAB1 0x00000800
  103. #define TAB2 0x00001000
  104. #define TAB3 0x00001800
  105. #define XTABS 0x00001800
  106. #define BSDLY 0x00002000
  107. #define BS0 0x00000000
  108. #define BS1 0x00002000
  109. #define VTDLY 0x00004000
  110. #define VT0 0x00000000
  111. #define VT1 0x00004000
  112. #define FFDLY 0x00008000
  113. #define FF0 0x00000000
  114. #define FF1 0x00008000
  115. #define PAGEOUT 0x00010000 /* SUNOS specific */
  116. #define WRAP 0x00020000 /* SUNOS specific */
  117. /* c_cflag bit meaning */
  118. #define CBAUD 0x0000100f
  119. #define B0 0x00000000 /* hang up */
  120. #define B50 0x00000001
  121. #define B75 0x00000002
  122. #define B110 0x00000003
  123. #define B134 0x00000004
  124. #define B150 0x00000005
  125. #define B200 0x00000006
  126. #define B300 0x00000007
  127. #define B600 0x00000008
  128. #define B1200 0x00000009
  129. #define B1800 0x0000000a
  130. #define B2400 0x0000000b
  131. #define B4800 0x0000000c
  132. #define B9600 0x0000000d
  133. #define B19200 0x0000000e
  134. #define B38400 0x0000000f
  135. #define EXTA B19200
  136. #define EXTB B38400
  137. #define CSIZE 0x00000030
  138. #define CS5 0x00000000
  139. #define CS6 0x00000010
  140. #define CS7 0x00000020
  141. #define CS8 0x00000030
  142. #define CSTOPB 0x00000040
  143. #define CREAD 0x00000080
  144. #define PARENB 0x00000100
  145. #define PARODD 0x00000200
  146. #define HUPCL 0x00000400
  147. #define CLOCAL 0x00000800
  148. #define CBAUDEX 0x00001000
  149. /* We'll never see these speeds with the Zilogs, but for completeness... */
  150. #define B57600 0x00001001
  151. #define B115200 0x00001002
  152. #define B230400 0x00001003
  153. #define B460800 0x00001004
  154. /* This is what we can do with the Zilogs. */
  155. #define B76800 0x00001005
  156. /* This is what we can do with the SAB82532. */
  157. #define B153600 0x00001006
  158. #define B307200 0x00001007
  159. #define B614400 0x00001008
  160. #define B921600 0x00001009
  161. /* And these are the rest... */
  162. #define B500000 0x0000100a
  163. #define B576000 0x0000100b
  164. #define B1000000 0x0000100c
  165. #define B1152000 0x0000100d
  166. #define B1500000 0x0000100e
  167. #define B2000000 0x0000100f
  168. /* These have totally bogus values and nobody uses them
  169. so far. Later on we'd have to use say 0x10000x and
  170. adjust CBAUD constant and drivers accordingly.
  171. #define B2500000 0x00001010
  172. #define B3000000 0x00001011
  173. #define B3500000 0x00001012
  174. #define B4000000 0x00001013 */
  175. #define CIBAUD 0x100f0000 /* input baud rate (not used) */
  176. #define CMSPAR 0x40000000 /* mark or space (stick) parity */
  177. #define CRTSCTS 0x80000000 /* flow control */
  178. /* c_lflag bits */
  179. #define ISIG 0x00000001
  180. #define ICANON 0x00000002
  181. #define XCASE 0x00000004
  182. #define ECHO 0x00000008
  183. #define ECHOE 0x00000010
  184. #define ECHOK 0x00000020
  185. #define ECHONL 0x00000040
  186. #define NOFLSH 0x00000080
  187. #define TOSTOP 0x00000100
  188. #define ECHOCTL 0x00000200
  189. #define ECHOPRT 0x00000400
  190. #define ECHOKE 0x00000800
  191. #define DEFECHO 0x00001000 /* SUNOS thing, what is it? */
  192. #define FLUSHO 0x00002000
  193. #define PENDIN 0x00004000
  194. #define IEXTEN 0x00008000
  195. /* modem lines */
  196. #define TIOCM_LE 0x001
  197. #define TIOCM_DTR 0x002
  198. #define TIOCM_RTS 0x004
  199. #define TIOCM_ST 0x008
  200. #define TIOCM_SR 0x010
  201. #define TIOCM_CTS 0x020
  202. #define TIOCM_CAR 0x040
  203. #define TIOCM_RNG 0x080
  204. #define TIOCM_DSR 0x100
  205. #define TIOCM_CD TIOCM_CAR
  206. #define TIOCM_RI TIOCM_RNG
  207. #define TIOCM_OUT1 0x2000
  208. #define TIOCM_OUT2 0x4000
  209. #define TIOCM_LOOP 0x8000
  210. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  211. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  212. /* tcflow() and TCXONC use these */
  213. #define TCOOFF 0
  214. #define TCOON 1
  215. #define TCIOFF 2
  216. #define TCION 3
  217. /* tcflush() and TCFLSH use these */
  218. #define TCIFLUSH 0
  219. #define TCOFLUSH 1
  220. #define TCIOFLUSH 2
  221. /* tcsetattr uses these */
  222. #define TCSANOW 0
  223. #define TCSADRAIN 1
  224. #define TCSAFLUSH 2
  225. #endif /* !(_SPARC_TERMBITS_H) */