[BACK]Return to termios.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / sys

Annotation of src/sys/sys/termios.h, Revision 1.32

1.32    ! christos    1: /*     $NetBSD: termios.h,v 1.31 2009/12/26 19:31:34 mrg Exp $ */
1.11      cgd         2:
1.1       cgd         3: /*
1.9       cgd         4:  * Copyright (c) 1988, 1989, 1993, 1994
                      5:  *     The Regents of the University of California.  All rights reserved.
1.1       cgd         6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
1.26      agc        15:  * 3. Neither the name of the University nor the names of its contributors
1.1       cgd        16:  *    may be used to endorse or promote products derived from this software
                     17:  *    without specific prior written permission.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     20:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     21:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     22:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     23:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     25:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29:  * SUCH DAMAGE.
                     30:  *
1.10      cgd        31:  *     @(#)termios.h   8.3 (Berkeley) 3/28/94
1.1       cgd        32:  */
                     33:
1.3       mycroft    34: #ifndef _SYS_TERMIOS_H_
                     35: #define _SYS_TERMIOS_H_
                     36:
1.23      kleink     37: #include <sys/ansi.h>
1.18      kleink     38: #include <sys/featuretest.h>
                     39:
1.14      cgd        40: /*
                     41:  * Special Control Characters
1.1       cgd        42:  *
                     43:  * Index into c_cc[] character array.
                     44:  *
1.14      cgd        45:  *     Name         Subscript  Enabled by
1.1       cgd        46:  */
                     47: #define        VEOF            0       /* ICANON */
                     48: #define        VEOL            1       /* ICANON */
1.25      bjh21      49: #if defined(_NETBSD_SOURCE)
1.1       cgd        50: #define        VEOL2           2       /* ICANON */
                     51: #endif
                     52: #define        VERASE          3       /* ICANON */
1.25      bjh21      53: #if defined(_NETBSD_SOURCE)
1.1       cgd        54: #define VWERASE        4       /* ICANON */
1.14      cgd        55: #endif
1.1       cgd        56: #define VKILL          5       /* ICANON */
1.25      bjh21      57: #if defined(_NETBSD_SOURCE)
1.1       cgd        58: #define        VREPRINT        6       /* ICANON */
                     59: #endif
                     60: /*                     7          spare 1 */
                     61: #define VINTR          8       /* ISIG */
                     62: #define VQUIT          9       /* ISIG */
                     63: #define VSUSP          10      /* ISIG */
1.25      bjh21      64: #if defined(_NETBSD_SOURCE)
1.1       cgd        65: #define VDSUSP         11      /* ISIG */
                     66: #endif
                     67: #define VSTART         12      /* IXON, IXOFF */
                     68: #define VSTOP          13      /* IXON, IXOFF */
1.25      bjh21      69: #if defined(_NETBSD_SOURCE)
1.1       cgd        70: #define        VLNEXT          14      /* IEXTEN */
                     71: #define        VDISCARD        15      /* IEXTEN */
                     72: #endif
                     73: #define VMIN           16      /* !ICANON */
                     74: #define VTIME          17      /* !ICANON */
1.25      bjh21      75: #if defined(_NETBSD_SOURCE)
1.1       cgd        76: #define VSTATUS                18      /* ICANON */
                     77: /*                     19         spare 2 */
1.2       sef        78: #endif
1.1       cgd        79: #define        NCCS            20
                     80:
1.30      christos   81: #define _POSIX_VDISABLE        __CAST(unsigned char, '\377')
1.1       cgd        82:
1.25      bjh21      83: #if defined(_NETBSD_SOURCE)
1.1       cgd        84: #define CCEQ(val, c)   (c == val ? val != _POSIX_VDISABLE : 0)
                     85: #endif
                     86:
                     87: /*
                     88:  * Input flags - software input processing
                     89:  */
1.32    ! christos   90: #define        IGNBRK          0x00000001U     /* ignore BREAK condition */
        !            91: #define        BRKINT          0x00000002U     /* map BREAK to SIGINT */
        !            92: #define        IGNPAR          0x00000004U     /* ignore (discard) parity errors */
        !            93: #define        PARMRK          0x00000008U     /* mark parity and framing errors */
        !            94: #define        INPCK           0x00000010U     /* enable checking of parity errors */
        !            95: #define        ISTRIP          0x00000020U     /* strip 8th bit off chars */
        !            96: #define        INLCR           0x00000040U     /* map NL into CR */
        !            97: #define        IGNCR           0x00000080U     /* ignore CR */
        !            98: #define        ICRNL           0x00000100U     /* map CR to NL (ala CRMOD) */
        !            99: #define        IXON            0x00000200U     /* enable output flow control */
        !           100: #define        IXOFF           0x00000400U     /* enable input flow control */
1.25      bjh21     101: #if defined(_NETBSD_SOURCE)
1.32    ! christos  102: #define        IXANY           0x00000800U     /* any char will restart after stop */
1.18      kleink    103: #endif
1.25      bjh21     104: #if defined(_NETBSD_SOURCE)
1.32    ! christos  105: #define IMAXBEL                0x00002000U     /* ring bell on input queue full */
1.18      kleink    106: #endif
1.1       cgd       107:
                    108: /*
                    109:  * Output flags - software output processing
                    110:  */
1.32    ! christos  111: #define        OPOST           0x00000001U     /* enable following output processing */
1.25      bjh21     112: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
1.32    ! christos  113: #define ONLCR          0x00000002U     /* map NL to CR-NL (ala CRMOD) */
1.18      kleink    114: #endif
1.25      bjh21     115: #if defined(_NETBSD_SOURCE)
1.32    ! christos  116: #define OXTABS         0x00000004U     /* expand tabs to spaces */
        !           117: #define ONOEOT         0x00000008U     /* discard EOT's (^D) on output */
1.18      kleink    118: #endif
1.25      bjh21     119: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
1.32    ! christos  120: #define OCRNL          0x00000010U     /* map CR to NL */
        !           121: #define ONOCR          0x00000020U     /* discard CR's when on column 0 */
        !           122: #define ONLRET         0x00000040U     /* move to column 0 on CR */
1.25      bjh21     123: #endif  /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
1.1       cgd       124:
                    125: /*
                    126:  * Control flags - hardware control of terminal
                    127:  */
1.25      bjh21     128: #if defined(_NETBSD_SOURCE)
1.32    ! christos  129: #define        CIGNORE         0x00000001U     /* ignore control flags */
1.1       cgd       130: #endif
1.32    ! christos  131: #define CSIZE          0x00000300U     /* character size mask */
        !           132: #define     CS5                    0x00000000U     /* 5 bits (pseudo) */
        !           133: #define     CS6                    0x00000100U     /* 6 bits */
        !           134: #define     CS7                    0x00000200U     /* 7 bits */
        !           135: #define     CS8                    0x00000300U     /* 8 bits */
        !           136: #define CSTOPB         0x00000400U     /* send 2 stop bits */
        !           137: #define CREAD          0x00000800U     /* enable receiver */
        !           138: #define PARENB         0x00001000U     /* parity enable */
        !           139: #define PARODD         0x00002000U     /* odd parity, else even */
        !           140: #define HUPCL          0x00004000U     /* hang up on last close */
        !           141: #define CLOCAL         0x00008000U     /* ignore modem status lines */
1.25      bjh21     142: #if defined(_NETBSD_SOURCE)
1.32    ! christos  143: #define        CRTSCTS         0x00010000U     /* RTS/CTS full-duplex flow control */
1.7       cgd       144: #define        CRTS_IFLOW      CRTSCTS         /* XXX compat */
                    145: #define        CCTS_OFLOW      CRTSCTS         /* XXX compat */
1.32    ! christos  146: #define        CDTRCTS         0x00020000U     /* DTR/CTS full-duplex flow control */
        !           147: #define        MDMBUF          0x00100000U     /* DTR/DCD hardware flow control */
1.16      scottr    148: #define        CHWFLOW         (MDMBUF|CRTSCTS|CDTRCTS) /* all types of hw flow control */
1.1       cgd       149: #endif
                    150:
                    151:
1.14      cgd       152: /*
1.1       cgd       153:  * "Local" flags - dumping ground for other state
                    154:  *
                    155:  * Warning: some flags in this structure begin with
                    156:  * the letter "I" and look like they belong in the
                    157:  * input flag.
                    158:  */
                    159:
1.25      bjh21     160: #if defined(_NETBSD_SOURCE)
1.32    ! christos  161: #define        ECHOKE          0x00000001U     /* visual erase for line kill */
1.18      kleink    162: #endif
1.32    ! christos  163: #define        ECHOE           0x00000002U     /* visually erase chars */
        !           164: #define        ECHOK           0x00000004U     /* echo NL after line kill */
        !           165: #define ECHO           0x00000008U     /* enable echoing */
        !           166: #define        ECHONL          0x00000010U     /* echo NL even if ECHO is off */
1.25      bjh21     167: #if defined(_NETBSD_SOURCE)
1.32    ! christos  168: #define        ECHOPRT         0x00000020U     /* visual erase mode for hardcopy */
        !           169: #define ECHOCTL        0x00000040U     /* echo control chars as ^(Char) */
1.25      bjh21     170: #endif  /* defined(_NETBSD_SOURCE) */
1.32    ! christos  171: #define        ISIG            0x00000080U     /* enable signals INT, QUIT, [D]SUSP */
        !           172: #define        ICANON          0x00000100U     /* canonicalize input lines */
1.25      bjh21     173: #if defined(_NETBSD_SOURCE)
1.32    ! christos  174: #define ALTWERASE      0x00000200U     /* use alternate WERASE algorithm */
1.25      bjh21     175: #endif /* defined(_NETBSD_SOURCE) */
1.32    ! christos  176: #define        IEXTEN          0x00000400U     /* enable DISCARD and LNEXT */
1.25      bjh21     177: #if defined(_NETBSD_SOURCE)
1.32    ! christos  178: #define EXTPROC         0x00000800U    /* external processing */
1.25      bjh21     179: #endif /* defined(_NETBSD_SOURCE) */
1.32    ! christos  180: #define TOSTOP         0x00400000U     /* stop background jobs on output */
1.25      bjh21     181: #if defined(_NETBSD_SOURCE)
1.32    ! christos  182: #define FLUSHO         0x00800000U     /* output being flushed (state) */
        !           183: #define        NOKERNINFO      0x02000000U     /* no kernel output from VSTATUS */
        !           184: #define PENDIN         0x20000000U     /* re-echo input buffer at next read */
1.25      bjh21     185: #endif /* defined(_NETBSD_SOURCE) */
1.32    ! christos  186: #define        NOFLSH          0x80000000U     /* don't flush output on signal */
1.1       cgd       187:
1.13      cgd       188: typedef unsigned int   tcflag_t;
1.1       cgd       189: typedef unsigned char  cc_t;
1.13      cgd       190: typedef unsigned int   speed_t;
1.1       cgd       191:
                    192: struct termios {
                    193:        tcflag_t        c_iflag;        /* input flags */
                    194:        tcflag_t        c_oflag;        /* output flags */
                    195:        tcflag_t        c_cflag;        /* control flags */
                    196:        tcflag_t        c_lflag;        /* local flags */
                    197:        cc_t            c_cc[NCCS];     /* control chars */
1.13      cgd       198:        int             c_ispeed;       /* input speed */
                    199:        int             c_ospeed;       /* output speed */
1.1       cgd       200: };
                    201:
1.14      cgd       202: /*
1.1       cgd       203:  * Commands passed to tcsetattr() for setting the termios structure.
                    204:  */
                    205: #define        TCSANOW         0               /* make change immediate */
                    206: #define        TCSADRAIN       1               /* drain output, then change */
                    207: #define        TCSAFLUSH       2               /* drain output, flush input */
1.25      bjh21     208: #if defined(_NETBSD_SOURCE)
1.1       cgd       209: #define TCSASOFT       0x10            /* flag - don't alter h.w. state */
                    210: #endif
                    211:
                    212: /*
                    213:  * Standard speeds
                    214:  */
1.32    ! christos  215: #define B0     0U
        !           216: #define B50    50U
        !           217: #define B75    75U
        !           218: #define B110   110U
        !           219: #define B134   134U
        !           220: #define B150   150U
        !           221: #define B200   200U
        !           222: #define B300   300U
        !           223: #define B600   600U
        !           224: #define B1200  1200U
        !           225: #define        B1800   1800U
        !           226: #define B2400  2400U
        !           227: #define B4800  4800U
        !           228: #define B9600  9600U
        !           229: #define B19200 19200U
        !           230: #define B38400 38400U
        !           231: #if defined(_NETBSD_SOURCE)
        !           232: #define B7200  7200U
        !           233: #define B14400 14400U
        !           234: #define B28800 28800U
        !           235: #define B57600 57600U
        !           236: #define B76800 76800U
        !           237: #define B115200        115200U
        !           238: #define B230400        230400U
        !           239: #define B460800        460800U
        !           240: #define B921600        921600U
        !           241: #define EXTA   19200U
        !           242: #define EXTB   38400U
1.25      bjh21     243: #endif  /* defined(_NETBSD_SOURCE) */
1.1       cgd       244:
1.12      jtc       245: #ifndef _KERNEL
1.1       cgd       246:
1.9       cgd       247: #define        TCIFLUSH        1
                    248: #define        TCOFLUSH        2
                    249: #define TCIOFLUSH      3
                    250: #define        TCOOFF          1
                    251: #define        TCOON           2
                    252: #define TCIOFF         3
                    253: #define TCION          4
                    254:
1.25      bjh21     255: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
1.23      kleink    256: #ifndef        pid_t
                    257: typedef        __pid_t         pid_t;
                    258: #define        pid_t           __pid_t
1.19      thorpej   259: #endif
1.25      bjh21     260: #endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
1.1       cgd       261: #include <sys/cdefs.h>
                    262:
                    263: __BEGIN_DECLS
1.27      perry     264: speed_t        cfgetispeed(const struct termios *);
                    265: speed_t        cfgetospeed(const struct termios *);
                    266: int    cfsetispeed(struct termios *, speed_t);
                    267: int    cfsetospeed(struct termios *, speed_t);
                    268: int    tcgetattr(int, struct termios *);
                    269: int    tcsetattr(int, int, const struct termios *);
                    270: int    tcdrain(int);
                    271: int    tcflow(int, int);
                    272: int    tcflush(int, int);
                    273: int    tcsendbreak(int, int);
1.25      bjh21     274: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
1.27      perry     275: pid_t  tcgetsid(int);
1.25      bjh21     276: #endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
1.20      kleink    277:
1.1       cgd       278:
1.25      bjh21     279: #if defined(_NETBSD_SOURCE)
1.27      perry     280: void   cfmakeraw(struct termios *);
                    281: int    cfsetspeed(struct termios *, speed_t);
1.25      bjh21     282: #endif /* defined(_NETBSD_SOURCE) */
1.1       cgd       283: __END_DECLS
1.9       cgd       284:
1.12      jtc       285: #endif /* !_KERNEL */
1.9       cgd       286:
1.25      bjh21     287: #if defined(_NETBSD_SOURCE)
1.9       cgd       288:
                    289: /*
                    290:  * Include tty ioctl's that aren't just for backwards compatibility
                    291:  * with the old tty driver.  These ioctl definitions were previously
                    292:  * in <sys/ioctl.h>.
                    293:  */
                    294: #include <sys/ttycom.h>
                    295: #endif
                    296:
                    297: /*
                    298:  * END OF PROTECTED INCLUDE.
                    299:  */
1.3       mycroft   300: #endif /* !_SYS_TERMIOS_H_ */
1.1       cgd       301:
1.25      bjh21     302: #if defined(_NETBSD_SOURCE)
1.1       cgd       303: #include <sys/ttydefaults.h>
1.9       cgd       304: #endif

CVSweb <webmaster@jp.NetBSD.org>