]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Usb/UsbKbDxe/efikey.h
remove some comments introduced by tools.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbKbDxe / efikey.h
1 /** @file
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
7
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.
10
11 Module Name:
12
13 EfiKey.h
14
15 Abstract:
16
17 Header file for USB Keyboard Driver's Data Structures
18
19 Revision History
20
21 **/
22 #ifndef _USB_KB_H
23 #define _USB_KB_H
24
25
26 #include <PiDxe.h>
27
28 #include <Protocol/SimpleTextIn.h>
29 #include <Guid/HotPlugDevice.h>
30 #include <Protocol/UsbIo.h>
31 #include <Protocol/DevicePath.h>
32
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>
43
44
45 #include <IndustryStandard/Usb.h>
46
47 #define MAX_KEY_ALLOWED 32
48
49 #define HZ 1000 * 1000 * 10
50 #define USBKBD_REPEAT_DELAY ((HZ) / 2)
51 #define USBKBD_REPEAT_RATE ((HZ) / 50)
52
53 #define CLASS_HID 3
54 #define SUBCLASS_BOOT 1
55 #define PROTOCOL_KEYBOARD 1
56
57 #define BOOT_PROTOCOL 0
58 #define REPORT_PROTOCOL 1
59
60 typedef struct {
61 UINT8 Down;
62 UINT8 KeyCode;
63 } USB_KEY;
64
65 typedef struct {
66 USB_KEY buffer[MAX_KEY_ALLOWED + 1];
67 UINT8 bHead;
68 UINT8 bTail;
69 } USB_KB_BUFFER;
70
71 #define USB_KB_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'k', 'b', 'd')
72 typedef struct {
73 UINTN Signature;
74 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
75 EFI_EVENT DelayedRecoveryEvent;
76 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
77 EFI_USB_IO_PROTOCOL *UsbIo;
78
79 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
80 EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;
81
82 USB_KB_BUFFER KeyboardBuffer;
83 UINT8 CtrlOn;
84 UINT8 AltOn;
85 UINT8 ShiftOn;
86 UINT8 NumLockOn;
87 UINT8 CapsOn;
88 UINT8 ScrollOn;
89 UINT8 LastKeyCodeArray[8];
90 UINT8 CurKeyChar;
91
92 UINT8 RepeatKey;
93 EFI_EVENT RepeatTimer;
94
95 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
96
97 } USB_KB_DEV;
98
99 //
100 // Global Variables
101 //
102 extern EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding;
103 extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName;
104 extern EFI_GUID gEfiUsbKeyboardDriverGuid;
105
106 VOID
107 KbdReportStatusCode (
108 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
109 IN EFI_STATUS_CODE_TYPE CodeType,
110 IN EFI_STATUS_CODE_VALUE Value
111 );
112
113 #define USB_KB_DEV_FROM_THIS(a) \
114 CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)
115
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
124
125 typedef struct {
126 UINT8 Mask;
127 UINT8 Key;
128 } KB_MODIFIER;
129
130 #define USB_KEYCODE_MAX_MAKE 0x64
131
132 #define USBKBD_VALID_KEYCODE(key) ((UINT8) (key) > 3)
133
134 typedef struct {
135 UINT8 NumLock : 1;
136 UINT8 CapsLock : 1;
137 UINT8 ScrollLock : 1;
138 UINT8 Resrvd : 5;
139 } LED_MAP;
140 #endif