]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/UnixUgaDxe/UnixUgaInput.c
Fix help command scroll issue. Also add FV space used, and free space to dir command.
[mirror_edk2.git] / UnixPkg / UnixUgaDxe / UnixUgaInput.c
CommitLineData
804405e7 1/*++
2
3Copyright (c) 2006, Intel Corporation
4All rights reserved. This program and the accompanying materials
5are licensed and made available under the terms and conditions of the BSD License
6which accompanies this distribution. The full text of the license may be found at
7http://opensource.org/licenses/bsd-license.php
8
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12Module Name:
13
14 UnixUgaInput.c
15
16Abstract:
17
18 This file produces the Simple Text In for an Uga window.
19
20 This stuff is linked at the hip to the Window, since the window
21 processing is done in a thread kicked off in UnixUgaImplementation.c
22
23 Since the window information is processed in an other thread we need
24 a keyboard Queue to pass data about. The Simple Text In code just
25 takes data off the Queue. The WinProc message loop takes keyboard input
26 and places it in the Queue.
27
28--*/
29
30#include "UnixUga.h"
31
32//
33// Simple Text In implementation.
34//
35
36EFI_STATUS
37EFIAPI
38UnixUgaSimpleTextInReset (
39 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
40 IN BOOLEAN ExtendedVerification
41 )
42/*++
43
44Routine Description:
45
46 TODO: Add function description
47
48Arguments:
49
50 This - TODO: add argument description
51 ExtendedVerification - TODO: add argument description
52
53Returns:
54
55 EFI_SUCCESS - TODO: Add description for return value
56
57--*/
58{
59 UGA_PRIVATE_DATA *Private;
60 EFI_INPUT_KEY Key;
61 EFI_TPL OldTpl;
62
63 Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
64 if (Private->UgaIo == NULL) {
65 return EFI_SUCCESS;
66 }
67
68 //
69 // Enter critical section
70 //
71 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
72
73 //
74 // A reset is draining the Queue
75 //
76 while (Private->UgaIo->UgaGetKey(Private->UgaIo, &Key) == EFI_SUCCESS)
77 ;
78
79 //
80 // Leave critical section and return
81 //
82 gBS->RestoreTPL (OldTpl);
83 return EFI_SUCCESS;
84}
85
804405e7 86EFI_STATUS
87EFIAPI
88UnixUgaSimpleTextInReadKeyStroke (
89 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
90 OUT EFI_INPUT_KEY *Key
91 )
92/*++
93
94Routine Description:
95
96 TODO: Add function description
97
98Arguments:
99
100 This - TODO: add argument description
101 Key - TODO: add argument description
102
103Returns:
104
105 TODO: add return values
106
107--*/
108{
109 UGA_PRIVATE_DATA *Private;
110 EFI_STATUS Status;
111 EFI_TPL OldTpl;
112
113 Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
114 if (Private->UgaIo == NULL) {
115 return EFI_NOT_READY;
116 }
117
118 //
119 // Enter critical section
120 //
121 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
122
123 Status = Private->UgaIo->UgaGetKey(Private->UgaIo, Key);
124 //
125 // Leave critical section and return
126 //
127 gBS->RestoreTPL (OldTpl);
128
129 return Status;
130}
131
804405e7 132VOID
133EFIAPI
134UnixUgaSimpleTextInWaitForKey (
135 IN EFI_EVENT Event,
136 IN VOID *Context
137 )
138/*++
139
140Routine Description:
141
142 TODO: Add function description
143
144Arguments:
145
146 Event - TODO: add argument description
147 Context - TODO: add argument description
148
149Returns:
150
151 TODO: add return values
152
153--*/
154{
155 UGA_PRIVATE_DATA *Private;
156 EFI_STATUS Status;
157 EFI_TPL OldTpl;
158
159 Private = (UGA_PRIVATE_DATA *) Context;
160 if (Private->UgaIo == NULL) {
161 return;
162 }
163
164 //
165 // Enter critical section
166 //
167 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
168
169 Status = Private->UgaIo->UgaCheckKey(Private->UgaIo);
170 if (!EFI_ERROR (Status)) {
171 //
172 // If a there is a key in the queue signal our event.
173 //
174 gBS->SignalEvent (Event);
175 }
176 //
177 // Leave critical section and return
178 //
179 gBS->RestoreTPL (OldTpl);
180}
181
182EFI_STATUS
183UnixUgaInitializeSimpleTextInForWindow (
184 IN UGA_PRIVATE_DATA *Private
185 )
186/*++
187
188Routine Description:
189
190 TODO: Add function description
191
192Arguments:
193
194 Private - TODO: add argument description
195
196Returns:
197
198 TODO: add return values
199
200--*/
201{
202 EFI_STATUS Status;
203
204 //
205 // Initialize Simple Text In protoocol
206 //
207 Private->SimpleTextIn.Reset = UnixUgaSimpleTextInReset;
208 Private->SimpleTextIn.ReadKeyStroke = UnixUgaSimpleTextInReadKeyStroke;
209
210 Status = gBS->CreateEvent (
211 EVT_NOTIFY_WAIT,
212 TPL_NOTIFY,
213 UnixUgaSimpleTextInWaitForKey,
214 Private,
215 &Private->SimpleTextIn.WaitForKey
216 );
217
218 return Status;
219}