]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/WinNtGopDxe/WinNtGop.h
1. Add Partial Keystroke Support in Nt32 WinNTGopDxe driver. See the Uefi2.3.1a chapt...
[mirror_edk2.git] / Nt32Pkg / WinNtGopDxe / WinNtGop.h
1 /** @file
2
3 Copyright (c) 2006 - 2011, 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
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 WinNtGop.h
15
16 Abstract:
17
18 Private data for the Gop driver that is bound to the WinNt Thunk protocol
19
20
21 **/
22
23 #ifndef _WIN_NT_GOP_H_
24 #define _WIN_NT_GOP_H_
25
26
27 #include <Uefi.h>
28 #include <WinNtDxe.h>
29
30 #include <Guid/EventGroup.h>
31 #include <Protocol/WinNtIo.h>
32 #include <Protocol/ComponentName.h>
33 #include <Protocol/SimpleTextIn.h>
34 #include <Protocol/SimpleTextInEx.h>
35 #include <Protocol/DriverBinding.h>
36 #include <Protocol/GraphicsOutput.h>
37
38 #include <Library/DebugLib.h>
39 #include <Library/BaseLib.h>
40 #include <Library/UefiDriverEntryPoint.h>
41 #include <Library/UefiLib.h>
42 #include <Library/BaseMemoryLib.h>
43 #include <Library/UefiBootServicesTableLib.h>
44 #include <Library/MemoryAllocationLib.h>
45
46 //
47 // WM_SYSKEYDOWN/WM_SYSKEYUP Notification
48 // lParam
49 // bit 24: Specifies whether the key is an extended key,
50 // such as the right-hand ALT and CTRL keys that appear on
51 // an enhanced 101- or 102-key keyboard.
52 // The value is 1 if it is an extended key; otherwise, it is 0.
53 // bit 29:Specifies the context code.
54 // The value is 1 if the ALT key is down while the key is pressed/released;
55 // it is 0 if the WM_SYSKEYDOWN message is posted to the active window
56 // because no window has the keyboard focus.
57 #define GOP_EXTENDED_KEY (0x1 << 24)
58 #define GOP_ALT_KEY_PRESSED (0x1 << 29)
59
60 #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
61
62 #define MAX_Q 256
63
64 typedef struct {
65 UINTN Front;
66 UINTN Rear;
67 EFI_KEY_DATA Q[MAX_Q];
68 CRITICAL_SECTION Cs;
69 } GOP_QUEUE_FIXED;
70
71 #define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
72
73 #define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'g', 'o', 'N')
74
75 #define WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('W', 'g', 'S', 'n')
76
77 typedef struct _WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY {
78 UINTN Signature;
79 EFI_HANDLE NotifyHandle;
80 EFI_KEY_DATA KeyData;
81 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
82 LIST_ENTRY NotifyEntry;
83 } WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY;
84
85 #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
86
87 typedef struct {
88 UINT32 HorizontalResolution;
89 UINT32 VerticalResolution;
90 UINT32 ColorDepth;
91 UINT32 RefreshRate;
92 } GOP_MODE_DATA;
93
94 typedef struct {
95 UINT64 Signature;
96
97 EFI_HANDLE Handle;
98 EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
99 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
100
101 EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
102
103 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
104
105 //
106 // GOP Private Data for QueryMode ()
107 //
108 GOP_MODE_DATA *ModeData;
109
110 //
111 // GOP Private Data knowing when to start hardware
112 //
113 BOOLEAN HardwareNeedsStarting;
114
115 CHAR16 *WindowName;
116 CHAR16 Buffer[160];
117
118 HANDLE ThreadInited; // Semaphore
119 HANDLE ThreadHandle; // Thread
120 DWORD ThreadId;
121
122 HWND WindowHandle;
123 WNDCLASSEX WindowsClass;
124
125 //
126 // This screen is used to redraw the scree when windows events happen. It's
127 // updated in the main thread and displayed in the windows thread.
128 //
129 BITMAPV4HEADER *VirtualScreenInfo;
130 RGBQUAD *VirtualScreen;
131
132 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillLine;
133
134 //
135 // Keyboard Queue used by Simple Text In.
136 // QueueForRead: WinProc thread adds, and main thread removes.
137 // QueueForNotify: WinProc thread adds, and timer thread removes.
138 //
139 GOP_QUEUE_FIXED QueueForRead;
140 GOP_QUEUE_FIXED QueueForNotify;
141
142 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx;
143 EFI_KEY_STATE KeyState;
144 LIST_ENTRY NotifyList;
145 BOOLEAN LeftShift;
146 BOOLEAN RightShift;
147 BOOLEAN LeftAlt;
148 BOOLEAN RightAlt;
149 BOOLEAN LeftCtrl;
150 BOOLEAN RightCtrl;
151 BOOLEAN LeftLogo;
152 BOOLEAN RightLogo;
153 BOOLEAN Menu;
154 BOOLEAN SysReq;
155 BOOLEAN NumLock;
156 BOOLEAN ScrollLock;
157 BOOLEAN CapsLock;
158 BOOLEAN IsPartialKeySupport;
159 EFI_EVENT TimerEvent;
160 } GOP_PRIVATE_DATA;
161
162 #define GOP_PRIVATE_DATA_FROM_THIS(a) \
163 CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
164
165 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
166 CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
167
168 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
169 CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
170
171 //
172 // Global Protocol Variables
173 //
174 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding;
175 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName;
176 extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtGopComponentName2;
177
178
179 //
180 // Gop Hardware abstraction internal worker functions
181 //
182
183 /**
184 TODO: Add function description
185
186 @param WinNtIo TODO: add argument description
187
188 @return TODO: add return values
189
190 **/
191 EFI_STATUS
192 WinNtGopSupported (
193 IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo
194 );
195
196
197 /**
198 TODO: Add function description
199
200 @param Private TODO: add argument description
201
202 @return TODO: add return values
203
204 **/
205 EFI_STATUS
206 WinNtGopConstructor (
207 IN GOP_PRIVATE_DATA *Private
208 );
209
210
211 /**
212 TODO: Add function description
213
214 @param Private TODO: add argument description
215
216 @return TODO: add return values
217
218 **/
219 EFI_STATUS
220 WinNtGopDestructor (
221 IN GOP_PRIVATE_DATA *Private
222 );
223
224 //
225 // UEFI 2.0 driver model prototypes for Win NT GOP
226 //
227
228
229 /**
230 TODO: Add function description
231
232 @param ImageHandle TODO: add argument description
233 @param SystemTable TODO: add argument description
234
235 @return TODO: add return values
236
237 **/
238 EFI_STATUS
239 EFIAPI
240 WinNtGopInitialize (
241 IN EFI_HANDLE ImageHandle,
242 IN EFI_SYSTEM_TABLE *SystemTable
243 );
244
245
246 /**
247 TODO: Add function description
248
249 @param This TODO: add argument description
250 @param Handle TODO: add argument description
251 @param RemainingDevicePath TODO: add argument description
252
253 @return TODO: add return values
254
255 **/
256 EFI_STATUS
257 EFIAPI
258 WinNtGopDriverBindingSupported (
259 IN EFI_DRIVER_BINDING_PROTOCOL *This,
260 IN EFI_HANDLE Handle,
261 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
262 );
263
264
265 /**
266 TODO: Add function description
267
268 @param This TODO: add argument description
269 @param Handle TODO: add argument description
270 @param RemainingDevicePath TODO: add argument description
271
272 @return TODO: add return values
273
274 **/
275 EFI_STATUS
276 EFIAPI
277 WinNtGopDriverBindingStart (
278 IN EFI_DRIVER_BINDING_PROTOCOL *This,
279 IN EFI_HANDLE Handle,
280 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
281 );
282
283
284 /**
285 TODO: Add function description
286
287 @param This TODO: add argument description
288 @param Handle TODO: add argument description
289 @param NumberOfChildren TODO: add argument description
290 @param ChildHandleBuffer TODO: add argument description
291
292 @return TODO: add return values
293
294 **/
295 EFI_STATUS
296 EFIAPI
297 WinNtGopDriverBindingStop (
298 IN EFI_DRIVER_BINDING_PROTOCOL *This,
299 IN EFI_HANDLE Handle,
300 IN UINTN NumberOfChildren,
301 IN EFI_HANDLE *ChildHandleBuffer
302 );
303
304
305 /**
306 TODO: Add function description
307
308 @param Private TODO: add argument description
309 @param Key TODO: add argument description
310
311 @return TODO: add return values
312
313 **/
314 EFI_STATUS
315 GopPrivateAddKey (
316 IN GOP_PRIVATE_DATA *Private,
317 IN EFI_INPUT_KEY Key
318 );
319
320
321 /**
322 TODO: Add function description
323
324 @param Private TODO: add argument description
325
326 @return TODO: add return values
327
328 **/
329 EFI_STATUS
330 WinNtGopInitializeSimpleTextInForWindow (
331 IN GOP_PRIVATE_DATA *Private
332 );
333
334
335 /**
336 TODO: Add function description
337
338 @param Private TODO: add argument description
339
340 @return TODO: add return values
341
342 **/
343 EFI_STATUS
344 WinNtGopDestroySimpleTextInForWindow (
345 IN GOP_PRIVATE_DATA *Private
346 );
347
348
349
350 #endif