168 lines · c
1//===-- Definition of macros from termios.h -------------------------------===//2//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H10#define LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H11 12// Below are generic definitions of symbolic bit-masks, modes etc. They serve13// most architectures including x86_64, aarch64 but have to be adjusted for few14// architectures MIPS.15 16#define NCCS 3217 18// Bit-masks for the c_iflag field of struct termios.19#define IGNBRK 0000001 // Ignore break condition20#define BRKINT 0000002 // Signal interrupt on break21#define IGNPAR 0000004 // Ignore characters with parity errors22#define PARMRK 0000010 // Mark parity and framing errors23#define INPCK 0000020 // Enable input parity check24#define ISTRIP 0000040 // Strip 8th bit off characters25#define INLCR 0000100 // Map NL to CR on input26#define IGNCR 0000200 // Ignore CR27#define ICRNL 0000400 // Map CR to NL on input28#define IUCLC 0001000 // Map uppercase characters to lowercase on input29#define IXON 0002000 // Enable start/stop output control30#define IXANY 0004000 // Enable any character to restart output31#define IXOFF 0010000 // Enable start/stop input control32#define IMAXBEL 0020000 // Ring bell when input queue is full33#define IUTF8 0040000 // Input is UTF8 (not in POSIX)34 35// Bit-masks for the c_oflag field of struct termios.36#define OPOST 0000001 // Post-process output37#define OLCUC 0000002 // Map lowercase characters to uppercase on output38#define ONLCR 0000004 // Map NL to CR-NL on output39#define OCRNL 0000010 // Map CR to NL on output40#define ONOCR 0000020 // No CR output at column 041#define ONLRET 0000040 // NL performs CR function42#define OFILL 0000100 // Use fill characters for delay43#define OFDEL 0000200 // Fill is DEL44#define NLDLY 0000400 // Select newline delays45#define NL0 0000000 // Newline type 046#define NL1 0000400 // Newline type 147#define CRDLY 0003000 // Select carriage-return delays48#define CR0 0000000 // Carriage-return delay type 049#define CR1 0001000 // Carriage-return delay type 150#define CR2 0002000 // Carriage-return delay type 251#define CR3 0003000 // Carriage-return delay type 352#define TABDLY 0014000 // Select horizontal-tab delays53#define TAB0 0000000 // Horizontal-tab delay type 054#define TAB1 0004000 // Horizontal-tab delay type 155#define TAB2 0010000 // Horizontal-tab delay type 256#define TAB3 0014000 // Expand tabs to spaces57#define BSDLY 0020000 // Select backspace delays58#define BS0 0000000 // Backspace-delay type 059#define BS1 0020000 // Backspace-delay type 160#define FFDLY 0100000 // Select form-feed delays61#define FF0 0000000 // Form-feed delay type 062#define FF1 0100000 // Form-feed delay type 163#define VTDLY 0040000 // Select vertical-tab delays64#define VT0 0000000 // Vertical-tab delay type 065#define VT1 0040000 // Vertical-tab delay type 166#define XTABS 001400067 68// Symbolic subscripts for the c_cc array.69#define VINTR 070#define VQUIT 171#define VERASE 272#define VKILL 373#define VEOF 474#define VTIME 575#define VMIN 676#define VSWTC 777#define VSTART 878#define VSTOP 979#define VSUSP 1080#define VEOL 1181#define VREPRINT 1282#define VDISCARD 1383#define VWERASE 1484#define VLNEXT 1585#define VEOL2 1686 87// Baud rate related definitions88#define CBAUD 000000010017 // Baud speed mask89#define CBAUDX 000000010000 // Extra baud speed mask90#define CIBAUD 00200360000091#define CMSPAR 01000000000092#define CRTSCTS 02000000000093// Baud rates with values representable by the speed_t type.94#define B0 0000000 // Implies hang-up95// A symbol B<NN+> below indicates a baud rate of <NN+>.96#define B50 000000197#define B75 000000298#define B110 000000399#define B134 0000004100#define B150 0000005101#define B200 0000006102#define B300 0000007103#define B600 0000010104#define B1200 0000011105#define B1800 0000012106#define B2400 0000013107#define B4800 0000014108#define B9600 0000015109#define B19200 0000016110#define B38400 0000017111// Extra baud rates112#define B57600 0010001113#define B115200 0010002114#define B230400 0010003115#define B460800 0010004116#define B500000 0010005117#define B576000 0010006118#define B921600 0010007119#define B1000000 0010010120#define B1152000 0010011121#define B1500000 0010012122#define B2000000 0010013123#define B2500000 0010014124#define B3000000 0010015125#define B3500000 0010016126#define B4000000 0010017127 128// Control mode bits for use in the c_cflag field of struct termios.129#define CSIZE 0000060 // Mask for character size bits130#define CS5 0000000131#define CS6 0000020132#define CS7 0000040133#define CS8 0000060134#define CSTOPB 0000100 // Send two bits, else one135#define CREAD 0000200 // Enable receiver136#define PARENB 0000400 // Parity enable137#define PARODD 0001000 // Odd parity, else even138#define HUPCL 0002000 // Hang up on last close139#define CLOCAL 0004000 // Ignore modem status lines140 141// Local mode bits for use in the c_lflag field of struct termios.142#define ISIG 0000001 // Enable signals143#define ICANON 0000002 // Canonical input (erase and kill processing)144#define ECHO 0000010 // Enable echo145#define ECHOE 0000020 // Echo erase character as error-correcting backspace146#define ECHOK 0000040 // Echo KILL147#define ECHONL 0000100 // Echo NL148#define NOFLSH 0000200 // Disable flush after interrupt or quit149#define TOSTOP 0000400 // Send SIGTTOU for background output150 151// Attribute selection152#define TCSANOW 0 // Change attributes immediately153#define TCSADRAIN 1 // Change attributes when output has drained154#define TCSAFLUSH 2 // Same as TCSADRAIN and flush pending Output155 156// Symbolic constants for use with tcflush function.157#define TCIFLUSH 0 // Flush pending input158#define TCIOFLUSH 1 // Flush pending input and unstransmitted output159#define TCOFLUSH 2 // Flush unstransmitted output160 161// Symbolic constantf for use with tcflow function.162#define TCOOFF 0 // Transmit a STOP character, intended to suspend input data163#define TCOON 1 // Transmit a START character, intended to restart input data164#define TCIOFF 2 // Suspend output165#define TCION 3 // Restart output166 167#endif // LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H168