]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.h
GenFds will try to deduce 'Target_Toolchain_Arch' KeyStringList for GUIDed section.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbKbDxe / KeyBoard.h
CommitLineData
a7022cec 1/** @file\r
a7022cec 2 Function prototype for USB Keyboard Driver.\r
3\r
4Copyright (c) 2004 - 2008, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _EFI_KEYBOARD_H_\r
16#define _EFI_KEYBOARD_H_\r
17\r
18\r
19#include "EfiKey.h"\r
20\r
21/**\r
22 Uses USB I/O to check whether the device is a USB Keyboard device.\r
23\r
24 @param UsbIo Points to a USB I/O protocol instance.\r
25 @retval None\r
26\r
27**/\r
28BOOLEAN\r
29EFIAPI\r
30IsUSBKeyboard (\r
31 IN EFI_USB_IO_PROTOCOL *UsbIo\r
32 );\r
33\r
34/**\r
35 Initialize USB Keyboard device and all private data structures.\r
36\r
37 @param UsbKeyboardDevice The USB_KB_DEV instance.\r
38\r
39 @retval EFI_SUCCESS Initialization is successful.\r
40 @retval EFI_DEVICE_ERROR Configure hardware failed.\r
41\r
42**/\r
43EFI_STATUS\r
44EFIAPI\r
45InitUSBKeyboard (\r
46 IN USB_KB_DEV *UsbKeyboardDevice\r
47 );\r
48\r
49/**\r
50 Initialize USB Keyboard layout.\r
51\r
52 @param UsbKeyboardDevice The USB_KB_DEV instance.\r
53\r
54 @retval EFI_SUCCESS Initialization Success.\r
55 @retval Other Keyboard layout initial failed.\r
56\r
57**/\r
58EFI_STATUS\r
59EFIAPI\r
60InitKeyboardLayout (\r
61 IN USB_KB_DEV *UsbKeyboardDevice\r
62 );\r
63\r
64/**\r
65 Destroy resources for Keyboard layout.\r
66\r
67 @param UsbKeyboardDevice The USB_KB_DEV instance.\r
68\r
69**/\r
70VOID\r
71EFIAPI\r
72ReleaseKeyboardLayoutResources (\r
73 IN USB_KB_DEV *UsbKeyboardDevice\r
74 );\r
75\r
76/**\r
77 Handler function for USB Keyboard's asynchronous interrupt transfer.\r
78\r
79 @param Data A pointer to a buffer that is filled with key data which is\r
80 retrieved via asynchronous interrupt transfer.\r
81 @param DataLength Indicates the size of the data buffer.\r
82 @param Context Pointing to USB_KB_DEV instance.\r
83 @param Result Indicates the result of the asynchronous interrupt transfer.\r
84\r
85 @retval EFI_SUCCESS Handler is successful.\r
86 @retval EFI_DEVICE_ERROR Hardware Error\r
87\r
88**/\r
89EFI_STATUS\r
90EFIAPI\r
91KeyboardHandler (\r
92 IN VOID *Data,\r
93 IN UINTN DataLength,\r
94 IN VOID *Context,\r
95 IN UINT32 Result\r
96 );\r
97\r
98/**\r
99 Timer handler for Delayed Recovery timer.\r
100\r
101 @param Event The Delayed Recovery event.\r
102 @param Context Points to the USB_KB_DEV instance.\r
103\r
104\r
105**/\r
106VOID\r
107EFIAPI\r
108USBKeyboardRecoveryHandler (\r
109 IN EFI_EVENT Event,\r
110 IN VOID *Context\r
111 );\r
112\r
113/**\r
114 Retrieves a key character after parsing the raw data in keyboard buffer.\r
115\r
116 @param UsbKeyboardDevice The USB_KB_DEV instance.\r
117 @param KeyChar Points to the Key character after key parsing.\r
118\r
119 @retval EFI_SUCCESS Parse key is successful.\r
120 @retval EFI_NOT_READY Device is not ready.\r
121\r
122**/\r
123EFI_STATUS\r
124EFIAPI\r
125USBParseKey (\r
126 IN OUT USB_KB_DEV *UsbKeyboardDevice,\r
127 OUT UINT8 *KeyChar\r
128 );\r
129\r
130/**\r
131 Converts USB Keyboard code to EFI Scan Code.\r
132\r
133 @param UsbKeyboardDevice The USB_KB_DEV instance.\r
134 @param KeyChar Indicates the key code that will be interpreted.\r
135 @param Key A pointer to a buffer that is filled in with\r
136 the keystroke information for the key that\r
137 was pressed.\r
138\r
139 @retval EFI_NOT_READY Device is not ready\r
140 @retval EFI_SUCCESS Success.\r
141\r
142**/\r
143EFI_STATUS\r
144EFIAPI\r
5899f27e 145UsbKeyCodeToEfiInputKey (\r
a7022cec 146 IN USB_KB_DEV *UsbKeyboardDevice,\r
147 IN UINT8 KeyChar,\r
148 OUT EFI_INPUT_KEY *Key\r
149 );\r
150\r
151/**\r
152 Resets USB Keyboard Buffer.\r
153\r
154 @param KeyboardBuffer Points to the USB Keyboard Buffer.\r
155\r
a7022cec 156**/\r
5899f27e 157VOID\r
a7022cec 158EFIAPI\r
159InitUSBKeyBuffer (\r
160 IN OUT USB_KB_BUFFER *KeyboardBuffer\r
161 );\r
162\r
163/**\r
164 Check whether USB Keyboard buffer is empty.\r
165\r
166 @param KeyboardBuffer USB Keyboard Buffer.\r
167\r
168 @retval TRUE Key buffer is empty.\r
169 @retval FALSE Key buffer is not empty.\r
170\r
171**/\r
172BOOLEAN\r
173EFIAPI\r
174IsUSBKeyboardBufferEmpty (\r
175 IN USB_KB_BUFFER *KeyboardBuffer\r
176 );\r
177\r
178/**\r
179 Check whether USB Keyboard buffer is full.\r
180\r
181 @param KeyboardBuffer USB Keyboard Buffer.\r
182\r
183 @retval TRUE Key buffer is full.\r
184 @retval FALSE Key buffer is not full.\r
185\r
186**/\r
187BOOLEAN\r
188EFIAPI\r
189IsUSBKeyboardBufferFull (\r
190 IN USB_KB_BUFFER *KeyboardBuffer\r
191 );\r
192\r
193/**\r
194 Inserts a key code into keyboard buffer.\r
195\r
196 @param KeyboardBuffer Points to the USB Keyboard Buffer.\r
197 @param Key Key code\r
198 @param Down Special key\r
199\r
a7022cec 200**/\r
5899f27e 201VOID\r
a7022cec 202EFIAPI\r
203InsertKeyCode (\r
204 IN OUT USB_KB_BUFFER *KeyboardBuffer,\r
205 IN UINT8 Key,\r
206 IN UINT8 Down\r
207 );\r
208\r
209/**\r
210 Pops a key code off from keyboard buffer.\r
211\r
212 @param KeyboardBuffer Points to the USB Keyboard Buffer.\r
213 @param UsbKey Points to the buffer that contains a usb key code.\r
214\r
215 @retval EFI_SUCCESS Success\r
216 @retval EFI_DEVICE_ERROR Hardware Error\r
217\r
218**/\r
219EFI_STATUS\r
220EFIAPI\r
221RemoveKeyCode (\r
222 IN OUT USB_KB_BUFFER *KeyboardBuffer,\r
223 OUT USB_KEY *UsbKey\r
224 );\r
225\r
226/**\r
227 Timer handler for Repeat Key timer.\r
228\r
229 @param Event The Repeat Key event.\r
230 @param Context Points to the USB_KB_DEV instance.\r
231\r
232\r
233**/\r
234VOID\r
235EFIAPI\r
236USBKeyboardRepeatHandler (\r
237 IN EFI_EVENT Event,\r
238 IN VOID *Context\r
239 );\r
240\r
241/**\r
242 Sets USB Keyboard LED state.\r
243\r
244 @param UsbKeyboardDevice The USB_KB_DEV instance.\r
245\r
a7022cec 246**/\r
5899f27e 247VOID\r
a7022cec 248EFIAPI\r
249SetKeyLED (\r
250 IN USB_KB_DEV *UsbKeyboardDevice\r
251 );\r
252\r
253#endif\r