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
12#include <asm-generic/termbits-common.h>
13
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 IXON	0x0200
68#define IXOFF	0x0400
69#define IUCLC	0x1000
70#define IMAXBEL	0x2000
71#define IUTF8	0x4000
72
73/* c_oflag bits */
74#define ONLCR	0x00002
75#define OLCUC	0x00004
76#define NLDLY	0x00300
77#define   NL0	0x00000
78#define   NL1	0x00100
79#define   NL2	0x00200
80#define   NL3	0x00300
81#define TABDLY	0x00c00
82#define   TAB0	0x00000
83#define   TAB1	0x00400
84#define   TAB2	0x00800
85#define   TAB3	0x00c00
86#define   XTABS	0x00c00		/* required by POSIX to == TAB3 */
87#define CRDLY	0x03000
88#define   CR0	0x00000
89#define   CR1	0x01000
90#define   CR2	0x02000
91#define   CR3	0x03000
92#define FFDLY	0x04000
93#define   FF0	0x00000
94#define   FF1	0x04000
95#define BSDLY	0x08000
96#define   BS0	0x00000
97#define   BS1	0x08000
98#define VTDLY	0x10000
99#define   VT0	0x00000
100#define   VT1	0x10000
101
102/* c_cflag bit meaning */
103#define CBAUD		0x000000ff
104#define CBAUDEX		0x00000000
105#define BOTHER		0x0000001f
106#define    B57600	0x00000010
107#define   B115200	0x00000011
108#define   B230400	0x00000012
109#define   B460800	0x00000013
110#define   B500000	0x00000014
111#define   B576000	0x00000015
112#define   B921600	0x00000016
113#define  B1000000	0x00000017
114#define  B1152000	0x00000018
115#define  B1500000	0x00000019
116#define  B2000000	0x0000001a
117#define  B2500000	0x0000001b
118#define  B3000000	0x0000001c
119#define  B3500000	0x0000001d
120#define  B4000000	0x0000001e
121#define CSIZE		0x00000300
122#define   CS5		0x00000000
123#define   CS6		0x00000100
124#define   CS7		0x00000200
125#define   CS8		0x00000300
126#define CSTOPB		0x00000400
127#define CREAD		0x00000800
128#define PARENB		0x00001000
129#define PARODD		0x00002000
130#define HUPCL		0x00004000
131#define CLOCAL		0x00008000
132#define CIBAUD		0x00ff0000
133
134/* c_lflag bits */
135#define ISIG	0x00000080
136#define ICANON	0x00000100
137#define XCASE	0x00004000
138#define ECHO	0x00000008
139#define ECHOE	0x00000002
140#define ECHOK	0x00000004
141#define ECHONL	0x00000010
142#define NOFLSH	0x80000000
143#define TOSTOP	0x00400000
144#define ECHOCTL	0x00000040
145#define ECHOPRT	0x00000020
146#define ECHOKE	0x00000001
147#define FLUSHO	0x00800000
148#define PENDIN	0x20000000
149#define IEXTEN	0x00000400
150#define EXTPROC	0x10000000
151
152/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
153#define	TCSANOW		0
154#define	TCSADRAIN	1
155#define	TCSAFLUSH	2
156
157#endif	/* _ASM_POWERPC_TERMBITS_H */
158