1 /* 2 * Copyright (c) 2006-2023, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2023-11-13 Shell init ver. 9 */ 10 11 #ifndef __TTY_CONFIG_H__ 12 #define __TTY_CONFIG_H__ 13 14 /* default buffer size of tty siginfo */ 15 #define LWP_TTY_PRBUF_SIZE 256 16 17 /* 18 * System wide defaults for terminal state. 19 */ 20 21 /*- 22 * SPDX-License-Identifier: BSD-3-Clause 23 * 24 * Copyright (c) 1982, 1986, 1993 25 * The Regents of the University of California. All rights reserved. 26 * (c) UNIX System Laboratories, Inc. 27 * All or some portions of this file are derived from material licensed 28 * to the University of California by American Telephone and Telegraph 29 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 30 * the permission of UNIX System Laboratories, Inc. 31 * 32 * Redistribution and use in source and binary forms, with or without 33 * modification, are permitted provided that the following conditions 34 * are met: 35 * 1. Redistributions of source code must retain the above copyright 36 * notice, this list of conditions and the following disclaimer. 37 * 2. Redistributions in binary form must reproduce the above copyright 38 * notice, this list of conditions and the following disclaimer in the 39 * documentation and/or other materials provided with the distribution. 40 * 3. Neither the name of the University nor the names of its contributors 41 * may be used to endorse or promote products derived from this software 42 * without specific prior written permission. 43 * 44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 * SUCH DAMAGE. 55 * 56 * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 57 */ 58 59 /* 60 * Defaults on "first" open. 61 */ 62 #define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY | IUTF8) 63 #define TTYDEF_OFLAG (OPOST | ONLCR) 64 #define TTYDEF_LFLAG_NOECHO (ICANON | ISIG | IEXTEN) 65 #define TTYDEF_LFLAG_ECHO \ 66 (TTYDEF_LFLAG_NOECHO | ECHO | ECHOE | ECHOKE | ECHOCTL) 67 #define TTYDEF_LFLAG TTYDEF_LFLAG_ECHO 68 #define TTYDEF_CFLAG (CREAD | CS8 | HUPCL) 69 #define TTYDEF_SPEED (B9600) 70 71 /* 72 * Control Character Defaults 73 */ 74 /* 75 * XXX: A lot of code uses lowercase characters, but control-character 76 * conversion is actually only valid when applied to uppercase 77 * characters. We just treat lowercase characters as if they were 78 * inserted as uppercase. 79 */ 80 #define _CONTROL(c) \ 81 ((c) >= 'a' && (c) <= 'z' ? ((c) - 'a' + 1) : (((c) - 'A' + 1) & 0x7f)) 82 #define CEOF _CONTROL('D') 83 #define CEOL 0xff /* XXX avoid _POSIX_VDISABLE */ 84 #define CERASE 0x7f 85 #define CERASE2 _CONTROL('H') 86 #define CINTR _CONTROL('C') 87 #define CSTATUS _CONTROL('T') 88 #define CKILL _CONTROL('U') 89 #define CMIN 1 90 #define CQUIT _CONTROL('\\') 91 #define CSUSP _CONTROL('Z') 92 #define CTIME 0 93 #define CDSUSP _CONTROL('Y') 94 #define CSTART _CONTROL('Q') 95 #define CSTOP _CONTROL('S') 96 #define CLNEXT _CONTROL('V') 97 #define CDISCARD _CONTROL('O') 98 #define CWERASE _CONTROL('W') 99 #define CREPRINT _CONTROL('R') 100 #define CEOT CEOF 101 /* compat */ 102 #define CBRK CEOL 103 #define CRPRNT CREPRINT 104 #define CFLUSH CDISCARD 105 106 /* PROTECTED INCLUSION ENDS HERE */ 107 #endif /* !__TTY_CONFIG_H__ */ 108 109 /* 110 * #define TTY_CONF_INCLUDE_CCHARS to include an array of default control 111 * characters. 112 */ 113 #ifdef TTY_CONF_INCLUDE_CCHARS 114 #include <rtdef.h> 115 #include <termios.h> 116 #include <unistd.h> 117 118 static const cc_t tty_ctrl_charset[NCCS] = { 119 [VINTR] = CINTR, 120 [VQUIT] = CQUIT, 121 [VERASE] = CERASE, 122 [VKILL] = CKILL, 123 [VEOF] = CEOF, 124 [VSTART] = CSTART, 125 [VSTOP] = CSTOP, 126 [VSUSP] = CSUSP, 127 [VREPRINT] = CREPRINT, 128 [VDISCARD] = CDISCARD, 129 [VWERASE] = CWERASE, 130 [VLNEXT] = CLNEXT, 131 [VMIN] = CMIN 132 #undef _CONTROL 133 }; 134 135 #undef TTY_CONF_INCLUDE_CCHARS 136 #endif /* __TTY_CONFIG_H__ */ 137