3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Console based on Posix APIs.
20 This file attaches a SimpleTextIn protocol to a previously open window.
22 The constructor for this protocol depends on an open window. Currently
23 the SimpleTextOut protocol creates a window when it's constructor is called.
24 Thus this code must run after the constructor for the SimpleTextOut
33 // Private worker functions
36 UnixSimpleTextInCheckKey (
37 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
42 UnixSimpleTextInReset (
43 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
44 IN BOOLEAN ExtendedVerification
50 TODO: Add function description
54 This - TODO: add argument description
55 ExtendedVerification - TODO: add argument description
59 EFI_SUCCESS - TODO: Add description for return value
63 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
;
65 Private
= UNIX_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This
);
70 UnixConvertInputRecordToEfiKey (
72 OUT EFI_INPUT_KEY
*Key
78 TODO: Add function description
82 InputRecord - TODO: add argument description
83 Key - TODO: add argument description
87 EFI_NOT_READY - TODO: Add description for return value
88 EFI_NOT_READY - TODO: Add description for return value
89 EFI_NOT_READY - TODO: Add description for return value
90 EFI_SUCCESS - TODO: Add description for return value
103 UnixSimpleTextInReadKeyStroke (
104 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
105 OUT EFI_INPUT_KEY
*Key
111 TODO: Add function description
115 This - TODO: add argument description
116 Key - TODO: add argument description
120 EFI_DEVICE_ERROR - TODO: Add description for return value
121 EFI_NOT_READY - TODO: Add description for return value
126 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
;
129 Private
= UNIX_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This
);
131 Status
= UnixSimpleTextInCheckKey (Private
);
132 if (EFI_ERROR (Status
)) {
136 if (Private
->UnixThunk
->Read (0, &c
, 1) != 1)
137 return EFI_NOT_READY
;
138 Status
= UnixConvertInputRecordToEfiKey (c
, Key
);
145 UnixSimpleTextInWaitForKey (
153 TODO: Add function description
157 Event - TODO: add argument description
158 Context - TODO: add argument description
162 TODO: add return values
166 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
;
169 Private
= (UNIX_SIMPLE_TEXT_PRIVATE_DATA
*) Context
;
170 Status
= UnixSimpleTextInCheckKey (Private
);
171 if (!EFI_ERROR (Status
)) {
172 gBS
->SignalEvent (Event
);
177 UnixSimpleTextInCheckKey (
178 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
184 TODO: Add function description
188 Private - TODO: add argument description
192 TODO: add return values
200 if (Private
->UnixThunk
->Poll (&pfd
, 1, 0) <= 0) {
201 return EFI_NOT_READY
;
207 UnixSimpleTextInAttachToWindow (
208 IN UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
214 TODO: Add function description
218 Private - TODO: add argument description
222 TODO: add return values
228 Private
->SimpleTextIn
.Reset
= UnixSimpleTextInReset
;
229 Private
->SimpleTextIn
.ReadKeyStroke
= UnixSimpleTextInReadKeyStroke
;
231 Status
= gBS
->CreateEvent (
234 UnixSimpleTextInWaitForKey
,
236 &Private
->SimpleTextIn
.WaitForKey
238 ASSERT_EFI_ERROR (Status
);