root/include/termios.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _TERMIOS_H
   2 #define _TERMIOS_H
   3 
   4 #define TTY_BUF_SIZE 1024
   5 
   6 /* 0x54 is just a magic number to make these relatively uniqe ('T') */
   7 
   8 #define TCGETS          0x5401
   9 #define TCSETS          0x5402
  10 #define TCSETSW         0x5403
  11 #define TCSETSF         0x5404
  12 #define TCGETA          0x5405
  13 #define TCSETA          0x5406
  14 #define TCSETAW         0x5407
  15 #define TCSETAF         0x5408
  16 #define TCSBRK          0x5409
  17 #define TCXONC          0x540A
  18 #define TCFLSH          0x540B
  19 #define TIOCEXCL        0x540C
  20 #define TIOCNXCL        0x540D
  21 #define TIOCSCTTY       0x540E
  22 #define TIOCGPGRP       0x540F
  23 #define TIOCSPGRP       0x5410
  24 #define TIOCOUTQ        0x5411
  25 #define TIOCSTI         0x5412
  26 #define TIOCGWINSZ      0x5413
  27 #define TIOCSWINSZ      0x5414
  28 #define TIOCMGET        0x5415
  29 #define TIOCMBIS        0x5416
  30 #define TIOCMBIC        0x5417
  31 #define TIOCMSET        0x5418
  32 #define TIOCGSOFTCAR    0x5419
  33 #define TIOCSSOFTCAR    0x541A
  34 #define TIOCINQ         0x541B
  35 
  36 struct winsize {
  37         unsigned short ws_row;
  38         unsigned short ws_col;
  39         unsigned short ws_xpixel;
  40         unsigned short ws_ypixel;
  41 };
  42 
  43 #define NCC 8
  44 struct termio {
  45         unsigned short c_iflag;         /* input mode flags */
  46         unsigned short c_oflag;         /* output mode flags */
  47         unsigned short c_cflag;         /* control mode flags */
  48         unsigned short c_lflag;         /* local mode flags */
  49         unsigned char c_line;           /* line discipline */
  50         unsigned char c_cc[NCC];        /* control characters */
  51 };
  52 
  53 #define NCCS 17
  54 struct termios {
  55         unsigned long c_iflag;          /* input mode flags */
  56         unsigned long c_oflag;          /* output mode flags */
  57         unsigned long c_cflag;          /* control mode flags */
  58         unsigned long c_lflag;          /* local mode flags */
  59         unsigned char c_line;           /* line discipline */
  60         unsigned char c_cc[NCCS];       /* control characters */
  61 };
  62 
  63 /* c_cc characters */
  64 #define VINTR 0
  65 #define VQUIT 1
  66 #define VERASE 2
  67 #define VKILL 3
  68 #define VEOF 4
  69 #define VTIME 5
  70 #define VMIN 6
  71 #define VSWTC 7
  72 #define VSTART 8
  73 #define VSTOP 9
  74 #define VSUSP 10
  75 #define VEOL 11
  76 #define VREPRINT 12
  77 #define VDISCARD 13
  78 #define VWERASE 14
  79 #define VLNEXT 15
  80 #define VEOL2 16
  81 
  82 /* c_iflag bits */
  83 #define IGNBRK  0000001
  84 #define BRKINT  0000002
  85 #define IGNPAR  0000004
  86 #define PARMRK  0000010
  87 #define INPCK   0000020
  88 #define ISTRIP  0000040
  89 #define INLCR   0000100
  90 #define IGNCR   0000200
  91 #define ICRNL   0000400
  92 #define IUCLC   0001000
  93 #define IXON    0002000
  94 #define IXANY   0004000
  95 #define IXOFF   0010000
  96 #define IMAXBEL 0020000
  97 
  98 /* c_oflag bits */
  99 #define OPOST   0000001
 100 #define OLCUC   0000002
 101 #define ONLCR   0000004
 102 #define OCRNL   0000010
 103 #define ONOCR   0000020
 104 #define ONLRET  0000040
 105 #define OFILL   0000100
 106 #define OFDEL   0000200
 107 #define NLDLY   0000400
 108 #define   NL0   0000000
 109 #define   NL1   0000400
 110 #define CRDLY   0003000
 111 #define   CR0   0000000
 112 #define   CR1   0001000
 113 #define   CR2   0002000
 114 #define   CR3   0003000
 115 #define TABDLY  0014000
 116 #define   TAB0  0000000
 117 #define   TAB1  0004000
 118 #define   TAB2  0010000
 119 #define   TAB3  0014000
 120 #define   XTABS 0014000
 121 #define BSDLY   0020000
 122 #define   BS0   0000000
 123 #define   BS1   0020000
 124 #define VTDLY   0040000
 125 #define   VT0   0000000
 126 #define   VT1   0040000
 127 #define FFDLY   0040000
 128 #define   FF0   0000000
 129 #define   FF1   0040000
 130 
 131 /* c_cflag bit meaning */
 132 #define CBAUD   0000017
 133 #define  B0     0000000         /* hang up */
 134 #define  B50    0000001
 135 #define  B75    0000002
 136 #define  B110   0000003
 137 #define  B134   0000004
 138 #define  B150   0000005
 139 #define  B200   0000006
 140 #define  B300   0000007
 141 #define  B600   0000010
 142 #define  B1200  0000011
 143 #define  B1800  0000012
 144 #define  B2400  0000013
 145 #define  B4800  0000014
 146 #define  B9600  0000015
 147 #define  B19200 0000016
 148 #define  B38400 0000017
 149 #define EXTA B19200
 150 #define EXTB B38400
 151 #define CSIZE   0000060
 152 #define   CS5   0000000
 153 #define   CS6   0000020
 154 #define   CS7   0000040
 155 #define   CS8   0000060
 156 #define CSTOPB  0000100
 157 #define CREAD   0000200
 158 #define CPARENB 0000400
 159 #define CPARODD 0001000
 160 #define HUPCL   0002000
 161 #define CLOCAL  0004000
 162 #define CIBAUD  03600000                /* input baud rate (not used) */
 163 #define CRTSCTS 020000000000            /* flow control */
 164 
 165 #define PARENB CPARENB
 166 #define PARODD CPARODD
 167 
 168 /* c_lflag bits */
 169 #define ISIG    0000001
 170 #define ICANON  0000002
 171 #define XCASE   0000004
 172 #define ECHO    0000010
 173 #define ECHOE   0000020
 174 #define ECHOK   0000040
 175 #define ECHONL  0000100
 176 #define NOFLSH  0000200
 177 #define TOSTOP  0000400
 178 #define ECHOCTL 0001000
 179 #define ECHOPRT 0002000
 180 #define ECHOKE  0004000
 181 #define FLUSHO  0010000
 182 #define PENDIN  0040000
 183 #define IEXTEN  0100000
 184 
 185 /* modem lines */
 186 #define TIOCM_LE        0x001
 187 #define TIOCM_DTR       0x002
 188 #define TIOCM_RTS       0x004
 189 #define TIOCM_ST        0x008
 190 #define TIOCM_SR        0x010
 191 #define TIOCM_CTS       0x020
 192 #define TIOCM_CAR       0x040
 193 #define TIOCM_RNG       0x080
 194 #define TIOCM_DSR       0x100
 195 #define TIOCM_CD        TIOCM_CAR
 196 #define TIOCM_RI        TIOCM_RNG
 197 
 198 /* tcflow() and TCXONC use these */
 199 #define TCOOFF          0
 200 #define TCOON           1
 201 #define TCIOFF          2
 202 #define TCION           3
 203 
 204 /* tcflush() and TCFLSH use these */
 205 #define TCIFLUSH        0
 206 #define TCOFLUSH        1
 207 #define TCIOFLUSH       2
 208 
 209 /* tcsetattr uses these */
 210 #define TCSANOW         0
 211 #define TCSADRAIN       1
 212 #define TCSAFLUSH       2
 213 
 214 typedef int speed_t;
 215 
 216 extern speed_t cfgetispeed(struct termios *termios_p);
 217 extern speed_t cfgetospeed(struct termios *termios_p);
 218 extern int cfsetispeed(struct termios *termios_p, speed_t speed);
 219 extern int cfsetospeed(struct termios *termios_p, speed_t speed);
 220 extern int tcdrain(int fildes);
 221 extern int tcflow(int fildes, int action);
 222 extern int tcflush(int fildes, int queue_selector);
 223 extern int tcgetattr(int fildes, struct termios *termios_p);
 224 extern int tcsendbreak(int fildes, int duration);
 225 extern int tcsetattr(int fildes, int optional_actions,
 226         struct termios *termios_p);
 227 
 228 #endif

/* [previous][next][first][last][top][bottom][index][help] */