diff options
Diffstat (limited to 'cpukit/libcsupport/include/sys/termios.h')
-rw-r--r-- | cpukit/libcsupport/include/sys/termios.h | 280 |
1 files changed, 80 insertions, 200 deletions
diff --git a/cpukit/libcsupport/include/sys/termios.h b/cpukit/libcsupport/include/sys/termios.h index 648e3a2822..7568b96be7 100644 --- a/cpukit/libcsupport/include/sys/termios.h +++ b/cpukit/libcsupport/include/sys/termios.h @@ -1,221 +1,101 @@ -/** - * @file +/*- + * Copyright (c) 1988, 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. * - * @brief POSIX Termios Implementation for RTEMS Console Device Driver + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * The Open Group Base Specifications Issue 6 - * IEEE Std 1003.1, 2004 Edition - * Chapter 11, General Terminal Interface - */ - -/* - * COPYRIGHT (c) 1989-2011. - * On-Line Applications Research Corporation (OAR). + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * @(#)termios.h 8.3 (Berkeley) 3/28/94 + * $FreeBSD: head/include/termios.h 265878 2014-05-11 13:48:21Z jilles $ */ -#ifndef TERMIOS_H -#define TERMIOS_H +#ifndef _TERMIOS_H_ +#define _TERMIOS_H_ -#include <sys/types.h> +#include <sys/cdefs.h> +#include <sys/_termios.h> +#include <sys/_types.h> -#ifdef __cplusplus -extern "C" { +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED #endif -/** - * @ingroup Termios - * - * @brief POSIX Termios Implementation - * - */ -/**@{**/ - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; +#if !_POSIX_SOURCE || __rtems__ +#define OXTABS TAB3 +#define MDMBUF CCAR_OFLOW +#endif -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; +#if !_POSIX_SOURCE || __rtems__ +#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) +#endif -/** - * This value is used to disable processing of a member of c_cc - * in the struct termios. +/* + * Commands passed to tcsetattr() for setting the termios structure. */ -#define _POSIX_VDISABLE 0 - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define CIBAUD 002003600000 /* input baud rate (not used) */ -#define CRTSCTS 020000000000 /* flow control */ - -#define RTEMS_TERMIOS_NUMBER_BAUD_RATES 20 - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 +#define TCSANOW 0 /* make change immediate */ +#define TCSADRAIN 1 /* drain output, then change */ +#define TCSAFLUSH 2 /* drain output, flush input */ +#if !_POSIX_SOURCE || __rtems__ +#define TCSASOFT 0x10 /* flag - don't alter h.w. state */ +#endif +#define TCIFLUSH 1 +#define TCOFLUSH 2 +#define TCIOFLUSH 3 +#define TCOOFF 1 +#define TCOON 2 +#define TCIOFF 3 +#define TCION 4 + +__BEGIN_DECLS +speed_t cfgetispeed(const struct termios *); +speed_t cfgetospeed(const struct termios *); +int cfsetispeed(struct termios *, speed_t); +int cfsetospeed(struct termios *, speed_t); +int tcgetattr(int, struct termios *); +int tcsetattr(int, int, const struct termios *); int tcdrain(int); int tcflow(int, int); int tcflush(int, int); -int tcgetattr(int, struct termios *); -int tcsetattr(int, int, struct termios *); -int tcdrain(int); -pid_t tcgetprgrp(int); -int tcsetprgrp(int, pid_t); int tcsendbreak(int, int); -speed_t cfgetospeed(const struct termios *tp); -int cfsetospeed(struct termios *tp, speed_t speed); -speed_t cfgetispeed(const struct termios *tp); -int cfsetispeed(struct termios *tp, speed_t speed); -void cfmakeraw(struct termios *tp); -int cfsetspeed(struct termios *tp, speed_t speed); -/** @} */ +#if __POSIX_VISIBLE >= 200112 +pid_t tcgetsid(int); +#endif +#if __BSD_VISIBLE +int tcsetsid(int, pid_t); -#ifdef __cplusplus -} +void cfmakeraw(struct termios *); +void cfmakesane(struct termios *); +int cfsetspeed(struct termios *, speed_t); #endif +__END_DECLS + +#endif /* !_TERMIOS_H_ */ -#endif /* TERMIOS_H */ +#if !_POSIX_SOURCE || __rtems__ +#include <sys/ttycom.h> +#include <sys/ttydefaults.h> +#endif |