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