]>
Commit | Line | Data |
---|---|---|
804405e7 | 1 | /*++ |
2 | ||
3 | Copyright (c) 2006, 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 | |
8 | ||
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. | |
11 | ||
12 | Module Name: | |
13 | ||
14 | UnixUgaInput.c | |
15 | ||
16 | Abstract: | |
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 | ||
36 | EFI_STATUS | |
37 | EFIAPI | |
38 | UnixUgaSimpleTextInReset ( | |
39 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, | |
40 | IN BOOLEAN ExtendedVerification | |
41 | ) | |
42 | /*++ | |
43 | ||
44 | Routine Description: | |
45 | ||
46 | TODO: Add function description | |
47 | ||
48 | Arguments: | |
49 | ||
50 | This - TODO: add argument description | |
51 | ExtendedVerification - TODO: add argument description | |
52 | ||
53 | Returns: | |
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 | 86 | EFI_STATUS |
87 | EFIAPI | |
88 | UnixUgaSimpleTextInReadKeyStroke ( | |
89 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, | |
90 | OUT EFI_INPUT_KEY *Key | |
91 | ) | |
92 | /*++ | |
93 | ||
94 | Routine Description: | |
95 | ||
96 | TODO: Add function description | |
97 | ||
98 | Arguments: | |
99 | ||
100 | This - TODO: add argument description | |
101 | Key - TODO: add argument description | |
102 | ||
103 | Returns: | |
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 | 132 | VOID |
133 | EFIAPI | |
134 | UnixUgaSimpleTextInWaitForKey ( | |
135 | IN EFI_EVENT Event, | |
136 | IN VOID *Context | |
137 | ) | |
138 | /*++ | |
139 | ||
140 | Routine Description: | |
141 | ||
142 | TODO: Add function description | |
143 | ||
144 | Arguments: | |
145 | ||
146 | Event - TODO: add argument description | |
147 | Context - TODO: add argument description | |
148 | ||
149 | Returns: | |
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 | ||
182 | EFI_STATUS | |
183 | UnixUgaInitializeSimpleTextInForWindow ( | |
184 | IN UGA_PRIVATE_DATA *Private | |
185 | ) | |
186 | /*++ | |
187 | ||
188 | Routine Description: | |
189 | ||
190 | TODO: Add function description | |
191 | ||
192 | Arguments: | |
193 | ||
194 | Private - TODO: add argument description | |
195 | ||
196 | Returns: | |
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 | } |