-/*++\r
-\r
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. <BR> \r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\r
-\r
-\r
-Module Name:\r
-\r
- CommPs2.c\r
- \r
-Abstract: \r
-\r
+/**@file\r
PS2 Mouse Communication Interface \r
+ \r
+Copyright (c) 2006 - 2007, 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
+http://opensource.org/licenses/bsd-license.php\r
\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Revision History\r
-\r
---*/\r
-\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
+**/\r
\r
#include "Ps2Mouse.h"\r
#include "CommPs2.h"\r
\r
UINT8 ResolutionTbl[MAX_CMR] = { 0, 1, 2, 3 };\r
\r
+/**\r
+ Issue self test command via IsaIo interface.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @return EFI_SUCCESS Success to do keyboard self testing.\r
+ @return others Fail to do keyboard self testing.\r
+**/\r
EFI_STATUS\r
KbcSelfTest (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 Data;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Issue command to enable keyboard AUX functionality.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
KbcEnableAux (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
//\r
// Send 8042 enable mouse command\r
return Out8042Command (IsaIo, ENABLE_AUX);\r
}\r
\r
+/**\r
+ Issue command to disable keyboard AUX functionality.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
KbcDisableAux (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
//\r
// Send 8042 disable mouse command\r
return Out8042Command (IsaIo, DISABLE_AUX);\r
}\r
\r
+/**\r
+ Issue command to enable keyboard.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
KbcEnableKb (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
//\r
// Send 8042 enable keyboard command\r
return Out8042Command (IsaIo, ENABLE_KB);\r
}\r
\r
+/**\r
+ Issue command to disable keyboard.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
KbcDisableKb (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
//\r
// Send 8042 disable keyboard command\r
return Out8042Command (IsaIo, DISABLE_KB);\r
}\r
\r
+/**\r
+ Issue command to check keyboard status.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param KeyboardEnable return whether keyboard is enable.\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
CheckKbStatus (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
OUT BOOLEAN *KeyboardEnable\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- KeyboardEnable - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 Data;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Issue command to reset keyboard.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
PS2MouseReset (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 Data;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Issue command to set mouse's sample rate\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param SampleRate value of sample rate \r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
PS2MouseSetSampleRate (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN MOUSE_SR SampleRate\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- SampleRate - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return Status;\r
}\r
\r
+/**\r
+ Issue command to set mouse's resolution.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Resolution value of resolution\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
PS2MouseSetResolution (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN MOUSE_RE Resolution\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Resolution - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return Status;\r
}\r
\r
+/**\r
+ Issue command to set mouse's scaling.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Scaling value of scaling\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
PS2MouseSetScaling (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN MOUSE_SF Scaling\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Scaling - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
UINT8 Command;\r
\r
return Out8042AuxCommand (IsaIo, Command, FALSE);\r
}\r
\r
+/**\r
+ Issue command to enable Ps2 mouse.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @return Status of command issuing.\r
+**/\r
EFI_STATUS\r
PS2MouseEnable (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
//\r
// Send auxiliary command to enable mouse\r
return Out8042AuxCommand (IsaIo, ENABLE_CMD, FALSE);\r
}\r
\r
-EFI_STATUS\r
-PS2MouseGetPacket (\r
- PS2_MOUSE_DEV *MouseDev\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
Get mouse packet . Only care first 3 bytes\r
\r
-Arguments:\r
-\r
- MouseDev - Pointer of PS2 Mouse Private Data Structure \r
+ @param MouseDev Pointer of PS2 Mouse Private Data Structure \r
\r
-Returns:\r
+ @retval EFI_NOT_READY Mouse Device not ready to input data packet, or some error happened during getting the packet\r
+ @retval EFI_SUCCESS The data packet is gotten successfully.\r
\r
- EFI_NOT_READY - Mouse Device not ready to input data packet, or some error happened during getting the packet\r
- EFI_SUCCESS - The data packet is gotten successfully.\r
+**/\r
+EFI_STATUS\r
+PS2MouseGetPacket (\r
+ PS2_MOUSE_DEV *MouseDev\r
+ )\r
\r
---*/\r
{\r
EFI_STATUS Status;\r
BOOLEAN KeyboardEnable;\r
}\r
}\r
\r
+/**\r
+ Read data via IsaIo protocol with given number.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Buffer Buffer receive data of mouse\r
+ @param BufSize The size of buffer\r
+ @param State Check input or read data\r
+ \r
+ @return status of reading mouse data.\r
+**/\r
EFI_STATUS\r
PS2MouseRead (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN OUT UINTN *BufSize,\r
IN UINTN State\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Buffer - GC_TODO: add argument description\r
- BufSize - GC_TODO: add argument description\r
- State - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINTN BytesRead;\r
//\r
// 8042 I/O function\r
//\r
+/**\r
+ I/O work flow of outing 8042 command.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Command I/O command.\r
+ \r
+ @retval EFI_SUCCESS Success to excute I/O work flow\r
+ @retval EFI_TIMEOUT Keyboard controller time out.\r
+**/\r
EFI_STATUS\r
Out8042Command (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN UINT8 Command\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Command - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 Data;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ I/O work flow of outing 8042 data.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Data Data value\r
+ \r
+ @retval EFI_SUCCESS Success to excute I/O work flow\r
+ @retval EFI_TIMEOUT Keyboard controller time out.\r
+**/\r
EFI_STATUS\r
Out8042Data (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN UINT8 Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Data - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 temp;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ I/O work flow of in 8042 data.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Data Data value\r
+ \r
+ @retval EFI_SUCCESS Success to excute I/O work flow\r
+ @retval EFI_TIMEOUT Keyboard controller time out.\r
+**/\r
EFI_STATUS\r
In8042Data (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN OUT UINT8 *Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Data - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_TIMEOUT - GC_TODO: Add description for return value\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
UINTN Delay;\r
UINT8 temp;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ I/O work flow of outing 8042 Aux command.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Command Aux I/O command\r
+ @param Resend Whether need resend the Aux command.\r
+ \r
+ @retval EFI_SUCCESS Success to excute I/O work flow\r
+ @retval EFI_TIMEOUT Keyboard controller time out.\r
+**/\r
EFI_STATUS\r
Out8042AuxCommand (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN UINT8 Command,\r
IN BOOLEAN Resend\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Command - GC_TODO: add argument description\r
- Resend - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 Data;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ I/O work flow of outing 8042 Aux data.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Command Aux I/O command\r
+ \r
+ @retval EFI_SUCCESS Success to excute I/O work flow\r
+ @retval EFI_TIMEOUT Keyboard controller time out.\r
+**/\r
EFI_STATUS\r
Out8042AuxData (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN UINT8 Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Data - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 Temp;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ I/O work flow of in 8042 Aux data.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Data Buffer holding return value.\r
+ \r
+ @retval EFI_SUCCESS Success to excute I/O work flow\r
+ @retval EFI_TIMEOUT Keyboard controller time out.\r
+**/\r
EFI_STATUS\r
In8042AuxData (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN OUT UINT8 *Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Data - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+\r
+/**\r
+ Check keyboard controller status, if it is output buffer full and for auxiliary device\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ \r
+ @retval EFI_SUCCESS Keyboard controller is ready\r
+ @retval EFI_NOT_READY Keyboard controller is not ready\r
+**/\r
EFI_STATUS\r
CheckForInput (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_NOT_READY - GC_TODO: Add description for return value\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
UINT8 Data;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ I/O work flow to wait input buffer empty in given time.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Timeout Wating time.\r
+ \r
+ @retval EFI_TIMEOUT if input is still not empty in given time.\r
+ @retval EFI_SUCCESS input is empty.\r
+**/\r
EFI_STATUS\r
WaitInputEmpty (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN UINTN Timeout\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- IsaIo - GC_TODO: add argument description\r
- Timeout - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_TIMEOUT - GC_TODO: Add description for return value\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
{\r
UINTN Delay;\r
UINT8 Data;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ I/O work flow to wait output buffer full in given time.\r
+ \r
+ @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL\r
+ @param Timeout given time\r
+ \r
+ @retval EFI_TIMEOUT output is not full in given time\r
+ @retval EFI_SUCCESS output is full in given time.\r
+**/\r
EFI_STATUS\r
WaitOutputFull (\r
IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
IN UINTN Timeout\r
)\r
-/*++\r
+/**\r
\r
Routine Description:\r
\r
EFI_TIMEOUT - GC_TODO: Add description for return value\r
EFI_SUCCESS - GC_TODO: Add description for return value\r
\r
---*/\r
+**/\r
{\r
UINTN Delay;\r
UINT8 Data;\r