Subversion Repositories tendra.SVN

Rev

Rev 79 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
79 7u83 1
#ifndef __TENDRA_TERMIOS_H
2
#define __TENDRA_TERMIOS_H
3
 
4
#define	NCCS		20
5
typedef unsigned int	speed_t;
6
typedef unsigned char	cc_t;
7
typedef unsigned int	tcflag_t;
8
 
9
struct termios {
10
	tcflag_t	c_iflag;	/* input flags */
11
	tcflag_t	c_oflag;	/* output flags */
12
	tcflag_t	c_cflag;	/* control flags */
13
	tcflag_t	c_lflag;	/* local flags */
14
	cc_t		c_cc[NCCS];	/* control chars */
15
	speed_t		c_ispeed;	/* input speed */
16
	speed_t		c_ospeed;	/* output speed */
17
};
18
 
19
 
20
#if __BSD_VISIBLE
21
#define	ECHOKE		0x00000001	/* visual erase for line kill */
22
#endif
23
#define	ECHOE		0x00000002	/* visually erase chars */
24
#define	ECHOK		0x00000004	/* echo NL after line kill */
25
#define	ECHO		0x00000008	/* enable echoing */
26
#define	ECHONL		0x00000010	/* echo NL even if ECHO is off */
27
#if __BSD_VISIBLE
28
#define	ECHOPRT		0x00000020	/* visual erase mode for hardcopy */
29
#define	ECHOCTL  	0x00000040	/* echo control chars as ^(Char) */
30
#endif
31
#define	ISIG		0x00000080	/* enable signals INTR, QUIT, [D]SUSP */
32
#define	ICANON		0x00000100	/* canonicalize input lines */
33
#if __BSD_VISIBLE
34
#define	ALTWERASE	0x00000200	/* use alternate WERASE algorithm */
35
#endif
36
#define	IEXTEN		0x00000400	/* enable DISCARD and LNEXT */
37
#define	EXTPROC         0x00000800      /* external processing */
38
#define	TOSTOP		0x00400000	/* stop background jobs from output */
39
#if __BSD_VISIBLE
40
#define	FLUSHO		0x00800000	/* output being flushed (state) */
41
#define	NOKERNINFO	0x02000000	/* no kernel output from VSTATUS */
42
#define	PENDIN		0x20000000	/* XXX retype pending input (state) */
43
#endif
44
#define	NOFLSH		0x80000000	/* don't flush after interrupt */
45
 
46
 
47
/*
48
 * Input flags - software input processing
49
 */
50
#define	IGNBRK		0x00000001	/* ignore BREAK condition */
51
#define	BRKINT		0x00000002	/* map BREAK to SIGINTR */
52
#define	IGNPAR		0x00000004	/* ignore (discard) parity errors */
53
#define	PARMRK		0x00000008	/* mark parity and framing errors */
54
#define	INPCK		0x00000010	/* enable checking of parity errors */
55
#define	ISTRIP		0x00000020	/* strip 8th bit off chars */
56
#define	INLCR		0x00000040	/* map NL into CR */
57
#define	IGNCR		0x00000080	/* ignore CR */
58
#define	ICRNL		0x00000100	/* map CR to NL (ala CRMOD) */
59
#define	IXON		0x00000200	/* enable output flow control */
60
#define	IXOFF		0x00000400	/* enable input flow control */
61
 
62
 
63
/*
64
 * Standard speeds
65
 */
66
 
67
#define	B0	0
68
#define	B50	50
69
#define	B75	75
70
#define	B110	110
71
#define	B134	134
72
#define	B150	150
73
#define	B200	200
74
#define	B300	300
75
#define	B600	600
76
#define	B1200	1200
77
#define	B1800	1800
78
#define	B2400	2400
79
#define	B4800	4800
80
#define	B9600	9600
81
#define	B19200	19200
82
#define	B38400	38400
83
 
84
 
85
#if __BSD_VISIBLE
86
#define	B7200	7200
87
#define	B14400	14400
88
#define	B28800	28800
89
#define	B57600	57600
90
#define	B76800	76800
91
#define	B115200	115200
92
#define	B230400	230400
93
#define	B460800	460800
94
#define	B921600	921600
95
#define	EXTA	19200
96
#define	EXTB	38400
97
#endif
98
 
99
/*
100
 * Special Control Characters
101
 *
102
 * Index into c_cc[] character array.
103
 *
104
 *	Name	     Subscript	Enabled by
105
 */
106
#define	VEOF		0	/* ICANON */
107
#define	VEOL		1	/* ICANON */
108
#if __BSD_VISIBLE
109
#define	VEOL2		2	/* ICANON together with IEXTEN */
110
#endif
111
#define	VERASE		3	/* ICANON */
112
#if __BSD_VISIBLE
113
#define	VWERASE 	4	/* ICANON together with IEXTEN */
114
#endif
115
#define	VKILL		5	/* ICANON */
116
#if __BSD_VISIBLE
117
#define	VREPRINT 	6	/* ICANON together with IEXTEN */
118
#define	VERASE2 	7	/* ICANON */
119
#endif
120
/*			7	   ex-spare 1 */
121
#define	VINTR		8	/* ISIG */
122
#define	VQUIT		9	/* ISIG */
123
#define	VSUSP		10	/* ISIG */
124
#if __BSD_VISIBLE
125
#define	VDSUSP		11	/* ISIG together with IEXTEN */
126
#endif
127
#define	VSTART		12	/* IXON, IXOFF */
128
#define	VSTOP		13	/* IXON, IXOFF */
129
#if __BSD_VISIBLE
130
#define	VLNEXT		14	/* IEXTEN */
131
#define	VDISCARD	15	/* IEXTEN */
132
#endif
133
#define	VMIN		16	/* !ICANON */
134
#define	VTIME		17	/* !ICANON */
135
#if __BSD_VISIBLE
136
#define	VSTATUS		18	/* ICANON together with IEXTEN */
137
/*			19	   spare 2 */
138
#endif
139
 
140
 
141
 
142
 
143
/*
144
 * Output flags - software output processing
145
 */
146
#define	OPOST		0x00000001	/* enable following output processing */
147
#if __XSI_VISIBLE
148
#define	ONLCR		0x00000002	/* map NL to CR-NL (ala CRMOD) */
149
#endif
150
#if __BSD_VISIBLE
151
#define	TABDLY		0x00000004	/* tab delay mask */
152
#define	    TAB0	    0x00000000	    /* no tab delay and expansion */
153
#define	    TAB3	    0x00000004	    /* expand tabs to spaces */
154
#define	ONOEOT		0x00000008	/* discard EOT's (^D) on output) */
155
#endif
156
#if __XSI_VISIBLE
157
#define	OCRNL		0x00000010	/* map CR to NL on output */
158
#define	ONOCR		0x00000020	/* no CR output at column 0 */
159
#define	ONLRET		0x00000040	/* NL performs CR function */
160
#endif
161
 
162
/*
163
 * Control flags - hardware control of terminal
164
 */
165
#if __BSD_VISIBLE
166
#define	CIGNORE		0x00000001	/* ignore control flags */
167
#endif
168
#define	CSIZE		0x00000300	/* character size mask */
169
#define	    CS5		    0x00000000	    /* 5 bits (pseudo) */
170
#define	    CS6		    0x00000100	    /* 6 bits */
171
#define	    CS7		    0x00000200	    /* 7 bits */
172
#define	    CS8		    0x00000300	    /* 8 bits */
173
#define	CSTOPB		0x00000400	/* send 2 stop bits */
174
#define	CREAD		0x00000800	/* enable receiver */
175
#define	PARENB		0x00001000	/* parity enable */
176
#define	PARODD		0x00002000	/* odd parity, else even */
177
#define	HUPCL		0x00004000	/* hang up on last close */
178
#define	CLOCAL		0x00008000	/* ignore modem status lines */
179
#if __BSD_VISIBLE
180
#define	CCTS_OFLOW	0x00010000	/* CTS flow control of output */
181
#define	CRTSCTS		(CCTS_OFLOW | CRTS_IFLOW)
182
#define	CRTS_IFLOW	0x00020000	/* RTS flow control of input */
183
#define	CDTR_IFLOW	0x00040000	/* DTR flow control of input */
184
#define	CDSR_OFLOW	0x00080000	/* DSR flow control of output */
185
#define	CCAR_OFLOW	0x00100000	/* DCD flow control of output */
186
#endif
187
 
188
 
189
/*
190
 * "Local" flags - dumping ground for other state
191
 *
192
 * Warning: some flags in this structure begin with
193
 * the letter "I" and look like they belong in the
194
 * input flag.
195
 */
196
 
197
#if __BSD_VISIBLE
198
#define	ECHOKE		0x00000001	/* visual erase for line kill */
199
#endif
200
#define	ECHOE		0x00000002	/* visually erase chars */
201
#define	ECHOK		0x00000004	/* echo NL after line kill */
202
#define	ECHO		0x00000008	/* enable echoing */
203
#define	ECHONL		0x00000010	/* echo NL even if ECHO is off */
204
#if __BSD_VISIBLE
205
#define	ECHOPRT		0x00000020	/* visual erase mode for hardcopy */
206
#define	ECHOCTL  	0x00000040	/* echo control chars as ^(Char) */
207
#endif
208
#define	ISIG		0x00000080	/* enable signals INTR, QUIT, [D]SUSP */
209
#define	ICANON		0x00000100	/* canonicalize input lines */
210
#if __BSD_VISIBLE
211
#define	ALTWERASE	0x00000200	/* use alternate WERASE algorithm */
212
#endif
213
#define	IEXTEN		0x00000400	/* enable DISCARD and LNEXT */
214
#define	EXTPROC         0x00000800      /* external processing */
215
#define	TOSTOP		0x00400000	/* stop background jobs from output */
216
#if __BSD_VISIBLE
217
#define	FLUSHO		0x00800000	/* output being flushed (state) */
218
#define	NOKERNINFO	0x02000000	/* no kernel output from VSTATUS */
219
#define	PENDIN		0x20000000	/* XXX retype pending input (state) */
220
#endif
221
#define	NOFLSH		0x80000000	/* don't flush after interrupt */
222
 
223
 
224
/*
225
 * Commands passed to tcsetattr() for setting the termios structure.
226
 */
227
#define	TCSANOW		0		/* make change immediate */
228
#define	TCSADRAIN	1		/* drain output, then change */
229
#define	TCSAFLUSH	2		/* drain output, flush input */
230
#if __BSD_VISIBLE
231
#define	TCSASOFT	0x10		/* flag - don't alter h.w. state */
232
#endif
233
 
234
#define	TCIFLUSH	1
235
#define	TCOFLUSH	2
236
#define	TCIOFLUSH	3
237
#define	TCOOFF		1
238
#define	TCOON		2
239
#define	TCIOFF		3
240
#define	TCION		4
241
 
242
 
243
#endif