termbits.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_SPARC_TERMBITS_H
  3. #define _UAPI_SPARC_TERMBITS_H
  4. #include <asm-generic/termbits-common.h>
  5. #if defined(__sparc__) && defined(__arch64__)
  6. typedef unsigned int tcflag_t;
  7. #else
  8. typedef unsigned long tcflag_t;
  9. #endif
  10. #define NCC 8
  11. struct termio {
  12. unsigned short c_iflag; /* input mode flags */
  13. unsigned short c_oflag; /* output mode flags */
  14. unsigned short c_cflag; /* control mode flags */
  15. unsigned short c_lflag; /* local mode flags */
  16. unsigned char c_line; /* line discipline */
  17. unsigned char c_cc[NCC]; /* control characters */
  18. };
  19. #define NCCS 17
  20. struct termios {
  21. tcflag_t c_iflag; /* input mode flags */
  22. tcflag_t c_oflag; /* output mode flags */
  23. tcflag_t c_cflag; /* control mode flags */
  24. tcflag_t c_lflag; /* local mode flags */
  25. cc_t c_line; /* line discipline */
  26. #ifndef __KERNEL__
  27. cc_t c_cc[NCCS]; /* control characters */
  28. #else
  29. cc_t c_cc[NCCS+2]; /* kernel needs 2 more to hold vmin/vtime */
  30. #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
  31. #endif
  32. };
  33. struct termios2 {
  34. tcflag_t c_iflag; /* input mode flags */
  35. tcflag_t c_oflag; /* output mode flags */
  36. tcflag_t c_cflag; /* control mode flags */
  37. tcflag_t c_lflag; /* local mode flags */
  38. cc_t c_line; /* line discipline */
  39. cc_t c_cc[NCCS+2]; /* control characters */
  40. speed_t c_ispeed; /* input speed */
  41. speed_t c_ospeed; /* output speed */
  42. };
  43. struct ktermios {
  44. tcflag_t c_iflag; /* input mode flags */
  45. tcflag_t c_oflag; /* output mode flags */
  46. tcflag_t c_cflag; /* control mode flags */
  47. tcflag_t c_lflag; /* local mode flags */
  48. cc_t c_line; /* line discipline */
  49. cc_t c_cc[NCCS+2]; /* control characters */
  50. speed_t c_ispeed; /* input speed */
  51. speed_t c_ospeed; /* output speed */
  52. };
  53. /* c_cc characters */
  54. #define VINTR 0
  55. #define VQUIT 1
  56. #define VERASE 2
  57. #define VKILL 3
  58. #define VEOF 4
  59. #define VEOL 5
  60. #define VEOL2 6
  61. #define VSWTC 7
  62. #define VSTART 8
  63. #define VSTOP 9
  64. #define VSUSP 10
  65. #define VDSUSP 11 /* SunOS POSIX nicety I do believe... */
  66. #define VREPRINT 12
  67. #define VDISCARD 13
  68. #define VWERASE 14
  69. #define VLNEXT 15
  70. /* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is
  71. * shared with eof/eol
  72. */
  73. #ifndef __KERNEL__
  74. #define VMIN VEOF
  75. #define VTIME VEOL
  76. #endif
  77. /* c_iflag bits */
  78. #define IUCLC 0x0200
  79. #define IXON 0x0400
  80. #define IXOFF 0x1000
  81. #define IMAXBEL 0x2000
  82. #define IUTF8 0x4000
  83. /* c_oflag bits */
  84. #define OLCUC 0x00002
  85. #define ONLCR 0x00004
  86. #define NLDLY 0x00100
  87. #define NL0 0x00000
  88. #define NL1 0x00100
  89. #define CRDLY 0x00600
  90. #define CR0 0x00000
  91. #define CR1 0x00200
  92. #define CR2 0x00400
  93. #define CR3 0x00600
  94. #define TABDLY 0x01800
  95. #define TAB0 0x00000
  96. #define TAB1 0x00800
  97. #define TAB2 0x01000
  98. #define TAB3 0x01800
  99. #define XTABS 0x01800
  100. #define BSDLY 0x02000
  101. #define BS0 0x00000
  102. #define BS1 0x02000
  103. #define VTDLY 0x04000
  104. #define VT0 0x00000
  105. #define VT1 0x04000
  106. #define FFDLY 0x08000
  107. #define FF0 0x00000
  108. #define FF1 0x08000
  109. #define PAGEOUT 0x10000 /* SUNOS specific */
  110. #define WRAP 0x20000 /* SUNOS specific */
  111. /* c_cflag bit meaning */
  112. #define CBAUD 0x0000100f
  113. #define CSIZE 0x00000030
  114. #define CS5 0x00000000
  115. #define CS6 0x00000010
  116. #define CS7 0x00000020
  117. #define CS8 0x00000030
  118. #define CSTOPB 0x00000040
  119. #define CREAD 0x00000080
  120. #define PARENB 0x00000100
  121. #define PARODD 0x00000200
  122. #define HUPCL 0x00000400
  123. #define CLOCAL 0x00000800
  124. #define CBAUDEX 0x00001000
  125. /* We'll never see these speeds with the Zilogs, but for completeness... */
  126. #define BOTHER 0x00001000
  127. #define B57600 0x00001001
  128. #define B115200 0x00001002
  129. #define B230400 0x00001003
  130. #define B460800 0x00001004
  131. /* This is what we can do with the Zilogs. */
  132. #define B76800 0x00001005
  133. /* This is what we can do with the SAB82532. */
  134. #define B153600 0x00001006
  135. #define B307200 0x00001007
  136. #define B614400 0x00001008
  137. #define B921600 0x00001009
  138. /* And these are the rest... */
  139. #define B500000 0x0000100a
  140. #define B576000 0x0000100b
  141. #define B1000000 0x0000100c
  142. #define B1152000 0x0000100d
  143. #define B1500000 0x0000100e
  144. #define B2000000 0x0000100f
  145. /* These have totally bogus values and nobody uses them
  146. so far. Later on we'd have to use say 0x10000x and
  147. adjust CBAUD constant and drivers accordingly.
  148. #define B2500000 0x00001010
  149. #define B3000000 0x00001011
  150. #define B3500000 0x00001012
  151. #define B4000000 0x00001013 */
  152. #define CIBAUD 0x100f0000 /* input baud rate (not used) */
  153. /* c_lflag bits */
  154. #define ISIG 0x00000001
  155. #define ICANON 0x00000002
  156. #define XCASE 0x00000004
  157. #define ECHO 0x00000008
  158. #define ECHOE 0x00000010
  159. #define ECHOK 0x00000020
  160. #define ECHONL 0x00000040
  161. #define NOFLSH 0x00000080
  162. #define TOSTOP 0x00000100
  163. #define ECHOCTL 0x00000200
  164. #define ECHOPRT 0x00000400
  165. #define ECHOKE 0x00000800
  166. #define DEFECHO 0x00001000 /* SUNOS thing, what is it? */
  167. #define FLUSHO 0x00002000
  168. #define PENDIN 0x00004000
  169. #define IEXTEN 0x00008000
  170. #define EXTPROC 0x00010000
  171. /* modem lines */
  172. #define TIOCM_LE 0x001
  173. #define TIOCM_DTR 0x002
  174. #define TIOCM_RTS 0x004
  175. #define TIOCM_ST 0x008
  176. #define TIOCM_SR 0x010
  177. #define TIOCM_CTS 0x020
  178. #define TIOCM_CAR 0x040
  179. #define TIOCM_RNG 0x080
  180. #define TIOCM_DSR 0x100
  181. #define TIOCM_CD TIOCM_CAR
  182. #define TIOCM_RI TIOCM_RNG
  183. #define TIOCM_OUT1 0x2000
  184. #define TIOCM_OUT2 0x4000
  185. #define TIOCM_LOOP 0x8000
  186. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  187. #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  188. /* tcsetattr uses these */
  189. #define TCSANOW 0
  190. #define TCSADRAIN 1
  191. #define TCSAFLUSH 2
  192. #endif /* _UAPI_SPARC_TERMBITS_H */