]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLibPrivateInternalFiles/Include/Device/IIO.h
StdLib: Add internal use only header for interactive I/O.
[mirror_edk2.git] / StdLibPrivateInternalFiles / Include / Device / IIO.h
diff --git a/StdLibPrivateInternalFiles/Include/Device/IIO.h b/StdLibPrivateInternalFiles/Include/Device/IIO.h
new file mode 100644 (file)
index 0000000..4eb3623
--- /dev/null
@@ -0,0 +1,81 @@
+/** @file\r
+  Constants and declarations for the Interactive IO library.\r
+\r
+  Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available\r
+  under the terms and conditions of the BSD License which accompanies this\r
+  distribution.  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
+#ifndef _INTERACTIVE_IO_H\r
+#define _INTERACTIVE_IO_H\r
+\r
+#include  <sys/EfiSysCall.h>\r
+#include  <sys/termios.h>\r
+#include  <Containers/Fifo.h>\r
+#include  <kfile.h>\r
+\r
+__BEGIN_DECLS\r
+\r
+typedef struct _IIO_Instance  cIIO;\r
+\r
+cIIO * EFIAPI New_cIIO(void);   // Creates a new cIIO structure\r
+\r
+/*  Types of Member functions of the TTY I/O "class". */\r
+typedef void    (EFIAPI *cIIO_Delete)    (cIIO *This);\r
+\r
+typedef ssize_t (EFIAPI *cIIO_Read)      (struct __filedes *filp, size_t BufferSize, VOID *Buffer);\r
+\r
+typedef ssize_t (EFIAPI *cIIO_Write)     (struct __filedes *filp, const char *buf, ssize_t n);\r
+\r
+typedef ssize_t (EFIAPI *cIIO_Echo)      (struct __filedes *filp, wchar_t EChar, BOOLEAN EchoIsOK);\r
+\r
+/** Structure defining an instance of the Interactive I/O "class".  **/\r
+struct _IIO_Instance {\r
+  /* ######## Public Functions ######## */\r
+  cIIO_Delete      Delete;\r
+  cIIO_Read        Read;\r
+  cIIO_Write       Write;\r
+  cIIO_Echo        Echo;\r
+\r
+  /* ######## PRIVATE Data ######## */\r
+\r
+  // Wide input buffer -- stdin\r
+  cFIFO          *InBuf;\r
+\r
+  // Wide output buffer -- stdout\r
+  cFIFO          *OutBuf;\r
+\r
+  // Attributes for characters in the output buffer\r
+  UINT8          *AttrBuf;\r
+\r
+  // Wide output buffer -- stderr\r
+  cFIFO          *ErrBuf;\r
+\r
+  // Character conversion states for the buffers\r
+  mbstate_t       OutState;\r
+  mbstate_t       ErrState;\r
+\r
+  //  Cursor position at beginning of operation\r
+  //  and at each character thereafter.\r
+  CURSOR_XY       InitialXY;\r
+  CURSOR_XY       CurrentXY;\r
+\r
+  UINTN           MaxColumn;    // Width of the output device\r
+  UINTN           MaxRow;       // Height of the output device\r
+\r
+  // termios structure\r
+  struct termios  Termio;\r
+};\r
+\r
+// Helper Functions\r
+ssize_t IIO_CanonRead     (struct __filedes *filp);\r
+ssize_t IIO_NonCanonRead  (struct __filedes *filp);\r
+ssize_t IIO_WriteOne      (struct __filedes *filp, cFIFO *Buf, wchar_t InCh);\r
+ssize_t IIO_EchoOne       (struct __filedes *filp, wchar_t InCh, BOOLEAN EchoIsOK);\r
+\r
+__END_DECLS\r
+#endif  /* _INTERACTIVE_IO_H */\r