audk/StdLibPrivateInternalFiles/Include/Device/Console.h

54 lines
2.2 KiB
C
Raw Normal View History

/** @file
Declarations and macros for the console abstraction.
StdLib: Some deployed versions of the Simple Text Input Protocol randomly return either NUL characters or Scan Codes when just typing normal text. These changes filter out NUL characters and make Scan Code and error handling more robust. StdLibPrivateInternalFiles/Include/Device/Console.h: Change UnGetKey, in the ConInstance structure, from an EFI_INPUT_KEY structure to a CHAR16 variable. Include/sys/termios.h: Add CHAR_SUB and CHAR_ESC for translation of '^Z' and the Escape Scan Code into the EOF and ESC characters, respectively. LibC/Uefi/Devices/Console/daConsole.c: Add da_ConRawRead() function to simplify the read logic. Discard NUL characters from the input stream. In Blocking mode, retry until a non-NUL character is received. In NonBlocking mode, a NUL causes an EAGAIN error to be returned. Translate the Escape Scan Code into an ESC character. If Scan Codes are ignored, retry if in Blocking mode else return an EAGAIN error. UnGetKey becomes a single wide character instead of a structure. Change da_Poll() to use da_ConRawRead(). LibC/Uefi/InteractiveIO/IIOutilities.c: BUG fix. Return the processed input character instead of the raw character. Allows EOF propagation. LibC/Uefi/InteractiveIO/CanonRead.c: Enable EOF propagation. LibC/Uefi/InteractiveIO/IIOechoCtrl.h: Use symbols defined in termios.h instead of hard-coded constant numbers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16254 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-28 20:20:48 +01:00
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
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.
Depends on <kfile.h>, <Device/Device.h>, <Protocol/SimpleTextIn.h>, <Uefi/UefiBaseType.h>
**/
#ifndef _DEVICE_UEFI_CONSOLE_H
#define _DEVICE_UEFI_CONSOLE_H
#include <kfile.h>
#include <Device/Device.h>
/* The members Cookie through Abstraction, inclusive, are the same type and order
for all instance structures.
All instance structures must be a multiple of sizeof(UINTN) bytes long
*/
typedef struct {
UINT32 Cookie; ///< Special value identifying this as a valid ConInstance
UINT32 InstanceNum; ///< Which instance is this? Zero-based.
EFI_HANDLE Dev; ///< Pointer to either Input or Output Protocol.
DeviceNode *Parent; ///< Points to the parent Device Node.
struct fileops Abstraction; ///< Pointers to functions implementing this device's abstraction.
UINTN Reserved_1; // Ensure that next member starts on an 8-byte boundary
UINT64 NumRead; ///< Number of characters Read.
UINT64 NumWritten; ///< Number of characters Written.
__mbstate_t CharState; ///< Character state for the byte stream passing through this device
StdLib: Some deployed versions of the Simple Text Input Protocol randomly return either NUL characters or Scan Codes when just typing normal text. These changes filter out NUL characters and make Scan Code and error handling more robust. StdLibPrivateInternalFiles/Include/Device/Console.h: Change UnGetKey, in the ConInstance structure, from an EFI_INPUT_KEY structure to a CHAR16 variable. Include/sys/termios.h: Add CHAR_SUB and CHAR_ESC for translation of '^Z' and the Escape Scan Code into the EOF and ESC characters, respectively. LibC/Uefi/Devices/Console/daConsole.c: Add da_ConRawRead() function to simplify the read logic. Discard NUL characters from the input stream. In Blocking mode, retry until a non-NUL character is received. In NonBlocking mode, a NUL causes an EAGAIN error to be returned. Translate the Escape Scan Code into an ESC character. If Scan Codes are ignored, retry if in Blocking mode else return an EAGAIN error. UnGetKey becomes a single wide character instead of a structure. Change da_Poll() to use da_ConRawRead(). LibC/Uefi/InteractiveIO/IIOutilities.c: BUG fix. Return the processed input character instead of the raw character. Allows EOF propagation. LibC/Uefi/InteractiveIO/CanonRead.c: Enable EOF propagation. LibC/Uefi/InteractiveIO/IIOechoCtrl.h: Use symbols defined in termios.h instead of hard-coded constant numbers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16254 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-28 20:20:48 +01:00
CHAR16 UnGetKey; ///< One-key pushback, for poll().
} ConInstance;
__BEGIN_DECLS
int
EFIAPI
da_ConOpen(
IN DeviceNode *DevNode,
IN struct __filedes *filp,
IN int DevInstance,
IN CHAR16 *Path,
IN CHAR16 *MPath
);
__END_DECLS
#endif /* _DEVICE_UEFI_CONSOLE_H */