]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
Remove extra #includes where possible to make build more efficient
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / Ps2Keyboard.h
index d7cf700efad533607609d9dace101024fba6e7b1..1027f0ca10b34287284bd4018a50dc6177fddbb3 100644 (file)
@@ -1,7 +1,7 @@
-/**@file\r
+/** @file\r
   PS/2 keyboard driver header file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2009, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -12,11 +12,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#ifndef _PS2KEYBOARD_H\r
-#define _PS2KEYBOARD_H\r
+#ifndef _PS2KEYBOARD_H_\r
+#define _PS2KEYBOARD_H_\r
 \r
-#include <PiDxe.h>\r
-#include <Framework/StatusCode.h>\r
+#include <FrameworkDxe.h>\r
 \r
 #include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/SimpleTextInEx.h>\r
@@ -33,13 +32,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/TimerLib.h>\r
+\r
+//\r
+// Global Variables\r
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL   gKeyboardControllerDriver;\r
+extern EFI_COMPONENT_NAME_PROTOCOL   gPs2KeyboardComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL  gPs2KeyboardComponentName2;\r
 \r
 //\r
 // Driver Private Data\r
 //\r
 #define KEYBOARD_BUFFER_MAX_COUNT         32\r
-#define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE EFI_SIGNATURE_32 ('k', 'k', 'e', 'y')\r
-#define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE EFI_SIGNATURE_32 ('k', 'c', 'e', 'n')\r
+#define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE SIGNATURE_32 ('k', 'k', 'e', 'y')\r
+#define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('k', 'c', 'e', 'n')\r
 \r
 typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
   UINTN                                 Signature;\r
@@ -119,15 +126,6 @@ typedef struct {
 \r
 #define TABLE_END 0x0\r
 \r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL   gKeyboardControllerDriver;\r
-extern EFI_COMPONENT_NAME_PROTOCOL   gPs2KeyboardComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL  gPs2KeyboardComponentName2;\r
-\r
-extern EFI_GUID                      gSimpleTextInExNotifyGuid;\r
-\r
 //\r
 // Driver entry point\r
 //\r
@@ -182,6 +180,38 @@ InstallPs2KeyboardDriver (
 #define SCANCODE_SYS_REQ_MAKE           0x37\r
 #define SCANCODE_MAX_MAKE               0x60\r
 \r
+#define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA     BIT0        ///< 0 - Output register has no data; 1 - Output register has data\r
+#define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA      BIT1        ///< 0 - Input register has no data;  1 - Input register has data\r
+#define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG         BIT2        ///< Set to 0 after power on reset\r
+#define KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE     BIT3        ///< 0 - Data in input register is data; 1 - Data in input register is command\r
+#define KEYBOARD_STATUS_REGISTER_ENABLE_FLAG         BIT4        ///< 0 - Keyboard is disable; 1 - Keyboard is enable\r
+#define KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT    BIT5        ///< 0 - Transmit is complete without timeout; 1 - Transmit is timeout without complete\r
+#define KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT     BIT6        ///< 0 - Receive is complete without timeout; 1 - Receive is timeout without complete\r
+#define KEYBOARD_STATUS_REGISTER_PARITY              BIT7        ///< 0 - Odd parity; 1 - Even parity\r
+\r
+#define KEYBOARD_8042_COMMAND_READ                          0x20\r
+#define KEYBOARD_8042_COMMAND_WRITE                         0x60\r
+#define KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE       0xA7\r
+#define KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE        0xA8\r
+#define KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST          0xAA\r
+#define KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST  0xAB\r
+#define KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE    0xAD\r
+\r
+#define KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA             0xF4\r
+#define KEYBOARD_8048_COMMAND_RESET                         0xFF\r
+#define KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET          0xF0\r
+\r
+#define KEYBOARD_8048_RETURN_8042_BAT_SUCCESS               0xAA\r
+#define KEYBOARD_8048_RETURN_8042_BAT_ERROR                 0xFC\r
+#define KEYBOARD_8048_RETURN_8042_ACK                       0xFA\r
+\r
+\r
+//\r
+// Keyboard Controller Status\r
+//\r
+#define KBC_PARE  0x80  // Parity Error\r
+#define KBC_TIM   0x40  // General Time Out\r
+\r
 //\r
 // Other functions that are used among .c files\r
 //\r
@@ -200,7 +230,7 @@ UpdateStatusLights (
   );\r
 \r
 /**\r
-  write key to keyboard\r
+  write key to keyboard.\r
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
   @param Data      value wanted to be written\r
@@ -232,7 +262,7 @@ KeyGetchar (
   );\r
 \r
 /**\r
-  Perform 8042 controller and keyboard Initialization\r
+  Perform 8042 controller and keyboard Initialization.\r
   If ExtendedVerification is TRUE, do additional test for\r
   the keyboard interface\r
 \r
@@ -249,7 +279,7 @@ InitKeyboard (
   );\r
 \r
 /**\r
-  Disable the keyboard interface of the 8042 controller\r
+  Disable the keyboard interface of the 8042 controller.\r
 \r
   @param ConsoleIn   - the device instance\r
 \r
@@ -329,7 +359,7 @@ KeyboardWaitForKey (
   );\r
 \r
 /**\r
-  Read status register\r
+  Read status register.\r
 \r
   @param ConsoleIn  Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
 \r
@@ -346,7 +376,7 @@ KeyReadStatusRegister (
   If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device\r
   should not be in system.\r
 \r
-  @param[in]  BiosKeyboardPrivate   Keyboard Private Data Structure\r
+  @param[in]  ConsoleIn   Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
 \r
   @retval     TRUE                  Keyboard in System.\r
   @retval     FALSE                 Keyboard not in System.\r