]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLibPrivateInternalFiles/Include/Efi/Console.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLibPrivateInternalFiles / Include / Efi / Console.h
diff --git a/StdLibPrivateInternalFiles/Include/Efi/Console.h b/StdLibPrivateInternalFiles/Include/Efi/Console.h
new file mode 100644 (file)
index 0000000..8678658
--- /dev/null
@@ -0,0 +1,81 @@
+/** @file\r
+  Declarations and macros for the console abstraction.\r
+\r
+  Copyright (c) 2010, 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.php.\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
+#ifndef _LIBRARY_UEFI_CONSOLE_H\r
+#define _LIBRARY_UEFI_CONSOLE_H\r
+#include  <Protocol/SimpleTextOut.h>\r
+#include  <Protocol/SimpleFileSystem.h>\r
+\r
+/* The number of "special" character stream devices.\r
+   These include:\r
+    stdin, stdout, stderr\r
+*/\r
+#define NUM_SPECIAL   3\r
+\r
+typedef struct {\r
+  UINT32    Column;\r
+  UINT32    Row;\r
+} CursorXY;\r
+\r
+typedef union {\r
+  UINT64      Offset;\r
+  CursorXY    XYpos;\r
+} XYoffset;\r
+\r
+/**\r
+  In support of the "everything is a file" paradigm of the Standard C Library,\r
+  the UEFI Console support is abstracted as an instance of EFI_FILE_PROTOCOL.\r
+  The member functions of the protocol translate as:\r
+    Open      Associates a stream with one of the pseudo-devices: stdin,\r
+              stdout, or stderr; as defined by the UEFI System Table.\r
+    Close     The stream is marked closed and released for use by a\r
+              subsequent Open().\r
+    Delete    Returns RETURN_UNSUPPORTED.  Does Nothing.\r
+    Read      Blocks reading BufferSize characters using the\r
+              EFI_SIMPLE_TEXT_INPUT_PROTOCOL::ReadKeyStroke() function.\r
+    Write     Sends BufferSize characters to the console for display.  The\r
+              output is examined for new line characters, '\n', which are then\r
+              translated into a Return + New Line, '\r' '\n', sequence.\r
+    GetPosition   Returns the number of characters input or output to this\r
+                  stream.  Return, '\r', characters inserted due to line ending\r
+                  translation are not counted.\r
+    SetPosition   Only valid for Stdout or Stderr.  Offset is interpreted as a\r
+                  CursorXY structure and is used to position the console cursor\r
+                  using the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::SetCursorPosition()\r
+                  call.\r
+    GetInfo   Populates an EFI_FILE_INFO Buffer with no useful information.\r
+    SetInfo   Returns RETURN_UNSUPPORTED.  Does Nothing.\r
+    Flush     Returns RETURN_SUCCESS.  Does Nothing.\r
+\r
+**/\r
+typedef struct {\r
+  UINT32                      Cookie;\r
+  UINT32                      ConOutMode;   // Only valid for stdout & stderr\r
+  UINT64                      NumRead;\r
+  UINT64                      NumWritten;\r
+  XYoffset                    MaxConXY;     // Only valid for stdout & stderr\r
+  EFI_HANDLE                  Dev;          // Could be either Input or Output\r
+  EFI_FILE_PROTOCOL           Abstraction;\r
+} ConInstance;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ConOpen(\r
+  IN  EFI_FILE_PROTOCOL        *This,\r
+  OUT EFI_FILE_PROTOCOL       **NewHandle,\r
+  IN  CHAR16                   *FileName,\r
+  IN  UINT64                    OpenMode,\r
+  IN  UINT64                    Attributes\r
+);\r
+\r
+#endif  /* _LIBRARY_UEFI_CONSOLE_H */\r