1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2#ifndef _ASM_POWERPC_TERMBITS_H
3#define _ASM_POWERPC_TERMBITS_H
4
5/*
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12typedef unsigned char	cc_t;
13typedef unsigned int	speed_t;
14typedef unsigned int	tcflag_t;
15
16/*
17 * termios type and macro definitions.  Be careful about adding stuff
18 * to this file since it's used in GNU libc and there are strict rules
19 * concerning namespace pollution.
20 */
21
22#define NCCS 19
23struct termios {
24	tcflag_t c_iflag;		/* input mode flags */
25	tcflag_t c_oflag;		/* output mode flags */
26	tcflag_t c_cflag;		/* control mode flags */
27	tcflag_t c_lflag;		/* local mode flags */
28	cc_t c_cc[NCCS];		/* control characters */
29	cc_t c_line;			/* line discipline (== c_cc[19]) */
30	speed_t c_ispeed;		/* input speed */
31	speed_t c_ospeed;		/* output speed */
32};
33
34/* For PowerPC the termios and ktermios are the same */
35
36struct ktermios {
37	tcflag_t c_iflag;		/* input mode flags */
38	tcflag_t c_oflag;		/* output mode flags */
39	tcflag_t c_cflag;		/* control mode flags */
40	tcflag_t c_lflag;		/* local mode flags */
41	cc_t c_cc[NCCS];		/* control characters */
42	cc_t c_line;			/* line discipline (== c_cc[19]) */
43	speed_t c_ispeed;		/* input speed */
44	speed_t c_ospeed;		/* output speed */
45};
46
47/* c_cc characters */
48#define VINTR 	         0
49#define VQUIT 	         1
50#define VERASE 	         2
51#define VKILL	         3
52#define VEOF	         4
53#define VMIN	         5
54#define VEOL	         6
55#define VTIME	         7
56#define VEOL2	         8
57#define VSWTC	         9
58#define VWERASE 	10
59#define VREPRINT	11
60#define VSUSP 		12
61#define VSTART		13
62#define VSTOP		14
63#define VLNEXT		15
64#define VDISCARD	16
65
66/* c_iflag bits */
67#define IGNBRK	0000001
68#define BRKINT	0000002
69#define IGNPAR	0000004
70#define PARMRK	0000010
71#define INPCK	0000020
72#define ISTRIP	0000040
73#define INLCR	0000100
74#define IGNCR	0000200
75#define ICRNL	0000400
76#define IXON	0001000
77#define IXOFF	0002000
78#define IXANY	0004000
79#define IUCLC	0010000
80#define IMAXBEL	0020000
81#define	IUTF8	0040000
82
83/* c_oflag bits */
84#define OPOST	0000001
85#define ONLCR	0000002
86#define OLCUC	0000004
87
88#define OCRNL	0000010
89#define ONOCR	0000020
90#define ONLRET	0000040
91
92#define OFILL	00000100
93#define OFDEL	00000200
94#define NLDLY	00001400
95#define   NL0	00000000
96#define   NL1	00000400
97#define   NL2	00001000
98#define   NL3	00001400
99#define TABDLY	00006000
100#define   TAB0	00000000
101#define   TAB1	00002000
102#define   TAB2	00004000
103#define   TAB3	00006000
104#define   XTABS	00006000	/* required by POSIX to == TAB3 */
105#define CRDLY	00030000
106#define   CR0	00000000
107#define   CR1	00010000
108#define   CR2	00020000
109#define   CR3	00030000
110#define FFDLY	00040000
111#define   FF0	00000000
112#define   FF1	00040000
113#define BSDLY	00100000
114#define   BS0	00000000
115#define   BS1	00100000
116#define VTDLY	00200000
117#define   VT0	00000000
118#define   VT1	00200000
119
120/* c_cflag bit meaning */
121#define CBAUD	0000377
122#define  B0	0000000		/* hang up */
123#define  B50	0000001
124#define  B75	0000002
125#define  B110	0000003
126#define  B134	0000004
127#define  B150	0000005
128#define  B200	0000006
129#define  B300	0000007
130#define  B600	0000010
131#define  B1200	0000011
132#define  B1800	0000012
133#define  B2400	0000013
134#define  B4800	0000014
135#define  B9600	0000015
136#define  B19200	0000016
137#define  B38400	0000017
138#define  EXTA   B19200
139#define  EXTB   B38400
140#define  CBAUDEX 0000000
141#define  B57600   00020
142#define  B115200  00021
143#define  B230400  00022
144#define  B460800  00023
145#define  B500000  00024
146#define  B576000  00025
147#define  B921600  00026
148#define B1000000  00027
149#define B1152000  00030
150#define B1500000  00031
151#define B2000000  00032
152#define B2500000  00033
153#define B3000000  00034
154#define B3500000  00035
155#define B4000000  00036
156#define   BOTHER  00037
157
158#define CIBAUD	077600000
159#define IBSHIFT	16		/* Shift from CBAUD to CIBAUD */
160
161#define CSIZE	00001400
162#define   CS5	00000000
163#define   CS6	00000400
164#define   CS7	00001000
165#define   CS8	00001400
166
167#define CSTOPB	00002000
168#define CREAD	00004000
169#define PARENB	00010000
170#define PARODD	00020000
171#define HUPCL	00040000
172
173#define CLOCAL	00100000
174#define CMSPAR	  010000000000		/* mark or space (stick) parity */
175#define CRTSCTS	  020000000000		/* flow control */
176
177/* c_lflag bits */
178#define ISIG	0x00000080
179#define ICANON	0x00000100
180#define XCASE	0x00004000
181#define ECHO	0x00000008
182#define ECHOE	0x00000002
183#define ECHOK	0x00000004
184#define ECHONL	0x00000010
185#define NOFLSH	0x80000000
186#define TOSTOP	0x00400000
187#define ECHOCTL	0x00000040
188#define ECHOPRT	0x00000020
189#define ECHOKE	0x00000001
190#define FLUSHO	0x00800000
191#define PENDIN	0x20000000
192#define IEXTEN	0x00000400
193#define EXTPROC	0x10000000
194
195/* Values for the ACTION argument to `tcflow'.  */
196#define	TCOOFF		0
197#define	TCOON		1
198#define	TCIOFF		2
199#define	TCION		3
200
201/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
202#define	TCIFLUSH	0
203#define	TCOFLUSH	1
204#define	TCIOFLUSH	2
205
206/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
207#define	TCSANOW		0
208#define	TCSADRAIN	1
209#define	TCSAFLUSH	2
210
211#endif	/* _ASM_POWERPC_TERMBITS_H */
212