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

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