]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib/Include: Minor changes in preparation for Interactive I/O (TTY) functionality.
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 25 Sep 2012 22:01:58 +0000 (22:01 +0000)
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 25 Sep 2012 22:01:58 +0000 (22:01 +0000)
StdLib/Include/
  stdlib.h
    Update MB_CUR_MAX to 3, the max. size of a MBCS character.
    Improve comments for wcstombs()
    Declare implementation-specific MBCS utility functions:
      OneWcToMcLen()    Determine the number of bytes needed to represent
                        a Wide character as a MBCS character.
      EstimateWtoM()    Determine the number of bytes needed to represent
                        a Wide character string as a MBCS string.
      CountMbcsChars()  Determine the number of characters in a MBCS string.

  wchar.h
    Improve comments.

StdLib/Include/sys/
  fcntl.h
    Define new Open flags.
    Remove obsolete and commented-out lines.

  termios.h
    Add Intel Copyright notice and Open-Source License.
    Change c_cc index macros into enumerated values.
    Clean up flag definitions for visual alignment as well as UEFI relevance.
    Move c_ispeed and c_ospeed termios members to end for better alignment.
    Comment out declarations for functions not yet implemented.
    Add an enum defining values for the UEFI extended function keys.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: erik.c.bjorge@intel.com
Reviewed-by: jaben.carsey@intel.com
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13741 6f19259b-4bc3-4df7-8a09-765794883524

StdLib/Include/stdlib.h
StdLib/Include/sys/fcntl.h
StdLib/Include/sys/termios.h
StdLib/Include/wchar.h

index 1166847867295764ed9e9d5a963ff32289f784f1..0b9dfd34b03ab82546fbf5aa5ceceb21170b52b4 100644 (file)
                                      char ** __restrict endptr);\r
   @endverbatim\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2012, 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
@@ -166,8 +166,11 @@ typedef struct {
     maximum number of bytes in a multibyte character for the extended character\r
     set specified by the current locale (category LC_CTYPE), which is never\r
     greater than MB_LEN_MAX.\r
+\r
+    Since UEFI only supports the Unicode Base Multilingual Plane (BMP),\r
+    correctly formed characters will only produce 1, 2, or 3-byte UTF-8 characters.\r
 **/\r
-#define MB_CUR_MAX  2\r
+#define MB_CUR_MAX  3\r
 \r
 /** Maximum number of functions that can be registered by atexit.\r
 \r
@@ -845,7 +848,7 @@ size_t  mbstowcs(wchar_t * __restrict Dest, const char * __restrict Src, size_t
 \r
     @param[out]   Dest    Pointer to the array to receive the converted string.\r
     @param[in]    Src     Pointer to the string to be converted.\r
-    @param[in]    Limit   Maximum number of elements to be written to Dest.\r
+    @param[in]    Limit   Maximum number of bytes to be written to Dest.\r
 \r
     @return   If a wide character is encountered that does not correspond to a\r
               valid multibyte character, the wcstombs function returns\r
@@ -855,7 +858,7 @@ size_t  mbstowcs(wchar_t * __restrict Dest, const char * __restrict Src, size_t
 **/\r
 size_t  wcstombs(char * __restrict Dest, const wchar_t * __restrict Src, size_t Limit);\r
 \r
-/* ################  Miscelaneous functions for *nix compatibility  ########## */\r
+/* ##############  Miscelaneous functions for *nix compatibility  ########## */\r
 \r
 /** The realpath() function shall derive, from the pathname pointed to by\r
     file_name, an absolute pathname that names the same file, whose resolution\r
@@ -890,6 +893,59 @@ const char * getprogname(void);
 **/\r
 void setprogname(const char *progname);\r
 \r
+/* ###############  Functions specific to this implementation  ############# */\r
+\r
+/*  Determine the number of bytes needed to represent a Wide character\r
+    as a MBCS character.\r
+\r
+    A single wide character may convert into a one, two, three, or four byte\r
+    narrow (MBCS or UTF-8) character.  The number of MBCS bytes can be determined\r
+    as follows.\r
+\r
+    If WCS char      < 0x00000080      One Byte\r
+    Else if WCS char < 0x0000D800      Two Bytes\r
+    Else                               Three Bytes\r
+\r
+    Since UEFI only supports the Unicode Base Multilingual Plane (BMP),\r
+    Four-byte characters are not supported.\r
+\r
+    @param[in]    InCh      Wide character to test.\r
+\r
+    @retval     -1      Improperly formed character\r
+    @retval      0      InCh is 0x0000\r
+    @retval     >0      Number of bytes needed for the MBCS character\r
+*/\r
+int\r
+EFIAPI\r
+OneWcToMcLen(const wchar_t InCh);\r
+\r
+/*  Determine the number of bytes needed to represent a Wide character string\r
+    as a MBCS string of given maximum length.  Will optionally return the number\r
+    of wide characters that would be consumed.\r
+\r
+    @param[in]    Src       Pointer to a wide character string.\r
+    @param[in]    Limit     Maximum number of bytes the converted string may occupy.\r
+    @param[out]   NumChar   Pointer to where to store the number of wide characters, or NULL.\r
+\r
+    @return     The number of bytes required to convert Src to MBCS,\r
+                not including the terminating NUL.  If NumChar is not NULL, the number\r
+                of characters represented by the return value will be written to\r
+                where it points.\r
+**/\r
+size_t\r
+EFIAPI\r
+EstimateWtoM(const wchar_t * Src, size_t Limit, size_t *NumChar);\r
+\r
+/** Determine the number of characters in a MBCS string.\r
+\r
+    @param[in]    Src     The string to examine\r
+\r
+    @return   The number of characters represented by the MBCS string.\r
+**/\r
+size_t\r
+EFIAPI\r
+CountMbcsChars(const char *Src);\r
+\r
 __END_DECLS\r
 \r
 #endif  /* _STDLIB_H */\r
index b91792f9f7aa550c81c44fe992170a07eea5e91a..819461b492ef5d96fa44ba28aa6fb91f36769f52 100644 (file)
@@ -2,7 +2,7 @@
     This file includes the definitions for open and fcntl described by POSIX\r
     for <fcntl.h>; it also includes related kernel definitions.\r
 \r
-    Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+    Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
     This program and the accompanying materials are licensed and made\r
     available under the terms and conditions of the BSD License which\r
     accompanies this distribution.  The full text of the license may be found\r
 #define O_TRUNC     0x00000400  ///< truncate to zero length\r
 #define O_EXCL      0x00000800  ///< error if already exists\r
 \r
+#define O_DIRECTORY 0x00001000  ///< error if path is not a directory\r
+#define O_NOCTTY    0x00002000  ///< Don't make this the controlling TTY\r
+#define O_TTY_INIT  0x00004000  ///< Initialize TTY to "sane" values on open\r
+\r
 /* UEFI-specific open-only flags. */\r
 #define O_HIDDEN    0x00010000  ///< Hidden file attribute\r
 #define O_SYSTEM    0x00020000  ///< System file attribute\r
 #define O_ARCHIVE   0x00040000  ///< Archive file attribute\r
 /// @}\r
 \r
-//#define O_DIRECT    0x00080000  /* direct I/O hint */\r
-\r
 #define O_SETMASK     0x0000000F  ///< Flags modifiable by F_SETFD (fcntl)\r
 \r
 /*\r
index b1373dea2b549e83c5c749d24fd9a7245f29a2d2..13e15d2fad4888bcef6ed7ced92ee8a184525f0d 100644 (file)
@@ -1,6 +1,16 @@
-/*  $NetBSD: termios.h,v 1.29 2005/12/11 12:25:21 christos Exp $  */\r
+/** @file\r
+    Macros and declarations for terminal oriented ioctls and\r
+    I/O discipline.\r
+\r
+    Copyright (c) 2012, 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
-/*\r
  * Copyright (c) 1988, 1989, 1993, 1994\r
  *  The Regents of the University of California.  All rights reserved.\r
  *\r
  * SUCH DAMAGE.\r
  *\r
  *  @(#)termios.h 8.3 (Berkeley) 3/28/94\r
- */\r
-\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
-/*\r
- * Special Control Characters\r
+/*  Special Control Characters\r
  *\r
  * Index into c_cc[] character array.\r
- *\r
- *  Name       Subscript  Enabled by\r
  */\r
-#define VEOF    0 /* ICANON */\r
-#define VEOL    1 /* ICANON */\r
-#if defined(_NETBSD_SOURCE)\r
-#define VEOL2   2 /* ICANON */\r
-#endif\r
-#define VERASE    3 /* ICANON */\r
-#if defined(_NETBSD_SOURCE)\r
-#define VWERASE   4 /* ICANON */\r
-#endif\r
-#define VKILL   5 /* ICANON */\r
-#if defined(_NETBSD_SOURCE)\r
-#define VREPRINT  6 /* ICANON */\r
-#endif\r
-/*      7    spare 1 */\r
-#define VINTR   8 /* ISIG */\r
-#define VQUIT   9 /* ISIG */\r
-#define VSUSP   10  /* ISIG */\r
-#if defined(_NETBSD_SOURCE)\r
-#define VDSUSP    11  /* ISIG */\r
-#endif\r
-#define VSTART    12  /* IXON, IXOFF */\r
-#define VSTOP   13  /* IXON, IXOFF */\r
-#if defined(_NETBSD_SOURCE)\r
-#define VLNEXT    14  /* IEXTEN */\r
-#define VDISCARD  15  /* IEXTEN */\r
-#endif\r
-#define VMIN    16  /* !ICANON */\r
-#define VTIME   17  /* !ICANON */\r
-#if defined(_NETBSD_SOURCE)\r
-#define VSTATUS   18  /* ICANON */\r
-/*      19     spare 2 */\r
-#endif\r
-#define NCCS    20\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
-#if defined(_NETBSD_SOURCE)\r
 #define CCEQ(val, c)  (c == val ? val != _POSIX_VDISABLE : 0)\r
-#endif\r
 \r
 /*\r
  * Input flags - software input processing\r
- */\r
-#define IGNBRK    0x00000001  /* ignore BREAK condition */\r
-#define BRKINT    0x00000002  /* map BREAK to SIGINTR */\r
-#define IGNPAR    0x00000004  /* ignore (discard) parity errors */\r
-#define PARMRK    0x00000008  /* mark parity and framing errors */\r
-#define INPCK   0x00000010  /* enable checking of parity errors */\r
-#define ISTRIP    0x00000020  /* strip 8th bit off chars */\r
-#define INLCR   0x00000040  /* map NL into CR */\r
-#define IGNCR   0x00000080  /* ignore CR */\r
-#define ICRNL   0x00000100  /* map CR to NL (ala CRMOD) */\r
-#define IXON    0x00000200  /* enable output flow control */\r
-#define IXOFF   0x00000400  /* enable input flow control */\r
-#if defined(_NETBSD_SOURCE)\r
-#define IXANY   0x00000800  /* any char will restart after stop */\r
-#endif\r
-#if defined(_NETBSD_SOURCE)\r
-#define IMAXBEL   0x00002000  /* ring bell on input queue full */\r
-#endif\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   0x00000001  /* enable following output processing */\r
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
-#define ONLCR   0x00000002  /* map NL to CR-NL (ala CRMOD) */\r
-#endif\r
-#if defined(_NETBSD_SOURCE)\r
-#define OXTABS    0x00000004  /* expand tabs to spaces */\r
-#define ONOEOT    0x00000008  /* discard EOT's (^D) on output */\r
-#endif\r
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
-#define OCRNL   0x00000010  /* map CR to NL */\r
-#define ONOCR   0x00000020  /* discard CR's when on column 0 */\r
-#define ONLRET    0x00000040  /* move to column 0 on CR */\r
-#endif  /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */\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
-#if defined(_NETBSD_SOURCE)\r
-#define CIGNORE   0x00000001  /* ignore control flags */\r
-#endif\r
-#define CSIZE   0x00000300  /* character size mask */\r
-#define     CS5       0x00000000      /* 5 bits (pseudo) */\r
-#define     CS6       0x00000100      /* 6 bits */\r
-#define     CS7       0x00000200      /* 7 bits */\r
-#define     CS8       0x00000300      /* 8 bits */\r
-#define CSTOPB    0x00000400  /* send 2 stop bits */\r
-#define CREAD   0x00000800  /* enable receiver */\r
-#define PARENB    0x00001000  /* parity enable */\r
-#define PARODD    0x00002000  /* odd parity, else even */\r
-#define HUPCL   0x00004000  /* hang up on last close */\r
-#define CLOCAL    0x00008000  /* ignore modem status lines */\r
-#if defined(_NETBSD_SOURCE)\r
-#define CRTSCTS   0x00010000  /* RTS/CTS full-duplex flow control */\r
-#define CRTS_IFLOW  CRTSCTS   /* XXX compat */\r
-#define CCTS_OFLOW  CRTSCTS   /* XXX compat */\r
-#define CDTRCTS   0x00020000  /* DTR/CTS full-duplex flow control */\r
-#define MDMBUF    0x00100000  /* DTR/DCD hardware flow control */\r
-#define CHWFLOW   (MDMBUF|CRTSCTS|CDTRCTS) /* all types of hw flow control */\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
  * 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
-#if defined(_NETBSD_SOURCE)\r
-#define ECHOKE    0x00000001  /* visual erase for line kill */\r
-#endif\r
-#define ECHOE   0x00000002  /* visually erase chars */\r
-#define ECHOK   0x00000004  /* echo NL after line kill */\r
-#define ECHO    0x00000008  /* enable echoing */\r
-#define ECHONL    0x00000010  /* echo NL even if ECHO is off */\r
-#if defined(_NETBSD_SOURCE)\r
-#define ECHOPRT   0x00000020  /* visual erase mode for hardcopy */\r
-#define ECHOCTL   0x00000040  /* echo control chars as ^(Char) */\r
-#endif  /* defined(_NETBSD_SOURCE) */\r
-#define ISIG    0x00000080  /* enable signals INTR, QUIT, [D]SUSP */\r
-#define ICANON    0x00000100  /* canonicalize input lines */\r
-#if defined(_NETBSD_SOURCE)\r
-#define ALTWERASE 0x00000200  /* use alternate WERASE algorithm */\r
-#endif /* defined(_NETBSD_SOURCE) */\r
-#define IEXTEN    0x00000400  /* enable DISCARD and LNEXT */\r
-#if defined(_NETBSD_SOURCE)\r
-#define EXTPROC         0x00000800      /* external processing */\r
-#endif /* defined(_NETBSD_SOURCE) */\r
-#define TOSTOP    0x00400000  /* stop background jobs on output */\r
-#if defined(_NETBSD_SOURCE)\r
-#define FLUSHO    0x00800000  /* output being flushed (state) */\r
-#define NOKERNINFO  0x02000000  /* no kernel output from VSTATUS */\r
-#define PENDIN    0x20000000  /* re-echo input buffer at next read */\r
-#endif /* defined(_NETBSD_SOURCE) */\r
-#define NOFLSH    0x80000000  /* don't flush output on signal */\r
-\r
-typedef unsigned int  tcflag_t;\r
-typedef unsigned char cc_t;\r
-typedef unsigned int  speed_t;\r
+typedef INT8    cc_t;\r
+typedef UINT16  tcflag_t;\r
+typedef UINT32  speed_t;\r
 \r
 struct termios {\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
-  int   c_ispeed; /* input speed */\r
-  int   c_ospeed; /* output speed */\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
-#if defined(_NETBSD_SOURCE)\r
-#define TCSASOFT  0x10    /* flag - don't alter h.w. state */\r
-#endif\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
-#if defined(_NETBSD_SOURCE)\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
-#define EXTA  19200\r
-#define EXTB  38400\r
-#endif  /* defined(_NETBSD_SOURCE) */\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
-#ifndef _KERNEL\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 TCOON     2\r
 #define TCIOFF    3\r
-#define TCION   4\r
+#define TCION     4\r
 \r
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
-#ifndef pid_t\r
-typedef __pid_t   pid_t;\r
-#define pid_t   __pid_t\r
-#endif\r
-#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */\r
 #include <sys/EfiCdefs.h>\r
 \r
 __BEGIN_DECLS\r
-speed_t cfgetispeed(const struct termios *);\r
-speed_t cfgetospeed(const struct termios *);\r
-int cfsetispeed(struct termios *, speed_t);\r
-int cfsetospeed(struct termios *, speed_t);\r
-int tcgetattr(int, struct termios *);\r
-int tcsetattr(int, int, const struct termios *);\r
-int tcdrain(int);\r
-int tcflow(int, int);\r
-int tcflush(int, int);\r
-int tcsendbreak(int, int);\r
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
-pid_t tcgetsid(int);\r
-#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */\r
+speed_t cfgetispeed (const struct termios *);\r
+speed_t cfgetospeed (const struct termios *);\r
+int     cfsetispeed (struct termios *, speed_t);\r
+int     cfsetospeed (struct termios *, speed_t);\r
+int     tcgetattr   (int, struct termios *);\r
+int     tcsetattr   (int, int, const struct termios *);\r
+int     tcdrain     (int);\r
+int     tcflow      (int, int);\r
+int     tcflush     (int, int);\r
+//int     tcsendbreak (int, int);\r
+//pid_t   tcgetsid    (int);\r
 \r
 \r
-#if defined(_NETBSD_SOURCE)\r
-void  cfmakeraw(struct termios *);\r
-int cfsetspeed(struct termios *, speed_t);\r
-#endif /* defined(_NETBSD_SOURCE) */\r
+//void    cfmakeraw   (struct termios *);\r
+//int     cfsetspeed  (struct termios *, speed_t);\r
 __END_DECLS\r
 \r
-#endif /* !_KERNEL */\r
+/*  Input values for UEFI Keyboard Scan Codes.\r
 \r
-#if defined(_NETBSD_SOURCE)\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
-/*\r
- * Include tty ioctl's that aren't just for backwards compatibility\r
- * with the old tty driver.  These ioctl definitions were previously\r
- * in <sys/ioctl.h>.\r
- */\r
-//#include <sys/ttycom.h>\r
-#endif\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
-/*\r
- * END OF PROTECTED INCLUDE.\r
- */\r
-#endif /* !_SYS_TERMIOS_H_ */\r
+// Non-UEFI character definitions\r
+#define CHAR_EOT    0x0004        /* End of Text (EOT) character */\r
 \r
-#if defined(_NETBSD_SOURCE)\r
-//#include <sys/ttydefaults.h>\r
-#endif\r
+#endif /* !_SYS_TERMIOS_H_ */\r
index b53ee24939570a4855c08ad38aa20ebfe9c0945a..2c9ec6e5e784417174c862b107e003747a78abdb 100644 (file)
@@ -1415,10 +1415,16 @@ int mbsinit(const mbstate_t *ps);
     where internal is the mbstate_t object for the mbrlen function, except that\r
     the expression designated by ps is evaluated only once.\r
 \r
-    @return   The mbrlen function returns a value between zero and n,\r
-              inclusive, (size_t)(-2), or (size_t)(-1).\r
+    @param[in]  s     Pointer to a multibyte character sequence.\r
+    @param[in]  n     Maximum number of bytes to examine.\r
+    @param[in]  pS    Pointer to the conversion state object.\r
+\r
+    @retval   0       The next n or fewer characters complete a NUL.\r
+    @retval   1..n    The number of bytes that complete the multibyte character.\r
+    @retval   -2      The next n bytes contribute to an incomplete (but potentially valid) multibyte character.\r
+    @retval   -1      An encoding error occurred.\r
 **/\r
-size_t mbrlen(const char * __restrict S, size_t n, mbstate_t * __restrict ps);\r
+size_t mbrlen(const char * __restrict S, size_t n, mbstate_t * __restrict pS);\r
 \r
 /** Restartable Multibyte to Wide character conversion.\r
 If S is a null pointer, the mbrtowc function is equivalent to the call:<BR>\r