3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. 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
37 UnixSimpleTextInCheckKey (
38 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
43 UnixSimpleTextInReset (
44 IN EFI_SIMPLE_TEXT_IN_PROTOCOL
*This
,
45 IN BOOLEAN ExtendedVerification
51 TODO: Add function description
55 This - TODO: add argument description
56 ExtendedVerification - TODO: add argument description
60 EFI_SUCCESS - TODO: Add description for return value
64 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
;
66 Private
= UNIX_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This
);
72 UnixConvertInputRecordToEfiKey (
74 OUT EFI_INPUT_KEY
*Key
80 TODO: Add function description
84 InputRecord - TODO: add argument description
85 Key - TODO: add argument description
89 EFI_NOT_READY - TODO: Add description for return value
90 EFI_NOT_READY - TODO: Add description for return value
91 EFI_NOT_READY - TODO: Add description for return value
92 EFI_SUCCESS - TODO: Add description for return value
106 UnixSimpleTextInReadKeyStroke (
107 IN EFI_SIMPLE_TEXT_IN_PROTOCOL
*This
,
108 OUT EFI_INPUT_KEY
*Key
114 TODO: Add function description
118 This - TODO: add argument description
119 Key - TODO: add argument description
123 EFI_DEVICE_ERROR - TODO: Add description for return value
124 EFI_NOT_READY - TODO: Add description for return value
129 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
;
132 Private
= UNIX_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This
);
134 Status
= UnixSimpleTextInCheckKey (Private
);
135 if (EFI_ERROR (Status
)) {
139 if (Private
->UnixThunk
->Read (0, &c
, 1) != 1)
140 return EFI_NOT_READY
;
141 Status
= UnixConvertInputRecordToEfiKey (c
, Key
);
149 UnixSimpleTextInWaitForKey (
157 TODO: Add function description
161 Event - TODO: add argument description
162 Context - TODO: add argument description
166 TODO: add return values
170 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
;
173 Private
= (UNIX_SIMPLE_TEXT_PRIVATE_DATA
*) Context
;
174 Status
= UnixSimpleTextInCheckKey (Private
);
175 if (!EFI_ERROR (Status
)) {
176 gBS
->SignalEvent (Event
);
182 UnixSimpleTextInCheckKey (
183 UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
189 TODO: Add function description
193 Private - TODO: add argument description
197 TODO: add return values
205 if (Private
->UnixThunk
->Poll (&pfd
, 1, 0) <= 0) {
206 return EFI_NOT_READY
;
212 UnixSimpleTextInAttachToWindow (
213 IN UNIX_SIMPLE_TEXT_PRIVATE_DATA
*Private
219 TODO: Add function description
223 Private - TODO: add argument description
227 TODO: add return values
233 Private
->SimpleTextIn
.Reset
= UnixSimpleTextInReset
;
234 Private
->SimpleTextIn
.ReadKeyStroke
= UnixSimpleTextInReadKeyStroke
;
236 Status
= gBS
->CreateEvent (
237 EFI_EVENT_NOTIFY_WAIT
,
239 UnixSimpleTextInWaitForKey
,
241 &Private
->SimpleTextIn
.WaitForKey
243 ASSERT_EFI_ERROR (Status
);