]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.h
2 Function prototype for USB Keyboard Driver.
4 Copyright (c) 2004 - 2008, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _EFI_KEYBOARD_H_
16 #define _EFI_KEYBOARD_H_
22 Uses USB I/O to check whether the device is a USB keyboard device.
24 @param UsbIo Pointer to a USB I/O protocol instance.
26 @retval TRUE Device is a USB keyboard device.
27 @retval FALSE Device is a not USB keyboard device.
33 IN EFI_USB_IO_PROTOCOL
*UsbIo
37 Initialize USB keyboard device and all private data structures.
39 @param UsbKeyboardDevice The USB_KB_DEV instance.
41 @retval EFI_SUCCESS Initialization is successful.
42 @retval EFI_DEVICE_ERROR Keyboard initialization failed.
48 IN OUT USB_KB_DEV
*UsbKeyboardDevice
52 Initialize USB keyboard layout.
54 This function initializes Key Convertion Table for the USB keyboard device.
55 It first tries to retrieve layout from HII database. If failed and default
56 layout is enabled, then it just uses the default layout.
58 @param UsbKeyboardDevice The USB_KB_DEV instance.
60 @retval EFI_SUCCESS Initialization succeeded.
61 @retval EFI_NOT_READY Keyboard layout cannot be retrieve from HII
62 database, and default layout is disabled.
63 @retval Other Fail to register event to EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group.
69 OUT USB_KB_DEV
*UsbKeyboardDevice
73 Destroy resources for keyboard layout.
75 @param UsbKeyboardDevice The USB_KB_DEV instance.
80 ReleaseKeyboardLayoutResources (
81 IN OUT USB_KB_DEV
*UsbKeyboardDevice
85 Handler function for USB keyboard's asynchronous interrupt transfer.
87 This function is the handler function for USB keyboard's asynchronous interrupt transfer
88 to manage the keyboard. It parses the USB keyboard input report, and inserts data to
89 keyboard buffer according to state of modifer keys and normal keys. Timer for repeat key
90 is also set accordingly.
92 @param Data A pointer to a buffer that is filled with key data which is
93 retrieved via asynchronous interrupt transfer.
94 @param DataLength Indicates the size of the data buffer.
95 @param Context Pointing to USB_KB_DEV instance.
96 @param Result Indicates the result of the asynchronous interrupt transfer.
98 @retval EFI_SUCCESS Asynchronous interrupt transfer is handled successfully.
99 @retval EFI_DEVICE_ERROR Hardware error occurs.
112 Handler for Delayed Recovery event.
114 This function is the handler for Delayed Recovery event triggered
116 After a device error occurs, the event would be triggered
117 with interval of EFI_USB_INTERRUPT_DELAY. EFI_USB_INTERRUPT_DELAY
118 is defined in USB standard for error handling.
120 @param Event The Delayed Recovery event.
121 @param Context Points to the USB_KB_DEV instance.
126 USBKeyboardRecoveryHandler (
132 Retrieves a USB keycode after parsing the raw data in keyboard buffer.
134 This function parses keyboard buffer. It updates state of modifier key for
135 USB_KB_DEV instancem, and returns keycode for output.
137 @param UsbKeyboardDevice The USB_KB_DEV instance.
138 @param KeyCode Pointer to the USB keycode for output.
140 @retval EFI_SUCCESS Keycode successfully parsed.
141 @retval EFI_NOT_READY Keyboard buffer is not ready for a valid keycode
147 IN OUT USB_KB_DEV
*UsbKeyboardDevice
,
152 Converts USB Keycode ranging from 0x4 to 0x65 to EFI_INPUT_KEY.
154 @param UsbKeyboardDevice The USB_KB_DEV instance.
155 @param KeyCode Indicates the key code that will be interpreted.
156 @param Key A pointer to a buffer that is filled in with
157 the keystroke information for the key that
160 @retval EFI_SUCCESS Success.
161 @retval EFI_INVALID_PARAMETER KeyCode is not in the range of 0x4 to 0x65.
162 @retval EFI_INVALID_PARAMETER Translated EFI_INPUT_KEY has zero for both ScanCode and UnicodeChar.
163 @retval EFI_NOT_READY KeyCode represents a dead key with EFI_NS_KEY_MODIFIER
164 @retval EFI_DEVICE_ERROR Keyboard layout is invalid.
169 UsbKeyCodeToEfiInputKey (
170 IN USB_KB_DEV
*UsbKeyboardDevice
,
172 OUT EFI_INPUT_KEY
*Key
176 Resets USB keyboard buffer.
178 @param KeyboardBuffer Points to the USB keyboard buffer.
184 OUT USB_KB_BUFFER
*KeyboardBuffer
188 Check whether USB keyboard buffer is empty.
190 @param KeyboardBuffer USB keyboard buffer
192 @retval TRUE Keyboard buffer is empty.
193 @retval FALSE Keyboard buffer is not empty.
198 IsUSBKeyboardBufferEmpty (
199 IN USB_KB_BUFFER
*KeyboardBuffer
203 Check whether USB keyboard buffer is full.
205 @param KeyboardBuffer USB keyboard buffer
207 @retval TRUE Keyboard buffer is full.
208 @retval FALSE Keyboard buffer is not full.
213 IsUSBKeyboardBufferFull (
214 IN USB_KB_BUFFER
*KeyboardBuffer
218 Inserts a keycode into keyboard buffer.
220 @param KeyboardBuffer Points to the USB keyboard buffer.
221 @param Key Keycode to insert.
222 @param Down TRUE means key is pressed.
223 FALSE means key is released.
229 IN OUT USB_KB_BUFFER
*KeyboardBuffer
,
235 Remove a keycode from keyboard buffer and return it.
237 @param KeyboardBuffer Points to the USB keyboard buffer.
238 @param UsbKey Points to the buffer that contains keycode for output.
240 @retval EFI_SUCCESS Keycode successfully removed from keyboard buffer.
241 @retval EFI_DEVICE_ERROR Keyboard buffer is empty.
247 IN OUT USB_KB_BUFFER
*KeyboardBuffer
,
252 Handler for Repeat Key event.
254 This function is the handler for Repeat Key event triggered
256 After a repeatable key is pressed, the event would be triggered
257 with interval of USBKBD_REPEAT_DELAY. Once the event is triggered,
258 following trigger will come with interval of USBKBD_REPEAT_RATE.
260 @param Event The Repeat Key event.
261 @param Context Points to the USB_KB_DEV instance.
266 USBKeyboardRepeatHandler (
272 Sets USB keyboard LED state.
274 @param UsbKeyboardDevice The USB_KB_DEV instance.
280 IN USB_KB_DEV
*UsbKeyboardDevice