Back to index

glibc  2.9
termios.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997,1999,2001,2003,2004,2005 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _TERMIOS_H
00020 # error "Never include <bits/termios.h> directly; use <termios.h> instead."
00021 #endif
00022 
00023 typedef unsigned char       cc_t;
00024 typedef unsigned int speed_t;
00025 typedef unsigned int tcflag_t;
00026 
00027 /*
00028  * termios type and macro definitions.  Be careful about adding stuff
00029  * to this file since it's used in GNU libc and there are strict rules
00030  * concerning namespace pollution.
00031  */
00032 
00033 #define NCCS 32
00034 struct termios {
00035        tcflag_t c_iflag;           /* input mode flags */
00036        tcflag_t c_oflag;           /* output mode flags */
00037        tcflag_t c_cflag;           /* control mode flags */
00038        tcflag_t c_lflag;           /* local mode flags */
00039        cc_t c_line;                /* line discipline (== c_cc[19]) */
00040        cc_t c_cc[NCCS];            /* control characters */
00041        speed_t c_ispeed;           /* input speed */
00042        speed_t c_ospeed;           /* output speed */
00043 #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
00044 #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
00045 };
00046 
00047 /* c_cc characters */
00048 #define VINTR 0
00049 #define VQUIT 1
00050 #define VERASE       2
00051 #define VKILL 3
00052 #define VEOF  4
00053 #define VMIN  5
00054 #define VEOL  6
00055 #define VTIME 7
00056 #define VEOL2 8
00057 #define VSWTC 9
00058 
00059 #define VWERASE      10
00060 #define VREPRINT     11
00061 #define VSUSP        12
00062 #define VSTART              13
00063 #define VSTOP        14
00064 #define VLNEXT              15
00065 #define VDISCARD     16
00066 
00067 /* c_iflag bits */
00068 #define IGNBRK       0000001
00069 #define BRKINT       0000002
00070 #define IGNPAR       0000004
00071 #define PARMRK       0000010
00072 #define INPCK 0000020
00073 #define ISTRIP       0000040
00074 #define INLCR 0000100
00075 #define IGNCR 0000200
00076 #define ICRNL 0000400
00077 #define IXON  0001000
00078 #define IXOFF 0002000
00079 #define IXANY 0004000
00080 #define IUCLC 0010000
00081 #define IMAXBEL      0020000
00082 #define IUTF8 0040000
00083 
00084 /* c_oflag bits */
00085 #define OPOST 0000001
00086 #define ONLCR 0000002
00087 #define OLCUC 0000004
00088 
00089 #define OCRNL 0000010
00090 #define ONOCR 0000020
00091 #define ONLRET       0000040
00092 
00093 #define OFILL 00000100
00094 #define OFDEL 00000200
00095 #if defined __USE_MISC || defined __USE_XOPEN
00096 # define NLDLY       00001400
00097 # define   NL0       00000000
00098 # define   NL1       00000400
00099 # define   NL2       00001000
00100 # define   NL3       00001400
00101 # define TABDLY      00006000
00102 # define   TAB0      00000000
00103 # define   TAB1      00002000
00104 # define   TAB2      00004000
00105 # define   TAB3      00006000
00106 # define CRDLY       00030000
00107 # define   CR0       00000000
00108 # define   CR1       00010000
00109 # define   CR2       00020000
00110 # define   CR3       00030000
00111 # define FFDLY       00040000
00112 # define   FF0       00000000
00113 # define   FF1       00040000
00114 # define BSDLY       00100000
00115 # define   BS0       00000000
00116 # define   BS1       00100000
00117 #endif
00118 #define VTDLY 00200000
00119 #define   VT0 00000000
00120 #define   VT1 00200000
00121 
00122 #ifdef __USE_MISC
00123 # define XTABS       00006000
00124 #endif
00125 
00126 /* c_cflag bit meaning */
00127 #ifdef __USE_MISC
00128 # define CBAUD       0000377
00129 #endif
00130 #define  B0   0000000              /* hang up */
00131 #define  B50  0000001
00132 #define  B75  0000002
00133 #define  B110 0000003
00134 #define  B134 0000004
00135 #define  B150 0000005
00136 #define  B200 0000006
00137 #define  B300 0000007
00138 #define  B600 0000010
00139 #define  B1200       0000011
00140 #define  B1800       0000012
00141 #define  B2400       0000013
00142 #define  B4800       0000014
00143 #define  B9600       0000015
00144 #define  B19200      0000016
00145 #define  B38400      0000017
00146 #ifdef __USE_MISC
00147 # define EXTA B19200
00148 # define EXTB B38400
00149 # define CBAUDEX 0000020
00150 #endif
00151 #define  B57600   00020
00152 #define  B115200  00021
00153 #define  B230400  00022
00154 #define  B460800  00023
00155 #define  B500000  00024
00156 #define  B576000  00025
00157 #define  B921600  00026
00158 #define  B1000000 00027
00159 #define  B1152000 00030
00160 #define  B1500000 00031
00161 #define  B2000000 00032
00162 #define  B2500000 00033
00163 #define  B3000000 00034
00164 #define  B3500000 00035
00165 #define  B4000000 00036
00166 #define __MAX_BAUD B4000000
00167 
00168 #define CSIZE 00001400
00169 #define   CS5 00000000
00170 #define   CS6 00000400
00171 #define   CS7 00001000
00172 #define   CS8 00001400
00173 
00174 #define CSTOPB       00002000
00175 #define CREAD 00004000
00176 #define PARENB       00010000
00177 #define PARODD       00020000
00178 #define HUPCL 00040000
00179 
00180 #define CLOCAL       00100000
00181 #ifdef __USE_MISC
00182 # define CMSPAR   010000000000            /* mark or space (stick) parity */
00183 # define CRTSCTS  020000000000            /* flow control */
00184 #endif
00185 
00186 /* c_lflag bits */
00187 #define ISIG  0x00000080
00188 #define ICANON       0x00000100
00189 #if defined __USE_MISC || defined __USE_XOPEN
00190 # define XCASE       0x00004000
00191 #endif
00192 #define ECHO  0x00000008
00193 #define ECHOE 0x00000002
00194 #define ECHOK 0x00000004
00195 #define ECHONL       0x00000010
00196 #define NOFLSH       0x80000000
00197 #define TOSTOP       0x00400000
00198 #ifdef __USE_MISC
00199 # define ECHOCTL     0x00000040
00200 # define ECHOPRT     0x00000020
00201 # define ECHOKE      0x00000001
00202 # define FLUSHO      0x00800000
00203 # define PENDIN      0x20000000
00204 #endif
00205 #define IEXTEN       0x00000400
00206 
00207 /* Values for the ACTION argument to `tcflow'.  */
00208 #define       TCOOFF        0
00209 #define       TCOON         1
00210 #define       TCIOFF        2
00211 #define       TCION         3
00212 
00213 /* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
00214 #define       TCIFLUSH      0
00215 #define       TCOFLUSH      1
00216 #define       TCIOFLUSH     2
00217 
00218 /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
00219 #define       TCSANOW              0
00220 #define       TCSADRAIN     1
00221 #define       TCSAFLUSH     2
00222 
00223 struct sgttyb {
00224        char   sg_ispeed;
00225        char   sg_ospeed;
00226        char   sg_erase;
00227        char   sg_kill;
00228        short  sg_flags;
00229 };
00230 
00231 struct tchars {
00232        char   t_intrc;
00233        char   t_quitc;
00234        char   t_startc;
00235        char   t_stopc;
00236        char   t_eofc;
00237        char   t_brkc;
00238 };
00239 
00240 struct ltchars {
00241        char   t_suspc;
00242        char   t_dsuspc;
00243        char   t_rprntc;
00244        char   t_flushc;
00245        char   t_werasc;
00246        char   t_lnextc;
00247 };
00248 
00249 /* Used for packet mode */
00250 #define TIOCPKT_DATA         0
00251 #define TIOCPKT_FLUSHREAD    1
00252 #define TIOCPKT_FLUSHWRITE   2
00253 #define TIOCPKT_STOP         4
00254 #define TIOCPKT_START               8
00255 #define TIOCPKT_NOSTOP             16
00256 #define TIOCPKT_DOSTOP             32
00257 
00258 struct winsize {
00259        unsigned short ws_row;
00260        unsigned short ws_col;
00261        unsigned short ws_xpixel;
00262        unsigned short ws_ypixel;
00263 };
00264 
00265 #define NCC 10
00266 struct termio {
00267        unsigned short c_iflag;            /* input mode flags */
00268        unsigned short c_oflag;            /* output mode flags */
00269        unsigned short c_cflag;            /* control mode flags */
00270        unsigned short c_lflag;            /* local mode flags */
00271        unsigned char c_line;              /* line discipline */
00272        unsigned char c_cc[NCC];    /* control characters */
00273 };
00274 
00275 /* c_cc characters */
00276 #define _VINTR       0
00277 #define _VQUIT       1
00278 #define _VERASE      2
00279 #define _VKILL       3
00280 #define _VEOF 4
00281 #define _VMIN 5
00282 #define _VEOL 6
00283 #define _VTIME       7
00284 #define _VEOL2       8
00285 #define _VSWTC       9
00286 
00287 /* modem lines */
00288 #define TIOCM_LE     0x001
00289 #define TIOCM_DTR    0x002
00290 #define TIOCM_RTS    0x004
00291 #define TIOCM_ST     0x008
00292 #define TIOCM_SR     0x010
00293 #define TIOCM_CTS    0x020
00294 #define TIOCM_CAR    0x040
00295 #define TIOCM_RNG    0x080
00296 #define TIOCM_DSR    0x100
00297 #define TIOCM_CD     TIOCM_CAR
00298 #define TIOCM_RI     TIOCM_RNG
00299 
00300 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
00301 #define TIOCSER_TEMT    0x01       /* Transmitter physically empty */
00302 
00303 /* line disciplines */
00304 #define N_TTY        0
00305 #define N_SLIP              1
00306 #define N_MOUSE             2
00307 #define N_PPP        3
00308 #define N_STRIP             4
00309 #define N_AX25              5
00310 #define N_X25        6      /* X.25 async  */
00311 #define N_6PACK             7
00312 #define N_MASC              8      /* Mobitex module  */
00313 #define N_R3964             9      /* Simatic R3964 module  */
00314 #define N_PROFIBUS_FDL      10     /* Profibus  */
00315 #define N_IRDA              11     /* Linux IR  */
00316 #define N_SMSBLOCK   12     /* SMS block mode  */
00317 #define N_HDLC              13     /* synchronous HDLC  */
00318 #define N_SYNC_PPP   14     /* synchronous PPP  */
00319 #define       N_HCI         15     /* Bluetooth HCI UART  */