VSF Documented
termios.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_TERMIOS_H__
2#define __VSF_LINUX_TERMIOS_H__
3
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#if VSF_LINUX_CFG_WRAPPER == ENABLED
11#define tcgetattr VSF_LINUX_WRAPPER(tcgetattr)
12#define tcsetattr VSF_LINUX_WRAPPER(tcsetattr)
13#define tcsendbreak VSF_LINUX_WRAPPER(tcsendbreak)
14#define tcdrain VSF_LINUX_WRAPPER(tcdrain)
15#define tcflush VSF_LINUX_WRAPPER(tcflush)
16#define tcflow VSF_LINUX_WRAPPER(tcflow)
17#define cfmakeraw VSF_LINUX_WRAPPER(cfmakeraw)
18#define cfgetispeed VSF_LINUX_WRAPPER(cfgetispeed)
19#define cfgetospeed VSF_LINUX_WRAPPER(cfgetospeed)
20#define cfsetispeed VSF_LINUX_WRAPPER(cfsetispeed)
21#define cfsetospeed VSF_LINUX_WRAPPER(cfsetospeed)
22#define cfsetspeed VSF_LINUX_WRAPPER(cfsetspeed)
23#endif
24
25// for ioctrl
26#define TCGETS (('t' << 8) | 0)
27#define TCSETS (('t' << 8) | 1)
28
29typedef unsigned int tcflag_t;
30typedef unsigned char cc_t;
31typedef unsigned int speed_t;
32
33// tcsetattr optional_actions
34#define TCSANOW 0
35#define TCSADRAIN 1
36#define TCSAFLUSH 2
37
38#define IGNBRK 0000001
39#define BRKINT 0000002
40#define IGNPAR 0000004
41#define PARMRK 0000010
42#define INPCK 0000020
43#define ISTRIP 0000040
44#define INLCR 0000100
45#define IGNCR 0000200
46#define ICRNL 0000400
47#define IUCLC 0001000
48#define IXON 0002000
49#define IXANY 0004000
50#define IXOFF 0010000
51#define IMAXBEL 0020000
52#define IUTF8 0040000
53
54#define OPOST 0000001
55#define OLCUC 0000002
56#define ONLCR 0000004
57#define OCRNL 0000010
58#define ONOCR 0000020
59#define ONLRET 0000040
60#define OFILL 0000100
61#define OFDEL 0000200
62#define XTABS 0014000
63
64#define ISIG 0000001
65#define ICANON 0000002
66#define ECHO 0000010
67#define ECHOE 0000020
68#define ECHOK 0000040
69#define ECHONL 0000100
70#define NOFLSH 0000200
71#define TOSTOP 0000400
72#define ECHOCTL 0001000
73#define ECHOPRT 0002000
74#define ECHOKE 0004000
75#define FLUSHO 0010000
76#define PENDIN 0040000
77#define IEXTEN 0100000
78
79/* tcflow() and TCXONC use these */
80#define TCOOFF 0
81#define TCOON 1
82#define TCIOFF 2
83#define TCION 3
84
85/* tcflush() and TCFLSH use these */
86#define TCIFLUSH 0
87#define TCOFLUSH 1
88#define TCIOFLUSH 2
89
90/* tcsetattr uses these */
91#define TCSANOW 0
92#define TCSADRAIN 1
93#define TCSAFLUSH 2
94
95#define NCCS 32
96#define VINTR 0
97#define VQUIT 1
98#define VERASE 2
99#define VKILL 3
100#define VEOF 4
101#define VTIME 5
102#define VMIN 6
103#define VSWTC 7
104#define VSTART 8
105#define VSTOP 9
106#define VSUSP 10
107#define VEOL 11
108#define VREPRINT 12
109#define VDISCARD 13
110#define VWERASE 14
111#define VLNEXT 15
112#define VEOL2 16
113
114// baudrate
115#define CBAUD 0x100F
116// use enum to avoid conflict
117enum {
118 B0 = 0,
119 B50 = 1,
120#define B50 B50
121 B75 = 2,
122#define B75 B75
123 B110 = 3,
124#define B110 B110
125 B134 = 4,
126#define B134 B134
127 B150 = 5,
128#define B150 B150
129 B200 = 6,
130#define B200 B200
131 B300 = 7,
132#define B300 B300
133 B600 = 8,
134#define B600 B600
135 B1200 = 9,
136#define B1200 B1200
137 B1800 = 10,
138#define B1800 B1800
139 B2400 = 11,
140#define B2400 B2400
141 B4800 = 12,
142#define B4800 B4800
143 B9600 = 13,
144#define B9600 B9600
145 B19200 = 14,
146#define B19200 B19200
147 B38400 = 15,
148#define B38400 B38400
149 B57600 = 16,
150#define B57600 B57600
152#define B115200 B115200
154#define B230400 B230400
156#define B460800 B460800
158#define B500000 B500000
160#define B576000 B576000
162#define B921600 B921600
164#define B1000000 B1000000
166#define B1152000 B1152000
168#define B1500000 B1500000
170#define B2000000 B2000000
172#define B2500000 B2500000
174#define B3000000 B3000000
176#define B3500000 B3500000
178#define B4000000 B4000000
179};
180
181#define CSIZE 0x0060
182#define CS5 0x0000
183#define CS6 0x0020
184#define CS7 0x0040
185#define CS8 0x0060
186
187#define CSTOPB 0x0100
188#define CREAD 0x0200
189#define PARENB 0x0400
190#define PARODD 0x0800
191
192#define HUPCL 0x1000
193#define CLOCAL 0x2000
194#define CBAUDEX 0x4000
195
196#define CRTSCTS 0x0400
197
198struct winsize {
199 unsigned short ws_row;
200 unsigned short ws_col;
201 unsigned short ws_xpixel;
202 unsigned short ws_ypixel;
203};
204
205struct termios {
214};
215
216#if VSF_LINUX_APPLET_USE_TERMIOS == ENABLED
219
233# ifndef __VSF_APPLET__
235# endif
236#endif
237
238#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_TERMIOS_LIB__))\
239 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_TERMIOS == ENABLED
240
241#ifndef VSF_LINUX_APPLET_TERMIOS_VPLT
242# if VSF_LINUX_USE_APPLET == ENABLED
243# define VSF_LINUX_APPLET_TERMIOS_VPLT \
244 ((vsf_linux_termios_vplt_t *)(VSF_LINUX_APPLET_VPLT->termios_vplt))
245# else
246# define VSF_LINUX_APPLET_TERMIOS_VPLT \
247 ((vsf_linux_termios_vplt_t *)vsf_vplt((void *)0))
248# endif
249#endif
250
251#define VSF_LINUX_APPLET_TERMIOS_ENTRY(__NAME) \
252 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_TERMIOS_VPLT, __NAME)
253#define VSF_LINUX_APPLET_TERMIOS_IMP(...) \
254 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_TERMIOS_VPLT, __VA_ARGS__)
255
256VSF_LINUX_APPLET_TERMIOS_IMP(tcgetattr, int, int fd, struct termios *termios) {
258 return VSF_LINUX_APPLET_TERMIOS_ENTRY(tcgetattr)(fd, termios);
259}
260VSF_LINUX_APPLET_TERMIOS_IMP(tcsetattr, int, int fd, int optional_actions, const struct termios *termios) {
262 return VSF_LINUX_APPLET_TERMIOS_ENTRY(tcsetattr)(fd, optional_actions, termios);
263}
264VSF_LINUX_APPLET_TERMIOS_IMP(tcsendbreak, int, int fd, int duration) {
266 return VSF_LINUX_APPLET_TERMIOS_ENTRY(tcsendbreak)(fd, duration);
267}
268VSF_LINUX_APPLET_TERMIOS_IMP(tcdrain, int, int fd) {
270 return VSF_LINUX_APPLET_TERMIOS_ENTRY(tcdrain)(fd);
271}
272VSF_LINUX_APPLET_TERMIOS_IMP(tcflush, int, int fd, int queue_selector) {
274 return VSF_LINUX_APPLET_TERMIOS_ENTRY(tcflush)(fd, queue_selector);
275}
276VSF_LINUX_APPLET_TERMIOS_IMP(tcflow, int, int fd, int action) {
278 return VSF_LINUX_APPLET_TERMIOS_ENTRY(tcflow)(fd, action);
279}
280VSF_LINUX_APPLET_TERMIOS_IMP(cfmakeraw, void, struct termios *termios) {
282 VSF_LINUX_APPLET_TERMIOS_ENTRY(cfmakeraw)(termios);
283}
284VSF_LINUX_APPLET_TERMIOS_IMP(cfgetispeed, speed_t, const struct termios *termios) {
286 return VSF_LINUX_APPLET_TERMIOS_ENTRY(cfgetispeed)(termios);
287}
288VSF_LINUX_APPLET_TERMIOS_IMP(cfgetospeed, speed_t, const struct termios *termios) {
290 return VSF_LINUX_APPLET_TERMIOS_ENTRY(cfgetospeed)(termios);
291}
292VSF_LINUX_APPLET_TERMIOS_IMP(cfsetispeed, int, struct termios *termios, speed_t speed) {
294 return VSF_LINUX_APPLET_TERMIOS_ENTRY(cfsetispeed)(termios, speed);
295}
296VSF_LINUX_APPLET_TERMIOS_IMP(cfsetospeed, int, struct termios *termios, speed_t speed) {
298 return VSF_LINUX_APPLET_TERMIOS_ENTRY(cfsetospeed)(termios, speed);
299}
300VSF_LINUX_APPLET_TERMIOS_IMP(cfsetspeed, int, struct termios *termios, speed_t speed) {
302 return VSF_LINUX_APPLET_TERMIOS_ENTRY(cfsetspeed)(termios, speed);
303}
304
305#else // __VSF_APPLET__ && VSF_LINUX_APPLET_USE_TERMIOS
306
307int tcgetattr(int fd, struct termios *termios);
308int tcsetattr(int fd, int optional_actions, const struct termios *termios);
309int tcsendbreak(int fd, int duration);
310int tcdrain(int fd);
311int tcflush(int fd, int queue_selector);
312int tcflow(int fd, int action);
313void cfmakeraw(struct termios *termios);
314speed_t cfgetispeed(const struct termios *termios);
315speed_t cfgetospeed(const struct termios *termios);
316int cfsetispeed(struct termios *termios, speed_t speed);
317int cfsetospeed(struct termios *termios, speed_t speed);
318int cfsetspeed(struct termios *termios, speed_t speed);
319
320#endif // __VSF_APPLET__ && VSF_LINUX_APPLET_USE_TERMIOS
321
322#ifdef __cplusplus
323}
324#endif
325
326#endif
__le16 duration
Definition ieee80211.h:1
u8 action
Definition ieee80211.h:120
Definition termios.h:205
speed_t c_ispeed
Definition termios.h:212
speed_t c_ospeed
Definition termios.h:213
tcflag_t c_cflag
Definition termios.h:208
cc_t c_cc[NCCS]
Definition termios.h:211
tcflag_t c_iflag
Definition termios.h:206
tcflag_t c_lflag
Definition termios.h:209
tcflag_t c_oflag
Definition termios.h:207
cc_t c_line
Definition termios.h:210
Definition termios.h:217
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(cfsetspeed)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(cfsetispeed)
vsf_vplt_info_t info
Definition termios.h:218
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcflow)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(cfgetospeed)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(cfmakeraw)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcdrain)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcflush)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcsetattr)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcgetattr)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(cfgetispeed)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcsendbreak)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(cfsetospeed)
Definition termios.h:198
unsigned short ws_row
Definition termios.h:199
unsigned short ws_col
Definition termios.h:200
unsigned short ws_xpixel
Definition termios.h:201
unsigned short ws_ypixel
Definition termios.h:202
#define B4000000
Definition termios.h:178
unsigned char cc_t
Definition termios.h:30
#define tcflow
Definition termios.h:16
#define B1800
Definition termios.h:138
#define B3500000
Definition termios.h:176
#define B2500000
Definition termios.h:172
unsigned int speed_t
Definition termios.h:31
#define NCCS
Definition termios.h:95
#define B576000
Definition termios.h:160
@ B0
Definition termios.h:118
#define B1000000
Definition termios.h:164
#define B1200
Definition termios.h:136
#define B4800
Definition termios.h:142
#define tcgetattr
Definition termios.h:11
#define B600
Definition termios.h:134
#define B57600
Definition termios.h:150
#define B300
Definition termios.h:132
#define B500000
Definition termios.h:158
#define B460800
Definition termios.h:156
#define cfmakeraw
Definition termios.h:17
#define B75
Definition termios.h:122
#define cfsetspeed
Definition termios.h:22
#define B150
Definition termios.h:128
#define B1152000
Definition termios.h:166
#define B134
Definition termios.h:126
#define tcsetattr
Definition termios.h:12
#define B200
Definition termios.h:130
#define B1500000
Definition termios.h:168
#define B230400
Definition termios.h:154
#define tcdrain
Definition termios.h:14
#define cfgetospeed
Definition termios.h:19
#define tcflush
Definition termios.h:15
#define B38400
Definition termios.h:148
#define B50
Definition termios.h:120
#define cfsetospeed
Definition termios.h:21
#define cfsetispeed
Definition termios.h:20
#define B110
Definition termios.h:124
#define B2000000
Definition termios.h:170
unsigned int tcflag_t
Definition termios.h:29
#define B3000000
Definition termios.h:174
#define B9600
Definition termios.h:144
#define cfgetispeed
Definition termios.h:18
__VSF_VPLT_DECORATOR__ vsf_linux_termios_vplt_t vsf_linux_termios_vplt
Definition vsf_linux.c:4981
#define B921600
Definition termios.h:162
#define B19200
Definition termios.h:146
#define tcsendbreak
Definition termios.h:13
#define B115200
Definition termios.h:152
#define B2400
Definition termios.h:140
Definition vsf_cfg.h:95
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165