From: darylm503 Date: Tue, 11 Dec 2012 21:03:57 +0000 (+0000) Subject: StdLib: Add internal use only header for interactive I/O. X-Git-Tag: edk2-stable201903~12846 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=e575c101d866bb895ac2fab538bc2ed074163af3;p=mirror_edk2.git StdLib: Add internal use only header for interactive I/O. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com Reviewed-by: leroy.p.leahy@intel.com Reviewed-by: lee.g.rosenbaum@intel.com Reviewed-by: jaben.carsey@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13988 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/StdLibPrivateInternalFiles/Include/Device/IIO.h b/StdLibPrivateInternalFiles/Include/Device/IIO.h new file mode 100644 index 0000000000..4eb3623cdc --- /dev/null +++ b/StdLibPrivateInternalFiles/Include/Device/IIO.h @@ -0,0 +1,81 @@ +/** @file + Constants and declarations for the Interactive IO library. + + Copyright (c) 2012, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +**/ +#ifndef _INTERACTIVE_IO_H +#define _INTERACTIVE_IO_H + +#include +#include +#include +#include + +__BEGIN_DECLS + +typedef struct _IIO_Instance cIIO; + +cIIO * EFIAPI New_cIIO(void); // Creates a new cIIO structure + +/* Types of Member functions of the TTY I/O "class". */ +typedef void (EFIAPI *cIIO_Delete) (cIIO *This); + +typedef ssize_t (EFIAPI *cIIO_Read) (struct __filedes *filp, size_t BufferSize, VOID *Buffer); + +typedef ssize_t (EFIAPI *cIIO_Write) (struct __filedes *filp, const char *buf, ssize_t n); + +typedef ssize_t (EFIAPI *cIIO_Echo) (struct __filedes *filp, wchar_t EChar, BOOLEAN EchoIsOK); + +/** Structure defining an instance of the Interactive I/O "class". **/ +struct _IIO_Instance { + /* ######## Public Functions ######## */ + cIIO_Delete Delete; + cIIO_Read Read; + cIIO_Write Write; + cIIO_Echo Echo; + + /* ######## PRIVATE Data ######## */ + + // Wide input buffer -- stdin + cFIFO *InBuf; + + // Wide output buffer -- stdout + cFIFO *OutBuf; + + // Attributes for characters in the output buffer + UINT8 *AttrBuf; + + // Wide output buffer -- stderr + cFIFO *ErrBuf; + + // Character conversion states for the buffers + mbstate_t OutState; + mbstate_t ErrState; + + // Cursor position at beginning of operation + // and at each character thereafter. + CURSOR_XY InitialXY; + CURSOR_XY CurrentXY; + + UINTN MaxColumn; // Width of the output device + UINTN MaxRow; // Height of the output device + + // termios structure + struct termios Termio; +}; + +// Helper Functions +ssize_t IIO_CanonRead (struct __filedes *filp); +ssize_t IIO_NonCanonRead (struct __filedes *filp); +ssize_t IIO_WriteOne (struct __filedes *filp, cFIFO *Buf, wchar_t InCh); +ssize_t IIO_EchoOne (struct __filedes *filp, wchar_t InCh, BOOLEAN EchoIsOK); + +__END_DECLS +#endif /* _INTERACTIVE_IO_H */