1/*
2 * Copyright (c) 2005-2020 Rich Felker, et al.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Note: From the musl project, stripped down and repackaged with HOST_/host_ prepended
7 */
8
9#undef HOST_NCCS
10#define HOST_NCCS 19
11struct host_termios {
12	host_tcflag_t c_iflag;
13	host_tcflag_t c_oflag;
14	host_tcflag_t c_cflag;
15	host_tcflag_t c_lflag;
16	host_cc_t c_cc[HOST_NCCS];
17	host_cc_t c_line;
18	host_speed_t __c_ispeed;
19	host_speed_t __c_ospeed;
20};
21
22#define HOST_VINTR     0
23#define HOST_VQUIT     1
24#define HOST_VERASE    2
25#define HOST_VKILL     3
26#define HOST_VEOF      4
27#define HOST_VMIN      5
28#define HOST_VEOL      6
29#define HOST_VTIME     7
30#define HOST_VEOL2     8
31#define HOST_VSWTC     9
32#define HOST_VWERASE  10
33#define HOST_VREPRINT 11
34#define HOST_VSUSP    12
35#define HOST_VSTART   13
36#define HOST_VSTOP    14
37#define HOST_VLNEXT   15
38#define HOST_VDISCARD 16
39
40#define HOST_IGNBRK  0000001
41#define HOST_BRKINT  0000002
42#define HOST_IGNPAR  0000004
43#define HOST_PARMRK  0000010
44#define HOST_INPCK   0000020
45#define HOST_ISTRIP  0000040
46#define HOST_INLCR   0000100
47#define HOST_IGNCR   0000200
48#define HOST_ICRNL   0000400
49#define HOST_IXON    0001000
50#define HOST_IXOFF   0002000
51#define HOST_IXANY   0004000
52#define HOST_IUCLC   0010000
53#define HOST_IMAXBEL 0020000
54#define HOST_IUTF8   0040000
55
56#define HOST_OPOST  0000001
57#define HOST_ONLCR  0000002
58#define HOST_OLCUC  0000004
59#define HOST_OCRNL  0000010
60#define HOST_ONOCR  0000020
61#define HOST_ONLRET 0000040
62#define HOST_OFILL  0000100
63#define HOST_OFDEL  0000200
64#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
65#define HOST_NLDLY  0001400
66#define HOST_NL0    0000000
67#define HOST_NL1    0000400
68#define HOST_NL2    0001000
69#define HOST_NL3    0001400
70#define HOST_TABDLY 0006000
71#define HOST_TAB0   0000000
72#define HOST_TAB1   0002000
73#define HOST_TAB2   0004000
74#define HOST_TAB3   0006000
75#define HOST_CRDLY  0030000
76#define HOST_CR0    0000000
77#define HOST_CR1    0010000
78#define HOST_CR2    0020000
79#define HOST_CR3    0030000
80#define HOST_FFDLY  0040000
81#define HOST_FF0    0000000
82#define HOST_FF1    0040000
83#define HOST_BSDLY  0100000
84#define HOST_BS0    0000000
85#define HOST_BS1    0100000
86#endif
87
88#define HOST_VTDLY  0200000
89#define HOST_VT0    0000000
90#define HOST_VT1    0200000
91
92#define HOST_B0       0000000
93#define HOST_B50      0000001
94#define HOST_B75      0000002
95#define HOST_B110     0000003
96#define HOST_B134     0000004
97#define HOST_B150     0000005
98#define HOST_B200     0000006
99#define HOST_B300     0000007
100#define HOST_B600     0000010
101#define HOST_B1200    0000011
102#define HOST_B1800    0000012
103#define HOST_B2400    0000013
104#define HOST_B4800    0000014
105#define HOST_B9600    0000015
106#define HOST_B19200   0000016
107#define HOST_B38400   0000017
108
109#define HOST_B57600   00020
110#define HOST_B115200  00021
111#define HOST_B230400  00022
112#define HOST_B460800  00023
113#define HOST_B500000  00024
114#define HOST_B576000  00025
115#define HOST_B921600  00026
116#define HOST_B1000000 00027
117#define HOST_B1152000 00030
118#define HOST_B1500000 00031
119#define HOST_B2000000 00032
120#define HOST_B2500000 00033
121#define HOST_B3000000 00034
122#define HOST_B3500000 00035
123#define HOST_B4000000 00036
124
125#define HOST_CSIZE  00001400
126#define HOST_CS5    00000000
127#define HOST_CS6    00000400
128#define HOST_CS7    00001000
129#define HOST_CS8    00001400
130#define HOST_CSTOPB 00002000
131#define HOST_CREAD  00004000
132#define HOST_PARENB 00010000
133#define HOST_PARODD 00020000
134#define HOST_HUPCL  00040000
135#define HOST_CLOCAL 00100000
136
137#define HOST_ECHOE   0x00000002
138#define HOST_ECHOK   0x00000004
139#define HOST_ECHO    0x00000008
140#define HOST_ECHONL  0x00000010
141#define HOST_ISIG    0x00000080
142#define HOST_ICANON  0x00000100
143#define HOST_IEXTEN  0x00000400
144#define HOST_TOSTOP  0x00400000
145#define HOST_NOFLSH  0x80000000
146
147#define HOST_TCOOFF 0
148#define HOST_TCOON  1
149#define HOST_TCIOFF 2
150#define HOST_TCION  3
151
152#define HOST_TCIFLUSH  0
153#define HOST_TCOFLUSH  1
154#define HOST_TCIOFLUSH 2
155
156#define HOST_TCSANOW   0
157#define HOST_TCSADRAIN 1
158#define HOST_TCSAFLUSH 2
159
160#define HOST_EXTA    0000016
161#define HOST_EXTB    0000017
162#define HOST_CBAUD   00377
163#define HOST_CBAUDEX 0000020
164#define HOST_CIBAUD  077600000
165#define HOST_CMSPAR  010000000000
166#define HOST_CRTSCTS 020000000000
167
168#define HOST_XCASE   0x00004000
169#define HOST_ECHOCTL 0x00000040
170#define HOST_ECHOPRT 0x00000020
171#define HOST_ECHOKE  0x00000001
172#define HOST_FLUSHO  0x00800000
173#define HOST_PENDIN  0x20000000
174#define HOST_EXTPROC 0x10000000
175
176#define HOST_XTABS   00006000
177#define HOST_TIOCSER_TEMT 1
178
179#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
180#define _IOC_NONE  1U
181#define _IOC_WRITE 4U
182#define _IOC_READ  2U
183
184#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
185#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
186#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
187#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
188
189#define HOST_TCGETS	_IOR('t', 19, char[44])
190#define HOST_TCSETS	_IOW('t', 20, char[44])
191#define HOST_TCSETSW	_IOW('t', 21, char[44])
192#define HOST_TCSETSF	_IOW('t', 22, char[44])
193