1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __ASM_GENERIC_IOCTLS_H
3#define __ASM_GENERIC_IOCTLS_H
4
5#include <linux/ioctl.h>
6
7/*
8 * These are the most common definitions for tty ioctl numbers.
9 * Most of them do not use the recommended _IOC(), but there is
10 * probably some source code out there hardcoding the number,
11 * so we might as well use them for all new platforms.
12 *
13 * The architectures that use different values here typically
14 * try to be compatible with some Unix variants for the same
15 * architecture.
16 */
17
18/* 0x54 is just a magic number to make these relatively unique ('T') */
19
20#define TCGETS		0x5401
21#define TCSETS		0x5402
22#define TCSETSW		0x5403
23#define TCSETSF		0x5404
24#define TCGETA		0x5405
25#define TCSETA		0x5406
26#define TCSETAW		0x5407
27#define TCSETAF		0x5408
28#define TCSBRK		0x5409
29#define TCXONC		0x540A
30#define TCFLSH		0x540B
31#define TIOCEXCL	0x540C
32#define TIOCNXCL	0x540D
33#define TIOCSCTTY	0x540E
34#define TIOCGPGRP	0x540F
35#define TIOCSPGRP	0x5410
36#define TIOCOUTQ	0x5411
37#define TIOCSTI		0x5412
38#define TIOCGWINSZ	0x5413
39#define TIOCSWINSZ	0x5414
40#define TIOCMGET	0x5415
41#define TIOCMBIS	0x5416
42#define TIOCMBIC	0x5417
43#define TIOCMSET	0x5418
44#define TIOCGSOFTCAR	0x5419
45#define TIOCSSOFTCAR	0x541A
46#define FIONREAD	0x541B
47#define TIOCINQ		FIONREAD
48#define TIOCLINUX	0x541C
49#define TIOCCONS	0x541D
50#define TIOCGSERIAL	0x541E
51#define TIOCSSERIAL	0x541F
52#define TIOCPKT		0x5420
53#define FIONBIO		0x5421
54#define TIOCNOTTY	0x5422
55#define TIOCSETD	0x5423
56#define TIOCGETD	0x5424
57#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
58#define TIOCSBRK	0x5427  /* BSD compatibility */
59#define TIOCCBRK	0x5428  /* BSD compatibility */
60#define TIOCGSID	0x5429  /* Return the session ID of FD */
61#define TCGETS2		_IOR('T', 0x2A, struct termios2)
62#define TCSETS2		_IOW('T', 0x2B, struct termios2)
63#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
64#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
65#define TIOCGRS485	0x542E
66#ifndef TIOCSRS485
67#define TIOCSRS485	0x542F
68#endif
69#define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
70#define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
71#define TIOCGDEV	_IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
72#define TCGETX		0x5432 /* SYS5 TCGETX compatibility */
73#define TCSETX		0x5433
74#define TCSETXF		0x5434
75#define TCSETXW		0x5435
76#define TIOCSIG		_IOW('T', 0x36, int)  /* pty: generate signal */
77#define TIOCVHANGUP	0x5437
78#define TIOCGPKT	_IOR('T', 0x38, int) /* Get packet mode state */
79#define TIOCGPTLCK	_IOR('T', 0x39, int) /* Get Pty lock state */
80#define TIOCGEXCL	_IOR('T', 0x40, int) /* Get exclusive mode state */
81#define TIOCGPTPEER	_IO('T', 0x41) /* Safely open the slave */
82#define TIOCGISO7816	_IOR('T', 0x42, struct serial_iso7816)
83#define TIOCSISO7816	_IOWR('T', 0x43, struct serial_iso7816)
84
85#define FIONCLEX	0x5450
86#define FIOCLEX		0x5451
87#define FIOASYNC	0x5452
88#define TIOCSERCONFIG	0x5453
89#define TIOCSERGWILD	0x5454
90#define TIOCSERSWILD	0x5455
91#define TIOCGLCKTRMIOS	0x5456
92#define TIOCSLCKTRMIOS	0x5457
93#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
94#define TIOCSERGETLSR   0x5459 /* Get line status register */
95#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
96#define TIOCSERSETMULTI 0x545B /* Set multiport config */
97
98#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
99#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
100
101/*
102 * Some arches already define FIOQSIZE due to a historical
103 * conflict with a Hayes modem-specific ioctl value.
104 */
105#ifndef FIOQSIZE
106# define FIOQSIZE	0x5460
107#endif
108
109/* Used for packet mode */
110#define TIOCPKT_DATA		 0
111#define TIOCPKT_FLUSHREAD	 1
112#define TIOCPKT_FLUSHWRITE	 2
113#define TIOCPKT_STOP		 4
114#define TIOCPKT_START		 8
115#define TIOCPKT_NOSTOP		16
116#define TIOCPKT_DOSTOP		32
117#define TIOCPKT_IOCTL		64
118
119#define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
120
121#endif /* __ASM_GENERIC_IOCTLS_H */
122