1314879Simp/** @file
2314879Simp  Simple Text Input protocol from the UEFI 2.0 specification.
3314879Simp
4314879Simp  Abstraction of a very simple input device like a keyboard or serial
5314879Simp  terminal.
6314879Simp
7314879Simp  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
8314879Simp  This program and the accompanying materials
9314879Simp  are licensed and made available under the terms and conditions of the BSD License
10314879Simp  which accompanies this distribution.  The full text of the license may be found at
11314879Simp  http://opensource.org/licenses/bsd-license.php
12314879Simp
13314879Simp  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14314879Simp  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15314879Simp
16314879Simp**/
17314879Simp
18314879Simp#ifndef __SIMPLE_TEXT_IN_PROTOCOL_H__
19314879Simp#define __SIMPLE_TEXT_IN_PROTOCOL_H__
20314879Simp
21314879Simp#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
22314879Simp  { \
23314879Simp    0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
24314879Simp  }
25314879Simp
26314879Simptypedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
27314879Simp
28314879Simp///
29314879Simp/// Protocol GUID name defined in EFI1.1.
30314879Simp///
31314879Simp#define SIMPLE_INPUT_PROTOCOL   EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID
32314879Simp
33314879Simp///
34314879Simp/// Protocol name in EFI1.1 for backward-compatible.
35314879Simp///
36314879Simptypedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  SIMPLE_INPUT_INTERFACE;
37314879Simp
38314879Simp///
39314879Simp/// The keystroke information for the key that was pressed.
40314879Simp///
41314879Simptypedef struct {
42314879Simp  UINT16  ScanCode;
43314879Simp  CHAR16  UnicodeChar;
44314879Simp} EFI_INPUT_KEY;
45314879Simp
46314879Simp//
47314879Simp// Required unicode control chars
48314879Simp//
49314879Simp#define CHAR_BACKSPACE        0x0008
50314879Simp#define CHAR_TAB              0x0009
51314879Simp#define CHAR_LINEFEED         0x000A
52314879Simp#define CHAR_CARRIAGE_RETURN  0x000D
53314879Simp
54314879Simp//
55314879Simp// EFI Scan codes
56314879Simp//
57314879Simp#define SCAN_NULL       0x0000
58314879Simp#define SCAN_UP         0x0001
59314879Simp#define SCAN_DOWN       0x0002
60314879Simp#define SCAN_RIGHT      0x0003
61314879Simp#define SCAN_LEFT       0x0004
62314879Simp#define SCAN_HOME       0x0005
63314879Simp#define SCAN_END        0x0006
64314879Simp#define SCAN_INSERT     0x0007
65314879Simp#define SCAN_DELETE     0x0008
66314879Simp#define SCAN_PAGE_UP    0x0009
67314879Simp#define SCAN_PAGE_DOWN  0x000A
68314879Simp#define SCAN_F1         0x000B
69314879Simp#define SCAN_F2         0x000C
70314879Simp#define SCAN_F3         0x000D
71314879Simp#define SCAN_F4         0x000E
72314879Simp#define SCAN_F5         0x000F
73314879Simp#define SCAN_F6         0x0010
74314879Simp#define SCAN_F7         0x0011
75314879Simp#define SCAN_F8         0x0012
76314879Simp#define SCAN_F9         0x0013
77314879Simp#define SCAN_F10        0x0014
78314879Simp#define SCAN_ESC        0x0017
79314879Simp
80314879Simp/**
81314879Simp  Reset the input device and optionally run diagnostics
82314879Simp
83314879Simp  @param  This                 Protocol instance pointer.
84314879Simp  @param  ExtendedVerification Driver may perform diagnostics on reset.
85314879Simp
86314879Simp  @retval EFI_SUCCESS          The device was reset.
87314879Simp  @retval EFI_DEVICE_ERROR     The device is not functioning properly and could not be reset.
88314879Simp
89314879Simp**/
90314879Simptypedef
91314879SimpEFI_STATUS
92314879Simp(EFIAPI *EFI_INPUT_RESET)(
93314879Simp  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL       *This,
94314879Simp  IN BOOLEAN                              ExtendedVerification
95314879Simp  );
96314879Simp
97314879Simp/**
98314879Simp  Reads the next keystroke from the input device. The WaitForKey Event can
99314879Simp  be used to test for existence of a keystroke via WaitForEvent () call.
100314879Simp
101314879Simp  @param  This  Protocol instance pointer.
102314879Simp  @param  Key   A pointer to a buffer that is filled in with the keystroke
103314879Simp                information for the key that was pressed.
104314879Simp
105314879Simp  @retval EFI_SUCCESS      The keystroke information was returned.
106314879Simp  @retval EFI_NOT_READY    There was no keystroke data available.
107314879Simp  @retval EFI_DEVICE_ERROR The keystroke information was not returned due to
108314879Simp                           hardware errors.
109314879Simp
110314879Simp**/
111314879Simptypedef
112314879SimpEFI_STATUS
113314879Simp(EFIAPI *EFI_INPUT_READ_KEY)(
114314879Simp  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL       *This,
115314879Simp  OUT EFI_INPUT_KEY                       *Key
116314879Simp  );
117314879Simp
118314879Simp///
119314879Simp/// The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
120314879Simp/// It is the minimum required protocol for ConsoleIn.
121314879Simp///
122314879Simpstruct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
123314879Simp  EFI_INPUT_RESET     Reset;
124314879Simp  EFI_INPUT_READ_KEY  ReadKeyStroke;
125314879Simp  ///
126314879Simp  /// Event to use with WaitForEvent() to wait for a key to be available
127314879Simp  ///
128314879Simp  EFI_EVENT           WaitForKey;
129314879Simp};
130314879Simp
131314879Simpextern EFI_GUID gEfiSimpleTextInProtocolGuid;
132314879Simp
133314879Simp#endif
134