2 Copyright (c) 2004 - 2007, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 Header file for USB Keyboard Driver's Data Structures
28 #include <Protocol/SimpleTextIn.h>
29 #include <Guid/HotPlugDevice.h>
30 #include <Protocol/UsbIo.h>
31 #include <Protocol/DevicePath.h>
33 #include <Library/DebugLib.h>
34 #include <Library/ReportStatusCodeLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/UefiRuntimeServicesTableLib.h>
37 #include <Library/UefiDriverEntryPoint.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/UefiLib.h>
40 #include <Library/MemoryAllocationLib.h>
41 #include <Library/PcdLib.h>
42 #include <Library/UsbLib.h>
45 #include <IndustryStandard/Usb.h>
47 #define MAX_KEY_ALLOWED 32
49 #define HZ 1000 * 1000 * 10
50 #define USBKBD_REPEAT_DELAY ((HZ) / 2)
51 #define USBKBD_REPEAT_RATE ((HZ) / 50)
54 #define SUBCLASS_BOOT 1
55 #define PROTOCOL_KEYBOARD 1
57 #define BOOT_PROTOCOL 0
58 #define REPORT_PROTOCOL 1
66 USB_KEY buffer
[MAX_KEY_ALLOWED
+ 1];
71 #define USB_KB_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'k', 'b', 'd')
74 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
75 EFI_EVENT DelayedRecoveryEvent
;
76 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput
;
77 EFI_USB_IO_PROTOCOL
*UsbIo
;
79 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor
;
80 EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor
;
82 USB_KB_BUFFER KeyboardBuffer
;
89 UINT8 LastKeyCodeArray
[8];
93 EFI_EVENT RepeatTimer
;
95 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
102 extern EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding
;
103 extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName
;
104 extern EFI_GUID gEfiUsbKeyboardDriverGuid
;
107 KbdReportStatusCode (
108 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
109 IN EFI_STATUS_CODE_TYPE CodeType
,
110 IN EFI_STATUS_CODE_VALUE Value
113 #define USB_KB_DEV_FROM_THIS(a) \
114 CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)
116 #define MOD_CONTROL_L 0x01
117 #define MOD_CONTROL_R 0x10
118 #define MOD_SHIFT_L 0x02
119 #define MOD_SHIFT_R 0x20
120 #define MOD_ALT_L 0x04
121 #define MOD_ALT_R 0x40
122 #define MOD_WIN_L 0x08
123 #define MOD_WIN_R 0x80
130 #define USB_KEYCODE_MAX_MAKE 0x64
132 #define USBKBD_VALID_KEYCODE(key) ((UINT8) (key) > 3)
137 UINT8 ScrollLock
: 1;