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
26 // The package level header files this module uses
30 // The protocols, PPI and GUID defintions for this module
32 #include <Protocol/SimpleTextIn.h>
33 #include <Guid/HotPlugDevice.h>
34 #include <Protocol/UsbIo.h>
35 #include <Protocol/DevicePath.h>
37 // The Library classes this module consumes
39 #include <Library/DebugLib.h>
40 #include <Library/ReportStatusCodeLib.h>
41 #include <Library/BaseMemoryLib.h>
42 #include <Library/UefiRuntimeServicesTableLib.h>
43 #include <Library/UefiDriverEntryPoint.h>
44 #include <Library/UefiBootServicesTableLib.h>
45 #include <Library/UefiLib.h>
46 #include <Library/MemoryAllocationLib.h>
47 #include <Library/PcdLib.h>
48 #include <Library/UsbLib.h>
51 #include <IndustryStandard/Usb.h>
53 #define MAX_KEY_ALLOWED 32
55 #define HZ 1000 * 1000 * 10
56 #define USBKBD_REPEAT_DELAY ((HZ) / 2)
57 #define USBKBD_REPEAT_RATE ((HZ) / 50)
60 #define SUBCLASS_BOOT 1
61 #define PROTOCOL_KEYBOARD 1
63 #define BOOT_PROTOCOL 0
64 #define REPORT_PROTOCOL 1
72 USB_KEY buffer
[MAX_KEY_ALLOWED
+ 1];
77 #define USB_KB_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'k', 'b', 'd')
80 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
81 EFI_EVENT DelayedRecoveryEvent
;
82 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput
;
83 EFI_USB_IO_PROTOCOL
*UsbIo
;
85 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor
;
86 EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor
;
88 USB_KB_BUFFER KeyboardBuffer
;
95 UINT8 LastKeyCodeArray
[8];
99 EFI_EVENT RepeatTimer
;
101 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
108 extern EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding
;
109 extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName
;
110 extern EFI_GUID gEfiUsbKeyboardDriverGuid
;
113 KbdReportStatusCode (
114 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
115 IN EFI_STATUS_CODE_TYPE CodeType
,
116 IN EFI_STATUS_CODE_VALUE Value
119 #define USB_KB_DEV_FROM_THIS(a) \
120 CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)
122 #define MOD_CONTROL_L 0x01
123 #define MOD_CONTROL_R 0x10
124 #define MOD_SHIFT_L 0x02
125 #define MOD_SHIFT_R 0x20
126 #define MOD_ALT_L 0x04
127 #define MOD_ALT_R 0x40
128 #define MOD_WIN_L 0x08
129 #define MOD_WIN_R 0x80
136 #define USB_KEYCODE_MAX_MAKE 0x64
138 #define USBKBD_VALID_KEYCODE(key) ((UINT8) (key) > 3)
143 UINT8 ScrollLock
: 1;