1 /**
2 	Based on Protocol/SimpleTextIn.h, original notice:
3 
4 	Simple Text Input protocol from the UEFI 2.0 specification.
5 	
6 	Abstraction of a very simple input device like a keyboard or serial
7 	terminal.
8 	
9 	Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
10 	This program and the accompanying materials
11 	are licensed and made available under the terms and conditions of the BSD License
12 	which accompanies this distribution.  The full text of the license may be found at
13 	http://opensource.org/licenses/bsd-license.php
14 	
15 	THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 	WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 	
18 **/
19 module uefi.protocols.simpletextin;
20 import uefi.base;
21 import uefi.base_type;
22 
23 public:
24 extern (C):
25 enum EFI_GUID EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID = EFI_GUID(0x387477c1,
26         0x69c7, 0x11d2, [0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b]);
27 alias EFI_SIMPLE_TEXT_INPUT_PROTOCOL = _EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
28 /// Protocol GUID name defined in EFI1.1.
29 enum SIMPLE_INPUT_PROTOCOL = EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID;
30 /// Protocol name in EFI1.1 for backward-compatible.
31 alias SIMPLE_INPUT_INTERFACE = _EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
32 /// The keystroke information for the key that was pressed.
33 struct EFI_INPUT_KEY
34 {
35     UINT16 ScanCode;
36     CHAR16 UnicodeChar;
37 }
38 
39 enum CHAR_NULL = 0x0000;
40 enum CHAR_BACKSPACE = 0x0008;
41 enum CHAR_TAB = 0x0009;
42 enum CHAR_LINEFEED = 0x000A;
43 enum CHAR_CARRIAGE_RETURN = 0x000D;
44 enum SCAN_NULL = 0x0000;
45 enum SCAN_UP = 0x0001;
46 enum SCAN_DOWN = 0x0002;
47 enum SCAN_RIGHT = 0x0003;
48 enum SCAN_LEFT = 0x0004;
49 enum SCAN_HOME = 0x0005;
50 enum SCAN_END = 0x0006;
51 enum SCAN_INSERT = 0x0007;
52 enum SCAN_DELETE = 0x0008;
53 enum SCAN_PAGE_UP = 0x0009;
54 enum SCAN_PAGE_DOWN = 0x000A;
55 enum SCAN_F1 = 0x000B;
56 enum SCAN_F2 = 0x000C;
57 enum SCAN_F3 = 0x000D;
58 enum SCAN_F4 = 0x000E;
59 enum SCAN_F5 = 0x000F;
60 enum SCAN_F6 = 0x0010;
61 enum SCAN_F7 = 0x0011;
62 enum SCAN_F8 = 0x0012;
63 enum SCAN_F9 = 0x0013;
64 enum SCAN_F10 = 0x0014;
65 enum SCAN_ESC = 0x0017;
66 /**
67 	Reset the input device and optionally run diagnostics
68 	
69 	@param  This                 Protocol instance pointer.
70 	@param  ExtendedVerification Driver may perform diagnostics on reset.
71 	
72 	@retval EFI_SUCCESS          The device was reset.
73 	@retval EFI_DEVICE_ERROR     The device is not functioning properly and could not be reset.
74 	
75 **/
76 alias EFI_INPUT_RESET = EFI_STATUS function(EFI_SIMPLE_TEXT_INPUT_PROTOCOL* This,
77     BOOLEAN ExtendedVerification) @nogc nothrow;
78 /**
79 	Reads the next keystroke from the input device. The WaitForKey Event can
80 	be used to test for existence of a keystroke via WaitForEvent () call.
81 	
82 	@param  This  Protocol instance pointer.
83 	@param  Key   A pointer to a buffer that is filled in with the keystroke
84 	information for the key that was pressed.
85 	
86 	@retval EFI_SUCCESS      The keystroke information was returned.
87 	@retval EFI_NOT_READY    There was no keystroke data available.
88 	@retval EFI_DEVICE_ERROR The keystroke information was not returned due to
89 	hardware errors.
90 	
91 **/
92 alias EFI_INPUT_READ_KEY = EFI_STATUS function(
93     EFI_SIMPLE_TEXT_INPUT_PROTOCOL* This, EFI_INPUT_KEY* Key) @nogc nothrow;
94 /// The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
95 /// It is the minimum required protocol for ConsoleIn.
96 struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL
97 {
98     EFI_INPUT_RESET Reset;
99     EFI_INPUT_READ_KEY ReadKeyStroke;
100     ///
101     /// Event to use with WaitForEvent() to wait for a key to be available
102     ///
103     EFI_EVENT WaitForKey;
104 }