+++ /dev/null
-/** @file\r
- Macros and declarations for terminal oriented ioctls and\r
- I/O discipline.\r
-\r
- Copyright (c) 2016, Daryl McDaniel. All rights reserved.<BR>\r
- Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- * Copyright (c) 1988, 1989, 1993, 1994\r
- * The Regents of the University of California. All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. Neither the name of the University nor the names of its contributors\r
- * may be used to endorse or promote products derived from this software\r
- * without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- *\r
- * @(#)termios.h 8.3 (Berkeley) 3/28/94\r
- NetBSD: termios.h,v 1.29 2005/12/11 12:25:21 christos Exp\r
-**/\r
-#ifndef _SYS_TERMIOS_H_\r
-#define _SYS_TERMIOS_H_\r
-\r
-#include <sys/ansi.h>\r
-#include <sys/featuretest.h>\r
-\r
-/* Special Control Characters\r
- *\r
- * Index into c_cc[] character array.\r
- */\r
-typedef enum {\r
-/* Name Enabled by */\r
- VTABLEN, /* OXTABS - Length between TAB stops. */\r
- VEOF, /* ICANON */\r
- VEOL, /* ICANON */\r
- VERASE, /* ICANON */\r
- VKILL, /* ICANON */\r
- VINTR, /* ISIG */\r
- VQUIT, /* ISIG */\r
- VMIN, /* !ICANON */\r
- VTIME, /* !ICANON */\r
-\r
- /* Extensions from BSD and POSIX -- Not yet implemented for UEFI */\r
- VWERASE, /* IEXTEN, ICANON -- Erase the WORD to the left of the cursor */\r
- VREPRINT, /* IEXTEN, ICANON -- Re-draw the current line (input buffer) */\r
- VLNEXT, /* IEXTEN, ICANON -- Input the next character literally */\r
- VDISCARD, /* IEXTEN -- Toggle. Discards output display until toggled. */\r
-\r
- /* NCCS must always be the last member of this enum. */\r
- NCCS /* Number of control characters in c_cc[] */\r
-} CCC_INDEX;\r
-\r
-#define _POSIX_VDISABLE ((unsigned char)'\377')\r
-\r
-#define CCEQ(val, c) (c == val ? val != _POSIX_VDISABLE : 0)\r
-\r
-/*\r
- * Input flags - software input processing\r
- c_iflag\r
-*/\r
-#define INLCR 0x0001 /* map NL into CR */\r
-#define IGNCR 0x0002 /* ignore CR */\r
-#define ICRNL 0x0004 /* map CR to NL (ala CRMOD) */\r
-#define IGNSPEC 0x0008 /* Ignore function, control, and other non-printing special keys. */\r
-#ifdef HAVE_DA_SERIAL\r
- #define ISTRIP 0x0010 /* strip 8th bit off chars */\r
- #define IGNBRK 0x0020 /* ignore BREAK condition */\r
- #define BRKINT 0x0040 /* map BREAK to SIGINTR */\r
- #define IRESRV1 0x0080\r
- #define IGNPAR 0x0100 /* ignore (discard) parity errors */\r
- #define PARMRK 0x0200 /* mark parity and framing errors */\r
- #define INPCK 0x0400 /* enable checking of parity errors */\r
- #define IXON 0x0800 /* enable output flow control */\r
- #define IXOFF 0x1000 /* enable input flow control */\r
- #define IXANY 0x2000 /* any char will restart after stop */\r
-#endif /* HAVE_DA_SERIAL */\r
-\r
-/*\r
- * Output flags - software output processing\r
- c_oflag\r
- */\r
-#define OPOST 0x0001 /* enable following output processing */\r
-#define ONLCR 0x0002 /* map NL to CR-NL (ala CRMOD) */\r
-#define OXTABS 0x0004 /* expand tabs to spaces */\r
-#define ONOEOT 0x0008 /* discard EOT's (^D) on output */\r
-#define OCRNL 0x0010 /* map CR to NL */\r
-#define ONOCR 0x0020 /* discard CR's when on column 0 */\r
-#define ONLRET 0x0040 /* move to column 0 on CR */\r
-#define OCTRL 0x0080 /* Map control characters to the sequence ^C */\r
-\r
-/*\r
- * Control flags - hardware control of terminal\r
- c_cflag\r
- */\r
-#ifdef HAVE_DA_SERIAL\r
- #define CIGNORE 0x0001 /* ignore control flags */\r
- #define CSIZE 0x0300 /* character size mask */\r
- #define CS5 0x0000 /* 5 bits (pseudo) */\r
- #define CS6 0x0100 /* 6 bits */\r
- #define CS7 0x0200 /* 7 bits */\r
- #define CS8 0x0300 /* 8 bits */\r
- #define CSTOPB 0x0400 /* send 2 stop bits, else 1 */\r
- #define CREAD 0x0800 /* enable receiver */\r
- #define PARENB 0x1000 /* parity enable */\r
- #define PARODD 0x2000 /* odd parity, else even */\r
- #define HUPCL 0x4000 /* hang up on last close */\r
- #define CLOCAL 0x8000 /* ignore modem status lines */\r
-#endif\r
-\r
-\r
-/*\r
- * "Local" flags - dumping ground for other state\r
- *\r
- * Warning: some flags in this structure begin with\r
- * the letter "I" and look like they belong in the\r
- * input flag.\r
- */\r
-#define ECHO 0x0001 /* enable echoing */\r
-#define ECHOE 0x0002 /* visually erase chars */\r
-#define ECHOK 0x0004 /* echo NL after line kill */\r
-#define ECHONL 0x0008 /* echo NL even if ECHO is off */\r
-#define ISIG 0x0010 /* enable signals INTR, QUIT, [D]SUSP */\r
-#define ICANON 0x0020 /* canonicalize input lines */\r
-#define IEXTEN 0x0040 /* enable Extensions */\r
-#define SKIP_1 0x0100 /* Currently unused */\r
-#define TOSTOP 0x0200 /* stop background jobs on output */\r
-#define PENDIN 0x0400 /* re-echo input buffer at next read */\r
-#define NOFLSH 0x0800 /* don't flush output on signal */\r
-#define FLUSHO 0x1000 /* output being flushed (state) */\r
-\r
-typedef UINT8 cc_t;\r
-typedef UINT16 tcflag_t;\r
-typedef UINT32 speed_t;\r
-\r
-struct termios {\r
- INT32 c_ispeed; /* input speed - Use a signed type instead of speed_t */\r
- INT32 c_ospeed; /* output speed - to ease integer promotion when used. */\r
- tcflag_t c_iflag; /* input flags */\r
- tcflag_t c_oflag; /* output flags */\r
- tcflag_t c_cflag; /* control flags */\r
- tcflag_t c_lflag; /* local flags */\r
- cc_t c_cc[NCCS]; /* control chars */\r
-};\r
-\r
-/*\r
- * Commands passed to tcsetattr() for setting the termios structure.\r
- */\r
-#define TCSANOW 0 /* make change immediate */\r
-#define TCSADRAIN 1 /* drain output, then change */\r
-#define TCSAFLUSH 2 /* drain output, flush input */\r
-#define TCSASOFT 0x10 /* flag - don't alter h.w. state */\r
-\r
-/*\r
- * Standard speeds\r
- */\r
-#define B0 0\r
-#define B50 50\r
-#define B75 75\r
-#define B110 110\r
-#define B134 134\r
-#define B150 150\r
-#define B200 200\r
-#define B300 300\r
-#define B600 600\r
-#define B1200 1200\r
-#define B1800 1800\r
-#define B2400 2400\r
-#define B4800 4800\r
-#define B9600 9600\r
-#define B19200 19200\r
-#define B38400 38400\r
-\r
-// Extended speed definitions\r
-#define B7200 7200\r
-#define B14400 14400\r
-#define B28800 28800\r
-#define B57600 57600\r
-#define B76800 76800\r
-#define B115200 115200\r
-#define B230400 230400\r
-#define B460800 460800\r
-#define B921600 921600\r
-\r
-#define TCIFLUSH 1\r
-#define TCOFLUSH 2\r
-#define TCIOFLUSH 3\r
-#define TCOOFF 1\r
-#define TCOON 2\r
-#define TCIOFF 3\r
-#define TCION 4\r
-\r
-#include <sys/EfiCdefs.h>\r
-\r
-__BEGIN_DECLS\r
-\r
-/** Get input baud rate.\r
-\r
- Extracts the input baud rate from the termios structure pointed to by the\r
- pTermios argument.\r
-\r
- @param[in] pTermios A pointer to the termios structure from which to extract\r
- the input baud rate.\r
-\r
- @return The value of the input speed is returned exactly as it is contained\r
- in the termios structure, without interpretation.\r
-**/\r
-speed_t cfgetispeed (const struct termios *);\r
-\r
-/** Get output baud rate.\r
-\r
- Extracts the output baud rate from the termios structure pointed to by the\r
- pTermios argument.\r
-\r
- @param[in] pTermios A pointer to the termios structure from which to extract\r
- the output baud rate.\r
-\r
- @return The value of the output speed is returned exactly as it is contained\r
- in the termios structure, without interpretation.\r
-**/\r
-speed_t cfgetospeed (const struct termios *);\r
-\r
-/** Set input baud rate.\r
-\r
- Replaces the input baud rate, in the termios structure pointed to by the\r
- pTermios argument, with the value of NewSpeed.\r
-\r
- @param[out] pTermios A pointer to the termios structure into which to set\r
- the input baud rate.\r
- @param[in] NewSpeed The new input baud rate.\r
-\r
- @retval 0 The operation completed successfully.\r
- @retval -1 An error occured and errno is set to indicate the error.\r
- * EINVAL - The value of NewSpeed is outside the range of\r
- possible speed values as specified in <sys/termios.h>.\r
-**/\r
-int cfsetispeed (struct termios *, speed_t);\r
-\r
-/** Set output baud rate.\r
-\r
- Replaces the output baud rate, in the termios structure pointed to by the\r
- pTermios argument, with the value of NewSpeed.\r
-\r
- @param[out] pTermios A pointer to the termios structure into which to set\r
- the output baud rate.\r
- @param[in] NewSpeed The new output baud rate.\r
-\r
- @retval 0 The operation completed successfully.\r
- @retval -1 An error occured and errno is set to indicate the error.\r
- * EINVAL - The value of NewSpeed is outside the range of\r
- possible speed values as specified in <sys/termios.h>.\r
-**/\r
-int cfsetospeed (struct termios *, speed_t);\r
-\r
-/** Get the parameters associated with an interactive IO device.\r
-\r
- Get the parameters associated with the device referred to by\r
- fd and store them into the termios structure referenced by pTermios.\r
-\r
- @param[in] fd The file descriptor for an open interactive IO device.\r
- @param[out] pTermios A pointer to a termios structure into which to store\r
- attributes of the interactive IO device.\r
-\r
- @retval 0 The operation completed successfully.\r
- @retval -1 An error occured and errno is set to indicate the error.\r
- * EBADF - The fd argument is not a valid file descriptor.\r
- * ENOTTY - The file associated with fd is not an interactive IO device.\r
-**/\r
-int tcgetattr (int fd, struct termios *pTermios);\r
-\r
-/** Set the parameters associated with an interactive IO device.\r
-\r
- Set the parameters associated with the device referred to by\r
- fd to the values in the termios structure referenced by pTermios.\r
-\r
- Behavior is modified by the value of the OptAct parameter:\r
- * TCSANOW: The change shall occur immediately.\r
- * TCSADRAIN: The change shall occur after all output written to fd is\r
- transmitted. This action should be used when changing parameters which\r
- affect output.\r
- * TCSAFLUSH: The change shall occur after all output written to fd is\r
- transmitted, and all input so far received but not read shall be\r
- discarded before the change is made.\r
-\r
- @param[in] fd The file descriptor for an open interactive IO device.\r
- @param[in] OptAct Currently has no effect.\r
- @param[in] pTermios A pointer to a termios structure into which to retrieve\r
- attributes to set in the interactive IO device.\r
-\r
- @retval 0 The operation completed successfully.\r
- @retval -1 An error occured and errno is set to indicate the error.\r
- * EBADF - The fd argument is not a valid file descriptor.\r
- * ENOTTY - The file associated with fd is not an interactive IO device.\r
-**/\r
-int tcsetattr (int fd, int OptAct, const struct termios *pTermios);\r
-\r
-/** Transmit pending output.\r
-\r
-\r
- @param[in] fd The file descriptor for an open interactive IO device.\r
-\r
- @retval 0 The operation completed successfully.\r
- @retval -1 An error occured and errno is set to indicate the error.\r
- * EBADF - The fd argument is not a valid file descriptor.\r
- * ENOTTY - The file associated with fd is not an interactive IO device.\r
- * EINTR - A signal interrupted tcdrain().\r
- * ENOTSUP - This function is not supported.\r
-**/\r
-int tcdrain (int fd);\r
-\r
-/** Suspend or restart the transmission or reception of data.\r
-\r
- This function will suspend or resume transmission or reception of data on\r
- the file referred to by fd, depending on the value of Action.\r
-\r
- @param[in] fd The file descriptor of an open interactive IO device (terminal).\r
- @param[in] Action The action to be performed:\r
- * TCOOFF - Suspend output.\r
- * TCOON - Resume suspended output.\r
- * TCIOFF - If fd refers to an IIO device, transmit a\r
- STOP character, which is intended to cause the\r
- terminal device to stop transmitting data.\r
- * TCION - If fd refers to an IIO device, transmit a\r
- START character, which is intended to cause the\r
- terminal device to start transmitting data.\r
-\r
- @retval 0 The operation completed successfully.\r
- @retval -1 An error occured and errno is set to indicate the error.\r
- * EBADF - The fd argument is not a valid file descriptor.\r
- * ENOTTY - The file associated with fd is not an interactive IO device.\r
- * EINVAL - The Action argument is not a supported value.\r
- * ENOTSUP - This function is not supported.\r
-**/\r
-int tcflow (int fd, int Action);\r
-\r
-/** Discard non-transmitted output data, non-read input data, or both.\r
-\r
-\r
- @param[in] fd The file descriptor for an open interactive IO device.\r
- @param[in] QueueSelector The IO queue to be affected:\r
- * TCIFLUSH - If fd refers to a device open for input, flush\r
- pending input. Otherwise error EINVAL.\r
- * TCOFLUSH - If fd refers to a device open for output,\r
- flush pending output. Otherwise error EINVAL.\r
- * TCIOFLUSH - If fd refers to a device open for both\r
- input and output, flush pending input and output.\r
- Otherwise error EINVAL.\r
-\r
- @retval 0 The operation completed successfully.\r
- @retval -1 An error occured and errno is set to indicate the error.\r
- * EBADF - The fd argument is not a valid file descriptor.\r
- * ENOTTY - The file associated with fd is not an interactive IO device.\r
- * EINVAL - The QueueSelector argument is not a supported value.\r
- * ENOTSUP - This function is not supported.\r
-**/\r
-int tcflush (int fd, int QueueSelector);\r
-\r
-//int tcsendbreak (int, int);\r
-//pid_t tcgetsid (int);\r
-\r
-//void cfmakeraw (struct termios *);\r
-//int cfsetspeed (struct termios *, speed_t);\r
-__END_DECLS\r
-\r
-/* Input values for UEFI Keyboard Scan Codes.\r
-\r
- The UEFI Keyboard Scan Codes are mapped into the upper range of the Unicode\r
- Private Use Area so that the characters can be inserted into the input stream\r
- and treated the same as any other character.\r
-\r
- These values are only used for input. If these codes are output to the\r
- console, or another interactive I/O device, the behavior will depend upon\r
- the current locale and UEFI character set loaded.\r
-*/\r
-typedef enum {\r
- TtySpecKeyMin = 0xF7F0,\r
- /* This area is reserved for use by internal I/O software.\r
- At least 4 values must exist between TtySpecKeyMin and TtyFunKeyMin.\r
- */\r
- TtyFunKeyMin = 0xF7FA,\r
- TtyKeyEject = 0xF7FA,\r
- TtyRecovery, TtyToggleDisplay, TtyHibernate,\r
- TtySuspend, TtyBrightnessDown, TtyBrightnessUp,\r
- TtyVolumeDown = 0xF87F,\r
- TtyVolumeUp, TtyMute,\r
- TtyF24 = 0xF88D,\r
- TtyF23, TtyF22, TtyF21, TtyF20,\r
- TtyF19, TtyF18, TtyF17, TtyF16,\r
- TtyF15, TtyF14, TtyF13,\r
- TtyEscape = 0xF8E9,\r
- TtyF12, TtyF11, TtyF10, TtyF9,\r
- TtyF8, TtyF7, TtyF6, TtyF5,\r
- TtyF4, TtyF3, TtyF2, TtyF1,\r
- TtyPageDown, TtyPageUp, TtyDelete, TtyInsert,\r
- TtyEnd, TtyHome, TtyLeftArrow, TtyRightArrow,\r
- TtyDownArrow,\r
- TtyUpArrow = 0xF8FF,\r
- TtyFunKeyMax = 0xF900\r
-} TtyFunKey;\r
-\r
-// Non-UEFI character definitions\r
-#define CHAR_EOT 0x0004 /* End of Text (EOT) character -- Unix End-of-File character */\r
-#define CHAR_SUB 0x001a /* MSDOS End-of-File character */\r
-#define CHAR_ESC 0x001b /* Escape (ESC) character */\r
-\r
-#endif /* !_SYS_TERMIOS_H_ */\r