1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief POSIX Termios Implementation for RTEMS Console Device Driver |
---|
5 | * |
---|
6 | * The Open Group Base Specifications Issue 6 |
---|
7 | * IEEE Std 1003.1, 2004 Edition |
---|
8 | * Chapter 11, General Terminal Interface |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * COPYRIGHT (c) 1989-2011. |
---|
13 | * On-Line Applications Research Corporation (OAR). |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.com/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef TERMIOS_H |
---|
21 | #define TERMIOS_H |
---|
22 | |
---|
23 | #include <sys/types.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | /** |
---|
30 | * @ingroup Termios |
---|
31 | * |
---|
32 | * @brief POSIX Termios Implementation |
---|
33 | * |
---|
34 | */ |
---|
35 | /**@{**/ |
---|
36 | |
---|
37 | typedef unsigned char cc_t; |
---|
38 | typedef unsigned int speed_t; |
---|
39 | typedef unsigned int tcflag_t; |
---|
40 | |
---|
41 | #define NCCS 19 |
---|
42 | struct termios { |
---|
43 | tcflag_t c_iflag; /* input mode flags */ |
---|
44 | tcflag_t c_oflag; /* output mode flags */ |
---|
45 | tcflag_t c_cflag; /* control mode flags */ |
---|
46 | tcflag_t c_lflag; /* local mode flags */ |
---|
47 | cc_t c_line; /* line discipline */ |
---|
48 | cc_t c_cc[NCCS]; /* control characters */ |
---|
49 | }; |
---|
50 | |
---|
51 | /** |
---|
52 | * This value is used to disable processing of a member of c_cc |
---|
53 | * in the struct termios. |
---|
54 | */ |
---|
55 | #define _POSIX_VDISABLE 0 |
---|
56 | |
---|
57 | /* c_cc characters */ |
---|
58 | #define VINTR 0 |
---|
59 | #define VQUIT 1 |
---|
60 | #define VERASE 2 |
---|
61 | #define VKILL 3 |
---|
62 | #define VEOF 4 |
---|
63 | #define VTIME 5 |
---|
64 | #define VMIN 6 |
---|
65 | #define VSWTC 7 |
---|
66 | #define VSTART 8 |
---|
67 | #define VSTOP 9 |
---|
68 | #define VSUSP 10 |
---|
69 | #define VEOL 11 |
---|
70 | #define VREPRINT 12 |
---|
71 | #define VDISCARD 13 |
---|
72 | #define VWERASE 14 |
---|
73 | #define VLNEXT 15 |
---|
74 | #define VEOL2 16 |
---|
75 | |
---|
76 | /* c_iflag bits */ |
---|
77 | #define IGNBRK 0000001 |
---|
78 | #define BRKINT 0000002 |
---|
79 | #define IGNPAR 0000004 |
---|
80 | #define PARMRK 0000010 |
---|
81 | #define INPCK 0000020 |
---|
82 | #define ISTRIP 0000040 |
---|
83 | #define INLCR 0000100 |
---|
84 | #define IGNCR 0000200 |
---|
85 | #define ICRNL 0000400 |
---|
86 | #define IUCLC 0001000 |
---|
87 | #define IXON 0002000 |
---|
88 | #define IXANY 0004000 |
---|
89 | #define IXOFF 0010000 |
---|
90 | #define IMAXBEL 0020000 |
---|
91 | |
---|
92 | /* c_oflag bits */ |
---|
93 | #define OPOST 0000001 |
---|
94 | #define OLCUC 0000002 |
---|
95 | #define ONLCR 0000004 |
---|
96 | #define OCRNL 0000010 |
---|
97 | #define ONOCR 0000020 |
---|
98 | #define ONLRET 0000040 |
---|
99 | #define OFILL 0000100 |
---|
100 | #define OFDEL 0000200 |
---|
101 | #define NLDLY 0000400 |
---|
102 | #define NL0 0000000 |
---|
103 | #define NL1 0000400 |
---|
104 | #define CRDLY 0003000 |
---|
105 | #define CR0 0000000 |
---|
106 | #define CR1 0001000 |
---|
107 | #define CR2 0002000 |
---|
108 | #define CR3 0003000 |
---|
109 | #define TABDLY 0014000 |
---|
110 | #define TAB0 0000000 |
---|
111 | #define TAB1 0004000 |
---|
112 | #define TAB2 0010000 |
---|
113 | #define TAB3 0014000 |
---|
114 | #define XTABS 0014000 |
---|
115 | #define BSDLY 0020000 |
---|
116 | #define BS0 0000000 |
---|
117 | #define BS1 0020000 |
---|
118 | #define VTDLY 0040000 |
---|
119 | #define VT0 0000000 |
---|
120 | #define VT1 0040000 |
---|
121 | #define FFDLY 0100000 |
---|
122 | #define FF0 0000000 |
---|
123 | #define FF1 0100000 |
---|
124 | |
---|
125 | /* c_cflag bit meaning */ |
---|
126 | #define CBAUD 0010017 |
---|
127 | #define B0 0000000 /* hang up */ |
---|
128 | #define B50 0000001 |
---|
129 | #define B75 0000002 |
---|
130 | #define B110 0000003 |
---|
131 | #define B134 0000004 |
---|
132 | #define B150 0000005 |
---|
133 | #define B200 0000006 |
---|
134 | #define B300 0000007 |
---|
135 | #define B600 0000010 |
---|
136 | #define B1200 0000011 |
---|
137 | #define B1800 0000012 |
---|
138 | #define B2400 0000013 |
---|
139 | #define B4800 0000014 |
---|
140 | #define B9600 0000015 |
---|
141 | #define B19200 0000016 |
---|
142 | #define B38400 0000017 |
---|
143 | #define EXTA B19200 |
---|
144 | #define EXTB B38400 |
---|
145 | #define CSIZE 0000060 |
---|
146 | #define CS5 0000000 |
---|
147 | #define CS6 0000020 |
---|
148 | #define CS7 0000040 |
---|
149 | #define CS8 0000060 |
---|
150 | #define CSTOPB 0000100 |
---|
151 | #define CREAD 0000200 |
---|
152 | #define PARENB 0000400 |
---|
153 | #define PARODD 0001000 |
---|
154 | #define HUPCL 0002000 |
---|
155 | #define CLOCAL 0004000 |
---|
156 | #define CBAUDEX 0010000 |
---|
157 | #define B57600 0010001 |
---|
158 | #define B115200 0010002 |
---|
159 | #define B230400 0010003 |
---|
160 | #define B460800 0010004 |
---|
161 | #define CIBAUD 002003600000 /* input baud rate (not used) */ |
---|
162 | #define CRTSCTS 020000000000 /* flow control */ |
---|
163 | |
---|
164 | #define RTEMS_TERMIOS_NUMBER_BAUD_RATES 20 |
---|
165 | |
---|
166 | /* c_lflag bits */ |
---|
167 | #define ISIG 0000001 |
---|
168 | #define ICANON 0000002 |
---|
169 | #define XCASE 0000004 |
---|
170 | #define ECHO 0000010 |
---|
171 | #define ECHOE 0000020 |
---|
172 | #define ECHOK 0000040 |
---|
173 | #define ECHONL 0000100 |
---|
174 | #define NOFLSH 0000200 |
---|
175 | #define TOSTOP 0000400 |
---|
176 | #define ECHOCTL 0001000 |
---|
177 | #define ECHOPRT 0002000 |
---|
178 | #define ECHOKE 0004000 |
---|
179 | #define FLUSHO 0010000 |
---|
180 | #define PENDIN 0040000 |
---|
181 | #define IEXTEN 0100000 |
---|
182 | |
---|
183 | /* tcflow() and TCXONC use these */ |
---|
184 | #define TCOOFF 0 |
---|
185 | #define TCOON 1 |
---|
186 | #define TCIOFF 2 |
---|
187 | #define TCION 3 |
---|
188 | |
---|
189 | /* tcflush() and TCFLSH use these */ |
---|
190 | #define TCIFLUSH 0 |
---|
191 | #define TCOFLUSH 1 |
---|
192 | #define TCIOFLUSH 2 |
---|
193 | |
---|
194 | /* tcsetattr uses these */ |
---|
195 | #define TCSANOW 0 |
---|
196 | #define TCSADRAIN 1 |
---|
197 | #define TCSAFLUSH 2 |
---|
198 | |
---|
199 | int tcdrain(int); |
---|
200 | int tcflow(int, int); |
---|
201 | int tcflush(int, int); |
---|
202 | int tcgetattr(int, struct termios *); |
---|
203 | int tcsetattr(int, int, struct termios *); |
---|
204 | int tcdrain(int); |
---|
205 | pid_t tcgetprgrp(int); |
---|
206 | int tcsetprgrp(int, pid_t); |
---|
207 | int tcsendbreak(int, int); |
---|
208 | speed_t cfgetospeed(const struct termios *tp); |
---|
209 | int cfsetospeed(struct termios *tp, speed_t speed); |
---|
210 | speed_t cfgetispeed(const struct termios *tp); |
---|
211 | int cfsetispeed(struct termios *tp, speed_t speed); |
---|
212 | void cfmakeraw(struct termios *tp); |
---|
213 | int cfsetspeed(struct termios *tp, speed_t speed); |
---|
214 | |
---|
215 | /** @} */ |
---|
216 | |
---|
217 | #ifdef __cplusplus |
---|
218 | } |
---|
219 | #endif |
---|
220 | |
---|
221 | #endif /* TERMIOS_H */ |
---|