]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/sys/termios.h
StdLib: Clarify and improve comments.
[mirror_edk2.git] / StdLib / Include / sys / termios.h
index 13e15d2fad4888bcef6ed7ced92ee8a184525f0d..75886065b7744c3b1d9f9dcfbf54e394d22e2956 100644 (file)
@@ -2,7 +2,8 @@
     Macros and declarations for terminal oriented ioctls and\r
     I/O discipline.\r
 \r
-    Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\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
@@ -215,19 +216,171 @@ struct termios {
 #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
-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
+\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
-\r
 //void    cfmakeraw   (struct termios *);\r
 //int     cfsetspeed  (struct termios *, speed_t);\r
 __END_DECLS\r
@@ -269,6 +422,8 @@ typedef enum {
 } TtyFunKey;\r
 \r
 // Non-UEFI character definitions\r
-#define CHAR_EOT    0x0004        /* End of Text (EOT) character */\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