Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 1 | /* Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 | * Use of this source code is governed by a BSD-style license that can be |
| 3 | * found in the LICENSE file. */ |
| 4 | |
| 5 | #ifndef SYS_TERMIOS_H_ |
| 6 | #define SYS_TERMIOS_H_ |
| 7 | |
| 8 | #define IGNBRK 0000001 |
| 9 | #define BRKINT 0000002 |
| 10 | #define IGNPAR 0000004 |
| 11 | #define PARMRK 0000010 |
| 12 | #define INPCK 0000020 |
| 13 | #define ISTRIP 0000040 |
| 14 | #define INLCR 0000100 |
| 15 | #define IGNCR 0000200 |
| 16 | #define ICRNL 0000400 |
| 17 | #define IUCLC 0001000 |
| 18 | #define IXON 0002000 |
| 19 | #define IXANY 0004000 |
| 20 | #define IXOFF 0010000 |
| 21 | #define IMAXBEL 0020000 |
| 22 | #define IUTF8 0040000 |
| 23 | |
| 24 | #define OPOST 000001 |
| 25 | #define OCRNL 000004 |
| 26 | #define ONLCR 000010 |
| 27 | #define ONOCR 000020 |
| 28 | #define ONLRET 000040 |
| 29 | #define TAB3 014000 |
| 30 | |
| 31 | #define CLOCAL 004000 |
| 32 | #define CREAD 000200 |
| 33 | #define PARODD 001000 |
| 34 | #define CSIZE 000060 |
| 35 | #define CS5 0 |
| 36 | #define CS6 020 |
| 37 | #define CS7 040 |
| 38 | #define CS8 060 |
| 39 | #define CSTOPB 000100 |
| 40 | #define HUPCL 002000 |
| 41 | #define PARENB 000400 |
| 42 | #define PAODD 001000 |
| 43 | |
| 44 | #define ECHO 0000010 |
| 45 | #define ECHOE 0000020 |
| 46 | #define ECHOK 0000040 |
| 47 | #define ECHONL 0000100 |
| 48 | #define ICANON 0000002 |
| 49 | #define IEXTEN 0100000 |
| 50 | #define ISIG 0000001 |
| 51 | #define NOFLSH 0000200 |
| 52 | #define TOSTOP 0000400 |
| 53 | #define ECHOCTL 0001000 |
| 54 | #define ECHOPRT 0002000 |
| 55 | #define ECHOKE 0004000 |
| 56 | #define FLUSHO 0010000 |
| 57 | #define PENDIN 0040000 |
| 58 | |
| 59 | #define VINTR 0 |
| 60 | #define VQUIT 1 |
| 61 | #define VERASE 2 |
| 62 | #define VKILL 3 |
| 63 | #define VEOF 4 |
| 64 | #define VTIME 5 |
| 65 | #define VMIN 6 |
| 66 | #define VSWTC 7 |
| 67 | #define VSTART 8 |
| 68 | #define VSTOP 9 |
| 69 | #define VSUSP 10 |
| 70 | #define VEOL 11 |
| 71 | #define VREPRINT 12 |
| 72 | #define VDISCARD 13 |
| 73 | #define VWERASE 14 |
| 74 | #define VLNEXT 15 |
| 75 | #define VEOL2 16 |
| 76 | |
| 77 | #define B0 000000 |
| 78 | #define B50 000001 |
| 79 | #define B75 000002 |
| 80 | #define B110 000003 |
| 81 | #define B134 000004 |
| 82 | #define B150 000005 |
| 83 | #define B200 000006 |
| 84 | #define B300 000007 |
| 85 | #define B600 000010 |
| 86 | #define B1200 000011 |
| 87 | #define B1800 000012 |
| 88 | #define B2400 000013 |
| 89 | #define B4800 000014 |
| 90 | #define B9600 000015 |
| 91 | #define B19200 000016 |
| 92 | #define B38400 000017 |
| 93 | |
| 94 | #define TCIFLUSH 0 |
| 95 | #define TCOFLUSH 1 |
| 96 | #define TCIOFLUSH 2 |
| 97 | |
| 98 | #define TCSANOW 0 |
| 99 | #define TCSADRAIN 1 |
| 100 | #define TCSAFLUSH 2 |
| 101 | |
| 102 | typedef unsigned char cc_t; |
| 103 | typedef unsigned short tcflag_t; |
| 104 | typedef char speed_t; |
| 105 | |
| 106 | #define NCCS 32 |
| 107 | struct termios { |
| 108 | tcflag_t c_iflag; |
| 109 | tcflag_t c_oflag; |
| 110 | tcflag_t c_cflag; |
| 111 | tcflag_t c_lflag; |
| 112 | char c_line; |
| 113 | cc_t c_cc[NCCS]; |
| 114 | speed_t c_ispeed; |
| 115 | speed_t c_ospeed; |
| 116 | }; |
| 117 | |
| 118 | |
| 119 | #include <sys/cdefs.h> |
| 120 | |
| 121 | __BEGIN_DECLS |
| 122 | |
| 123 | int tcflush(int fd, int queue_selector); |
| 124 | int tcgetattr(int fd, struct termios *termios_p); |
| 125 | int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); |
| 126 | |
| 127 | __END_DECLS |
| 128 | |
| 129 | #endif /* SYS_TERMIOS_H_ */ |