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