1 //===-- Definition of macros from termios.h -------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
10 #define LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
12 // Below are generic definitions of symbolic bit-masks, modes etc. They serve
13 // most architectures including x86_64, aarch64 but have to be adjusted for few
14 // architectures MIPS.
18 // Bit-masks for the c_iflag field of struct termios.
19 #define IGNBRK 0000001 // Ignore break condition
20 #define BRKINT 0000002 // Signal interrupt on break
21 #define IGNPAR 0000004 // Ignore characters with parity errors
22 #define PARMRK 0000010 // Mark parity and framing errors
23 #define INPCK 0000020 // Enable input parity check
24 #define ISTRIP 0000040 // Strip 8th bit off characters
25 #define INLCR 0000100 // Map NL to CR on input
26 #define IGNCR 0000200 // Ignore CR
27 #define ICRNL 0000400 // Map CR to NL on input
28 #define IUCLC 0001000 // Map uppercase characters to lowercase on input
29 #define IXON 0002000 // Enable start/stop output control
30 #define IXANY 0004000 // Enable any character to restart output
31 #define IXOFF 0010000 // Enable start/stop input control
32 #define IMAXBEL 0020000 // Ring bell when input queue is full
33 #define IUTF8 0040000 // Input is UTF8 (not in POSIX)
35 // Bit-masks for the c_oflag field of struct termios.
36 #define OPOST 0000001 // Post-process output
37 #define OLCUC 0000002 // Map lowercase characters to uppercase on output
38 #define ONLCR 0000004 // Map NL to CR-NL on output
39 #define OCRNL 0000010 // Map CR to NL on output
40 #define ONOCR 0000020 // No CR output at column 0
41 #define ONLRET 0000040 // NL performs CR function
42 #define OFILL 0000100 // Use fill characters for delay
43 #define OFDEL 0000200 // Fill is DEL
44 #define NLDLY 0000400 // Select newline delays
45 #define NL0 0000000 // Newline type 0
46 #define NL1 0000400 // Newline type 1
47 #define CRDLY 0003000 // Select carriage-return delays
48 #define CR0 0000000 // Carriage-return delay type 0
49 #define CR1 0001000 // Carriage-return delay type 1
50 #define CR2 0002000 // Carriage-return delay type 2
51 #define CR3 0003000 // Carriage-return delay type 3
52 #define TABDLY 0014000 // Select horizontal-tab delays
53 #define TAB0 0000000 // Horizontal-tab delay type 0
54 #define TAB1 0004000 // Horizontal-tab delay type 1
55 #define TAB2 0010000 // Horizontal-tab delay type 2
56 #define TAB3 0014000 // Expand tabs to spaces
57 #define BSDLY 0020000 // Select backspace delays
58 #define BS0 0000000 // Backspace-delay type 0
59 #define BS1 0020000 // Backspace-delay type 1
60 #define FFDLY 0100000 // Select form-feed delays
61 #define FF0 0000000 // Form-feed delay type 0
62 #define FF1 0100000 // Form-feed delay type 1
63 #define VTDLY 0040000 // Select vertical-tab delays
64 #define VT0 0000000 // Vertical-tab delay type 0
65 #define VT1 0040000 // Vertical-tab delay type 1
68 // Symbolic subscripts for the c_cc array.
87 // Baud rate related definitions
88 #define CBAUD 000000010017 // Baud speed mask
89 #define CBAUDX 000000010000 // Extra baud speed mask
90 #define CIBAUD 002003600000
91 #define CMSPAR 010000000000
92 #define CRTSCTS 020000000000
93 // Baud rates with values representable by the speed_t type.
94 #define B0 0000000 // Implies hang-up
95 // A symbol B<NN+> below indicates a baud rate of <NN+>.
104 #define B1200 0000011
105 #define B1800 0000012
106 #define B2400 0000013
107 #define B4800 0000014
108 #define B9600 0000015
109 #define B19200 0000016
110 #define B38400 0000017
112 #define B57600 0010001
113 #define B115200 0010002
114 #define B230400 0010003
115 #define B460800 0010004
116 #define B500000 0010005
117 #define B576000 0010006
118 #define B921600 0010007
119 #define B1000000 0010010
120 #define B1152000 0010011
121 #define B1500000 0010012
122 #define B2000000 0010013
123 #define B2500000 0010014
124 #define B3000000 0010015
125 #define B3500000 0010016
126 #define B4000000 0010017
128 // Control mode bits for use in the c_cflag field of struct termios.
129 #define CSIZE 0000060 // Mask for character size bits
134 #define CSTOPB 0000100 // Send two bits, else one
135 #define CREAD 0000200 // Enable receiver
136 #define PARENB 0000400 // Parity enable
137 #define PARODD 0001000 // Odd parity, else even
138 #define HUPCL 0002000 // Hang up on last close
139 #define CLOCAL 0004000 // Ignore modem status lines
141 // Local mode bits for use in the c_lflag field of struct termios.
142 #define ISIG 0000001 // Enable signals
143 #define ICANON 0000002 // Canonical input (erase and kill processing)
144 #define ECHO 0000010 // Enable echo
145 #define ECHOE 0000020 // Echo erase character as error-correcting backspace
146 #define ECHOK 0000040 // Echo KILL
147 #define ECHONL 0000100 // Echo NL
148 #define NOFLSH 0000200 // Disable flush after interrupt or quit
149 #define TOSTOP 0000400 // Send SIGTTOU for background output
151 // Attribute selection
152 #define TCSANOW 0 // Change attributes immediately
153 #define TCSADRAIN 1 // Change attributes when output has drained
154 #define TCSAFLUSH 2 // Same as TCSADRAIN and flush pending Output
156 // Symbolic constants for use with tcflush function.
157 #define TCIFLUSH 0 // Flush pending input
158 #define TCIOFLUSH 1 // Flush pending input and unstransmitted output
159 #define TCOFLUSH 2 // Flush unstransmitted output
161 // Symbolic constantf for use with tcflow function.
162 #define TCOOFF 0 // Transmit a STOP character, intended to suspend input data
163 #define TCOON 1 // Transmit a START character, intended to restart input data
164 #define TCIOFF 2 // Suspend output
165 #define TCION 3 // Restart output
167 #endif // LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H