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