1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20: #ifndef _TERMIOS_H
21: # error "Never include <bits/termios.h> directly; use <termios.h> instead."
22: #endif
23:
24:
25:
26:
27: #ifdef __USE_BSD
28:
29: # ifdef MDMBUF
30: # undef MDMBUF
31: # endif
32: # ifdef FLUSHO
33: # undef FLUSHO
34: # endif
35: # ifdef PENDIN
36: # undef PENDIN
37: # endif
38:
39: #endif
40:
41: #ifdef ECHO
42: # undef ECHO
43: #endif
44: #ifdef TOSTOP
45: # undef TOSTOP
46: #endif
47: #ifdef NOFLSH
48: # undef NOFLSH
49: #endif
50:
51:
52:
53:
54:
55:
56:
57:
58:
59: typedef unsigned long int tcflag_t;
60:
61:
62: typedef unsigned char cc_t;
63:
64:
65: typedef long int speed_t;
66:
67:
68: struct termios
69: {
70:
71: tcflag_t c_iflag;
72: #define IGNBRK (1 << 0)
73: #define BRKINT (1 << 1)
74: #define IGNPAR (1 << 2)
75: #define PARMRK (1 << 3)
76: #define INPCK (1 << 4)
77: #define ISTRIP (1 << 5)
78: #define INLCR (1 << 6)
79: #define IGNCR (1 << 7)
80: #define ICRNL (1 << 8)
81: #define IXON (1 << 9)
82: #define IXOFF (1 << 10)
83: #ifdef __USE_BSD
84: # define IXANY (1 << 11)
85: # define IMAXBEL (1 << 13)
86: #endif
87: #ifdef __USE_GNU
88: # define IUCLC (1 << 14)
89: #endif
90:
91:
92: tcflag_t c_oflag;
93: #define OPOST (1 << 0)
94: #ifdef __USE_BSD
95: # define ONLCR (1 << 1)
96: # define OXTABS (1 << 2)
97: # define ONOEOT (1 << 3)
98: #endif
99: #ifdef __USE_GNU
100: # define OLCUC (1 << 9)
101: #endif
102:
103:
104: tcflag_t c_cflag;
105: #ifdef __USE_BSD
106: # define CIGNORE (1 << 0)
107: #endif
108: #define CSIZE (CS5|CS6|CS7|CS8)
109: #define CS5 0
110: #define CS6 (1 << 8)
111: #define CS7 (1 << 9)
112: #define CS8 (CS6|CS7)
113: #define CSTOPB (1 << 10)
114: #define CREAD (1 << 11)
115: #define PARENB (1 << 12)
116: #define PARODD (1 << 13)
117: #define HUPCL (1 << 14)
118: #define CLOCAL (1 << 15)
119: #ifdef __USE_BSD
120: # define CCTS_OFLOW (1 << 16)
121: # define CRTS_IFLOW (1 << 17)
122: # define CRTSCTS (CCTS_OFLOW|CRTS_IFLOW)
123: # define MDMBUF (1 << 20)
124: #endif
125:
126:
127: tcflag_t c_lflag;
128: #ifdef __USE_BSD
129: # define ECHOKE (1 << 0)
130: #endif
131: #define _ECHOE (1 << 1)
132: #define ECHOE _ECHOE
133: #define _ECHOK (1 << 2)
134: #define ECHOK _ECHOK
135: #define _ECHO (1 << 3)
136: #define ECHO _ECHO
137: #define _ECHONL (1 << 4)
138: #define ECHONL _ECHONL
139: #ifdef __USE_BSD
140: # define ECHOPRT (1 << 5)
141: # define ECHOCTL (1 << 6)
142: #endif
143: #define _ISIG (1 << 7)
144: #define ISIG _ISIG
145: #define _ICANON (1 << 8)
146: #define ICANON _ICANON
147: #ifdef __USE_BSD
148: # define ALTWERASE (1 << 9)
149: #endif
150: #define _IEXTEN (1 << 10)
151: #define IEXTEN _IEXTEN
152: #define EXTPROC (1 << 11)
153: #define _TOSTOP (1 << 22)
154: #define TOSTOP _TOSTOP
155: #ifdef __USE_BSD
156: # define FLUSHO (1 << 23)
157: # define NOKERNINFO (1 << 25)
158: # define PENDIN (1 << 29)
159: #endif
160: #define _NOFLSH (1 << 31)
161: #define NOFLSH _NOFLSH
162:
163:
164: #define VEOF 0
165: #define VEOL 1
166: #ifdef __USE_BSD
167: # define VEOL2 2
168: #endif
169: #define VERASE 3
170: #ifdef __USE_BSD
171: # define VWERASE 4
172: #endif
173: #define VKILL 5
174: #ifdef __USE_BSD
175: # define VREPRINT 6
176: #endif
177: #define VINTR 8
178: #define VQUIT 9
179: #define VSUSP 10
180: #ifdef __USE_BSD
181: # define VDSUSP 11
182: #endif
183: #define VSTART 12
184: #define VSTOP 13
185: #ifdef __USE_BSD
186: # define VLNEXT 14
187: # define VDISCARD 15
188: #endif
189: #define VMIN 16
190: #define VTIME 17
191: #ifdef __USE_BSD
192: # define VSTATUS 18
193: #endif
194: #define NCCS 20
195: cc_t c_cc[NCCS];
196:
197:
198: speed_t __ispeed, __ospeed;
199: #define B0 0
200: #define B50 50
201: #define B75 75
202: #define B110 110
203: #define B134 134
204: #define B150 150
205: #define B200 200
206: #define B300 300
207: #define B600 600
208: #define B1200 1200
209: #define B1800 1800
210: #define B2400 2400
211: #define B4800 4800
212: #define B9600 9600
213: #define B19200 19200
214: #define B38400 38400
215: #ifdef __USE_MISC
216: # define EXTA 19200
217: # define EXTB 38400
218: #endif
219: #define B57600 57600
220: #define B115200 115200
221: #define B230400 230400
222: #define B460800 460800
223: #define B500000 500000
224: #define B576000 576000
225: #define B921600 921600
226: #define B1000000 1000000
227: #define B1152000 1152000
228: #define B1500000 1500000
229: #define B2000000 2000000
230: #define B2500000 2500000
231: #define B3000000 3000000
232: #define B3500000 3500000
233: #define B4000000 4000000
234: };
235:
236: #define _IOT_termios \
237: _IOT (_IOTS (tcflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
238:
239:
240: #define TCSANOW 0
241: #define TCSADRAIN 1
242: #define TCSAFLUSH 2
243: #ifdef __USE_BSD
244: # define TCSASOFT 0x10
245: #endif
246:
247:
248: #define TCIFLUSH 1
249: #define TCOFLUSH 2
250: #define TCIOFLUSH 3
251:
252:
253: #define TCOOFF 1
254: #define TCOON 2
255: #define TCIOFF 3
256: #define TCION 4