iPXE
SimpleTextIn.h
Go to the documentation of this file.
00001 /** @file
00002   Simple Text Input protocol from the UEFI 2.0 specification.
00003 
00004   Abstraction of a very simple input device like a keyboard or serial
00005   terminal.
00006 
00007   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
00008   This program and the accompanying materials
00009   are licensed and made available under the terms and conditions of the BSD License
00010   which accompanies this distribution.  The full text of the license may be found at
00011   http://opensource.org/licenses/bsd-license.php
00012 
00013   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00014   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00015 
00016 **/
00017 
00018 #ifndef __SIMPLE_TEXT_IN_PROTOCOL_H__
00019 #define __SIMPLE_TEXT_IN_PROTOCOL_H__
00020 
00021 FILE_LICENCE ( BSD3 );
00022 
00023 #define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
00024   { \
00025     0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
00026   }
00027 
00028 typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
00029 
00030 ///
00031 /// Protocol GUID name defined in EFI1.1.
00032 ///
00033 #define SIMPLE_INPUT_PROTOCOL   EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID
00034 
00035 ///
00036 /// Protocol name in EFI1.1 for backward-compatible.
00037 ///
00038 typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  SIMPLE_INPUT_INTERFACE;
00039 
00040 ///
00041 /// The keystroke information for the key that was pressed.
00042 ///
00043 typedef struct {
00044   UINT16  ScanCode;
00045   CHAR16  UnicodeChar;
00046 } EFI_INPUT_KEY;
00047 
00048 //
00049 // Required unicode control chars
00050 //
00051 #define CHAR_BACKSPACE        0x0008
00052 #define CHAR_TAB              0x0009
00053 #define CHAR_LINEFEED         0x000A
00054 #define CHAR_CARRIAGE_RETURN  0x000D
00055 
00056 //
00057 // EFI Scan codes
00058 //
00059 #define SCAN_NULL       0x0000
00060 #define SCAN_UP         0x0001
00061 #define SCAN_DOWN       0x0002
00062 #define SCAN_RIGHT      0x0003
00063 #define SCAN_LEFT       0x0004
00064 #define SCAN_HOME       0x0005
00065 #define SCAN_END        0x0006
00066 #define SCAN_INSERT     0x0007
00067 #define SCAN_DELETE     0x0008
00068 #define SCAN_PAGE_UP    0x0009
00069 #define SCAN_PAGE_DOWN  0x000A
00070 #define SCAN_F1         0x000B
00071 #define SCAN_F2         0x000C
00072 #define SCAN_F3         0x000D
00073 #define SCAN_F4         0x000E
00074 #define SCAN_F5         0x000F
00075 #define SCAN_F6         0x0010
00076 #define SCAN_F7         0x0011
00077 #define SCAN_F8         0x0012
00078 #define SCAN_F9         0x0013
00079 #define SCAN_F10        0x0014
00080 #define SCAN_ESC        0x0017
00081 
00082 /**
00083   Reset the input device and optionally run diagnostics
00084 
00085   @param  This                 Protocol instance pointer.
00086   @param  ExtendedVerification Driver may perform diagnostics on reset.
00087 
00088   @retval EFI_SUCCESS          The device was reset.
00089   @retval EFI_DEVICE_ERROR     The device is not functioning properly and could not be reset.
00090 
00091 **/
00092 typedef
00093 EFI_STATUS
00094 (EFIAPI *EFI_INPUT_RESET)(
00095   IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL       *This,
00096   IN BOOLEAN                              ExtendedVerification
00097   );
00098 
00099 /**
00100   Reads the next keystroke from the input device. The WaitForKey Event can
00101   be used to test for existence of a keystroke via WaitForEvent () call.
00102 
00103   @param  This  Protocol instance pointer.
00104   @param  Key   A pointer to a buffer that is filled in with the keystroke
00105                 information for the key that was pressed.
00106 
00107   @retval EFI_SUCCESS      The keystroke information was returned.
00108   @retval EFI_NOT_READY    There was no keystroke data available.
00109   @retval EFI_DEVICE_ERROR The keystroke information was not returned due to
00110                            hardware errors.
00111 
00112 **/
00113 typedef
00114 EFI_STATUS
00115 (EFIAPI *EFI_INPUT_READ_KEY)(
00116   IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL       *This,
00117   OUT EFI_INPUT_KEY                       *Key
00118   );
00119 
00120 ///
00121 /// The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
00122 /// It is the minimum required protocol for ConsoleIn.
00123 ///
00124 struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
00125   EFI_INPUT_RESET     Reset;
00126   EFI_INPUT_READ_KEY  ReadKeyStroke;
00127   ///
00128   /// Event to use with WaitForEvent() to wait for a key to be available
00129   ///
00130   EFI_EVENT           WaitForKey;
00131 };
00132 
00133 extern EFI_GUID gEfiSimpleTextInProtocolGuid;
00134 
00135 #endif