6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / uts / common / sys / termios.h
blob2d99f70bc287e1541be8c5fe4f466da8bcc631e8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
21 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
22 /* All Rights Reserved */
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #ifndef _SYS_TERMIOS_H
31 #define _SYS_TERMIOS_H
33 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <sys/feature_tests.h>
37 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
38 #include <sys/ttydev.h>
39 #include <sys/time.h>
40 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
42 #include <sys/types.h>
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
49 * _POSIX_VDISABLE has been defined in <sys/termios.h> since the
50 * introduction of the header. The POSIX standard, IEEE Std.
51 * 1003.1-1988 also required the existence of _POSIX_VDISABLE in
52 * this header. Subsequent versions of the IEEE Standard as well
53 * as the X/Open specifications required that _POSIX_VDISABLE be
54 * defined in <unistd.h> while still allowing for it's existence
55 * here. With the introduction of XPG6, _POSIX_VDISABLE can only
56 * be defined in <unistd.h>.
58 #if !defined(_XPG6) || defined(__EXTENSIONS__)
59 #ifndef _POSIX_VDISABLE
60 #define _POSIX_VDISABLE 0 /* Disable special character functions */
61 #endif
62 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
64 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
65 #define CTRL(c) ((c)&037)
66 #define IBSHIFT 16
67 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
69 /* required by termio.h and VCEOF/VCEOL */
70 #define _NCC 8
71 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
72 #define NCC _NCC
73 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
75 /* some defines required by POSIX */
76 #define NCCS 19
79 * types defined by POSIX. These are better off in types.h, but
80 * the standard says that they have to be in termios.h.
82 typedef unsigned int tcflag_t;
83 typedef unsigned char cc_t;
84 typedef unsigned int speed_t;
87 * Ioctl control packet
89 struct termios {
90 tcflag_t c_iflag; /* input modes */
91 tcflag_t c_oflag; /* output modes */
92 tcflag_t c_cflag; /* control modes */
93 tcflag_t c_lflag; /* line discipline modes */
94 cc_t c_cc[NCCS]; /* control chars */
98 * POSIX termios functions
99 * These functions get mapped into ioctls.
102 #ifndef _KERNEL
104 #if defined(__STDC__)
106 extern speed_t cfgetospeed(const struct termios *);
107 extern int cfsetospeed(struct termios *, speed_t);
108 extern speed_t cfgetispeed(const struct termios *);
109 extern int cfsetispeed(struct termios *, speed_t);
110 extern int tcgetattr(int, struct termios *);
111 extern int tcsetattr(int, int, const struct termios *);
112 extern int tcsendbreak(int, int);
113 extern int tcdrain(int);
114 extern int tcflush(int, int);
115 extern int tcflow(int, int);
117 #else
119 extern speed_t cfgetospeed();
120 extern int cfsetospeed();
121 extern speed_t cfgetispeed();
122 extern int cfsetispeed();
123 extern int tcgetattr();
124 extern int tcsetattr();
125 extern int tcsendbreak();
126 extern int tcdrain();
127 extern int tcflush();
128 extern int tcflow();
130 #endif /* __STDC__ */
132 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
134 #if defined(__STDC__)
135 extern pid_t tcgetsid(int);
136 #else
137 extern pid_t tcgetsid();
138 #endif /* __STDC__ */
140 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
142 #endif
144 /* control characters */
145 #define VINTR 0
146 #define VQUIT 1
147 #define VERASE 2
148 #define VKILL 3
149 #define VEOF 4
150 #define VEOL 5
151 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
152 #define VEOL2 6
153 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
154 #define VMIN 4
155 #define VTIME 5
156 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
157 #define VSWTCH 7
158 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
159 #define VSTART 8
160 #define VSTOP 9
161 #define VSUSP 10
162 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
163 #define VDSUSP 11
164 #define VREPRINT 12
165 #define VDISCARD 13
166 #define VWERASE 14
167 #define VLNEXT 15
168 /* 16 thru 19 reserved for future use */
171 * control characters form Xenix termio.h
173 #define VCEOF NCC /* RESERVED true EOF char (V7 compatability) */
174 #define VCEOL (NCC + 1) /* RESERVED true EOL char */
176 #define CNUL 0
177 #define CDEL 0177
179 /* S5 default control chars */
180 /* CINTR, CERASE and CKILL modified to SunOS traditional values */
181 #define CESC '\\'
182 #define CINTR CTRL('c')
183 #define CQUIT 034 /* FS, cntl | */
184 #define CERASE 0177 /* DEL */
185 #define CKILL CTRL('u')
186 #define CEOT 04
187 #define CEOL 0
188 #define CEOL2 0
189 #define CEOF 04 /* cntl d */
190 #define CSTART 021 /* cntl q */
191 #define CSTOP 023 /* cntl s */
192 #define CSWTCH 032 /* cntl z */
193 #define CNSWTCH 0
194 #define CSUSP CTRL('z')
195 #define CDSUSP CTRL('y')
196 #define CRPRNT CTRL('r')
197 #define CFLUSH CTRL('o')
198 #define CWERASE CTRL('w')
199 #define CLNEXT CTRL('v')
200 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
203 /* input modes */
204 #define IGNBRK 0000001
205 #define BRKINT 0000002
206 #define IGNPAR 0000004
207 #define PARMRK 0000010
208 #define INPCK 0000020
209 #define ISTRIP 0000040
210 #define INLCR 0000100
211 #define IGNCR 0000200
212 #define ICRNL 0000400
213 #if !defined(_POSIX_C_SOURCE) || \
214 (defined(_XOPEN_SOURCE) && !defined(_XPG6)) || \
215 defined(__EXTENSIONS__)
216 #define IUCLC 0001000
217 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
218 #define IXON 0002000
219 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
220 defined(__EXTENSIONS__)
221 #define IXANY 0004000
222 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
223 #define IXOFF 0010000
224 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
225 #define IMAXBEL 0020000
226 #define DOSMODE 0100000 /* for 386 compatibility */
227 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
229 /* output modes */
230 #define OPOST 0000001
231 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
232 defined(__EXTENSIONS__)
233 #if !defined(_XPG6) || defined(__EXTENSIONS__)
234 #define OLCUC 0000002
235 #endif
236 #define ONLCR 0000004
237 #define OCRNL 0000010
238 #define ONOCR 0000020
239 #define ONLRET 0000040
240 #define OFILL 0000100
241 #define OFDEL 0000200
242 #define NLDLY 0000400
243 #define NL0 0
244 #define NL1 0000400
245 #define CRDLY 0003000
246 #define CR0 0
247 #define CR1 0001000
248 #define CR2 0002000
249 #define CR3 0003000
250 #define TABDLY 0014000
251 #define TAB0 0
252 #define TAB1 0004000
253 #define TAB2 0010000
254 #define TAB3 0014000
255 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
256 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
257 #define XTABS 0014000
258 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
259 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
260 defined(__EXTENSIONS__)
261 #define BSDLY 0020000
262 #define BS0 0
263 #define BS1 0020000
264 #define VTDLY 0040000
265 #define VT0 0
266 #define VT1 0040000
267 #define FFDLY 0100000
268 #define FF0 0
269 #define FF1 0100000
270 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
271 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
272 #define PAGEOUT 0200000
273 #define WRAP 0400000
275 /* control modes */
276 #define CBAUD 0000017
277 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
278 #define CSIZE 0000060
279 #define CS5 0
280 #define CS6 0000020
281 #define CS7 0000040
282 #define CS8 0000060
283 #define CSTOPB 0000100
284 #define CREAD 0000200
285 #define PARENB 0000400
286 #define PARODD 0001000
287 #define HUPCL 0002000
288 #define CLOCAL 0004000
289 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
290 #define RCV1EN 0010000
291 #define XMT1EN 0020000
292 #define LOBLK 0040000
293 #define XCLUDE 0100000 /* *V7* exclusive use coming fron XENIX */
294 #define CRTSXOFF 010000000000
295 #define CRTSCTS 020000000000
296 #define CIBAUD 03600000
297 #define PAREXT 04000000
298 #define CBAUDEXT 010000000
299 #define CIBAUDEXT 020000000
302 * 4.4BSD hardware flow control flags
304 #define CRTS_IFLOW 010000000000
305 #define CCTS_OFLOW 020000000000
307 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
309 /* line discipline 0 modes */
310 #define ISIG 0000001
311 #define ICANON 0000002
312 #if !defined(_POSIX_C_SOURCE) || \
313 (defined(_XOPEN_SOURCE) && !defined(_XPG6)) || \
314 defined(__EXTENSIONS__)
315 #define XCASE 0000004
316 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
317 #define ECHO 0000010
318 #define ECHOE 0000020
319 #define ECHOK 0000040
320 #define ECHONL 0000100
321 #define NOFLSH 0000200
322 #define TOSTOP 0000400
323 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
324 #define ECHOCTL 0001000
325 #define ECHOPRT 0002000
326 #define ECHOKE 0004000
327 #define DEFECHO 0010000
328 #define FLUSHO 0020000
329 #define PENDIN 0040000
330 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
332 #define IEXTEN 0100000 /* POSIX flag - enable POSIX extensions */
333 #define _TIOC ('T'<<8)
335 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
337 #define TIOC _TIOC
339 #define TCGETA (_TIOC|1)
340 #define TCSETA (_TIOC|2)
341 #define TCSETAW (_TIOC|3)
342 #define TCSETAF (_TIOC|4)
343 #define TCSBRK (_TIOC|5)
344 #define TCXONC (_TIOC|6)
345 #define TCFLSH (_TIOC|7)
347 /* Slots reserved for 386/XENIX compatibility - keyboard control */
349 #define TIOCKBON (_TIOC|8)
350 #define TIOCKBOF (_TIOC|9)
351 #define KBENABLED (_TIOC|10)
353 #ifndef IOCTYPE
354 #define IOCTYPE 0xff00
355 #endif
357 #define TCDSET (_TIOC|32)
358 #define RTS_TOG (_TIOC|33) /* 386 - "RTS" toggle define 8A1 protocol */
360 #define TIOCGWINSZ (_TIOC|104)
361 #define TIOCSWINSZ (_TIOC|103)
364 * Softcarrier ioctls
366 #define TIOCGSOFTCAR (_TIOC|105)
367 #define TIOCSSOFTCAR (_TIOC|106)
370 /* termios ioctls */
372 #define TCGETS (_TIOC|13)
373 #define TCSETS (_TIOC|14)
374 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
375 #define TCSANOW (_TIOC|14) /* same as TCSETS */
376 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
377 #define TCSETSW (_TIOC|15)
378 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
379 #define TCSADRAIN (_TIOC|15) /* same as TCSETSW */
380 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
381 #define TCSETSF (_TIOC|16)
384 * linux terminal ioctls we need to be aware of
386 #define TIOCSETLD (_TIOC|123) /* set line discipline parms */
387 #define TIOCGETLD (_TIOC|124) /* get line discipline parms */
390 * The VMIN and VTIME and solaris overlap with VEOF and VEOL - This is
391 * perfectly legal except, linux expects them to be separate. So we keep
392 * them separately.
394 struct lx_cc {
395 unsigned char veof; /* veof value */
396 unsigned char veol; /* veol value */
397 unsigned char vmin; /* vmin value */
398 unsigned char vtime; /* vtime value */
402 * NTP PPS ioctls
404 #define TIOCGPPS (_TIOC|125)
405 #define TIOCSPPS (_TIOC|126)
406 #define TIOCGPPSEV (_TIOC|127)
408 /* Argument filled in by TIOCGPPSEV */
409 struct ppsclockev {
410 struct timeval tv;
411 uint_t serial;
414 #if defined(_SYSCALL32)
415 struct ppsclockev32 {
416 struct timeval32 tv;
417 uint32_t serial;
419 #endif /* _SYSCALL32 */
421 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
423 #define TCSAFLUSH (_TIOC|16) /* same as TCSETSF */
425 /* termios option flags */
427 #define TCIFLUSH 0 /* flush data received but not read */
428 #define TCOFLUSH 1 /* flush data written but not transmitted */
429 #define TCIOFLUSH 2 /* flush both data both input and output queues */
431 #define TCOOFF 0 /* suspend output */
432 #define TCOON 1 /* restart suspended output */
433 #define TCIOFF 2 /* suspend input */
434 #define TCION 3 /* restart suspended input */
436 /* TIOC ioctls for BSD, ptys, job control and modem control */
438 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
439 #define tIOC ('t'<<8)
440 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
442 /* Slots for 386/XENIX compatibility */
443 /* BSD includes these ioctls in ttold.h */
445 #ifndef _SYS_TTOLD_H
447 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
448 #define TIOCGETD (tIOC|0)
449 #define TIOCSETD (tIOC|1)
450 #define TIOCHPCL (tIOC|2)
451 #define TIOCGETP (tIOC|8)
452 #define TIOCSETP (tIOC|9)
453 #define TIOCSETN (tIOC|10)
454 #define TIOCEXCL (tIOC|13)
455 #define TIOCNXCL (tIOC|14)
456 #define TIOCFLUSH (tIOC|16)
457 #define TIOCSETC (tIOC|17)
458 #define TIOCGETC (tIOC|18)
460 * BSD ioctls that are not the same as XENIX are included here.
461 * There are also some relevant ioctls from SUN/BSD sys/ttycom.h
462 * BSD pty ioctls like TIOCPKT are not supported in SVR4.
465 #define TIOCLBIS (tIOC|127) /* bis local mode bits */
466 #define TIOCLBIC (tIOC|126) /* bic local mode bits */
467 #define TIOCLSET (tIOC|125) /* set entire local mode word */
468 #define TIOCLGET (tIOC|124) /* get local modes */
469 #define TIOCSBRK (tIOC|123) /* set break bit */
470 #define TIOCCBRK (tIOC|122) /* clear break bit */
471 #define TIOCSDTR (tIOC|121) /* set data terminal ready */
472 #define TIOCCDTR (tIOC|120) /* clear data terminal ready */
473 #define TIOCSLTC (tIOC|117) /* set local special chars */
474 #define TIOCGLTC (tIOC|116) /* get local special chars */
475 #define TIOCOUTQ (tIOC|115) /* driver output queue size */
476 #define TIOCNOTTY (tIOC|113) /* void tty association */
477 #define TIOCSCTTY (tIOC|132) /* get a ctty */
478 #define TIOCSTOP (tIOC|111) /* stop output, like ^S */
479 #define TIOCSTART (tIOC|110) /* start output, like ^Q */
480 #define TIOCSILOOP (tIOC|109) /* private to Sun; do not use */
482 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
484 #endif /* end _SYS_TTOLD_H */
486 /* POSIX job control ioctls */
488 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
489 #define TIOCGPGRP (tIOC|20) /* get pgrp of tty */
490 #define TIOCSPGRP (tIOC|21) /* set pgrp of tty */
491 #define TIOCGSID (tIOC|22) /* get session id on ctty */
493 /* Miscellaneous */
494 #define TIOCSTI (tIOC|23) /* simulate terminal input */
496 /* Modem control */
497 #define TIOCMSET (tIOC|26) /* set all modem bits */
498 #define TIOCMBIS (tIOC|27) /* bis modem bits */
499 #define TIOCMBIC (tIOC|28) /* bic modem bits */
500 #define TIOCMGET (tIOC|29) /* get all modem bits */
501 #define TIOCM_LE 0001 /* line enable */
502 #define TIOCM_DTR 0002 /* data terminal ready */
503 #define TIOCM_RTS 0004 /* request to send */
504 #define TIOCM_ST 0010 /* secondary transmit */
505 #define TIOCM_SR 0020 /* secondary receive */
506 #define TIOCM_CTS 0040 /* clear to send */
507 #define TIOCM_CAR 0100 /* carrier detect */
508 #define TIOCM_CD TIOCM_CAR
509 #define TIOCM_RNG 0200 /* ring */
510 #define TIOCM_RI TIOCM_RNG
511 #define TIOCM_DSR 0400 /* data set ready */
513 /* pseudo-tty */
515 #define TIOCREMOTE (tIOC|30) /* remote input editing */
516 #define TIOCSIGNAL (tIOC|31) /* pty: send signal to slave */
519 /* Some more 386 xenix stuff */
521 #define LDIOC ('D'<<8)
523 #define LDOPEN (LDIOC|0)
524 #define LDCLOSE (LDIOC|1)
525 #define LDCHG (LDIOC|2)
526 #define LDGETT (LDIOC|8)
527 #define LDSETT (LDIOC|9)
529 /* Slots for 386 compatibility */
531 #define LDSMAP (LDIOC|110)
532 #define LDGMAP (LDIOC|111)
533 #define LDNMAP (LDIOC|112)
534 #define LDEMAP (LDIOC|113)
535 #define LDDMAP (LDIOC|114)
538 * These are retained for 386/XENIX compatibility.
541 #define DIOC ('d'<<8)
542 #define DIOCGETP (DIOC|8) /* V7 */
543 #define DIOCSETP (DIOC|9) /* V7 */
546 * Returns a non-zero value if there
547 * are characters in the input queue.
549 * XXX - somebody is confused here. V7 had no such "ioctl", although XENIX may
550 * have added it; 4BSD had FIONREAD, which returned the number of characters
551 * waiting, and was supposed to work on all descriptors (i.e., every driver
552 * should make a stab at implementing it).
554 #define FIORDCHK (('f'<<8)|3) /* V7 */
555 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
558 * Speeds
560 #define B0 0
561 #define B50 1
562 #define B75 2
563 #define B110 3
564 #define B134 4
565 #define B150 5
566 #define B200 6
567 #define B300 7
568 #define B600 8
569 #define B1200 9
570 #define B1800 10
571 #define B2400 11
572 #define B4800 12
573 #define B9600 13
574 #define B19200 14
575 #define B38400 15
576 #define B57600 16
577 #define B76800 17
578 #define B115200 18
579 #define B153600 19
580 #define B230400 20
581 #define B307200 21
582 #define B460800 22
584 #ifndef _SYS_TTOLD_H
586 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
587 /* Windowing structure to support JWINSIZE/TIOCSWINSZ/TIOCGWINSZ */
588 struct winsize {
589 unsigned short ws_row; /* rows, in characters */
590 unsigned short ws_col; /* columns, in character */
591 unsigned short ws_xpixel; /* horizontal size, pixels */
592 unsigned short ws_ypixel; /* vertical size, pixels */
594 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
596 #endif /* end _SYS_TTOLD_H */
598 #ifdef __cplusplus
600 #endif
602 #endif /* _SYS_TERMIOS_H */