]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / TerminalConIn.c
index 6d0899d694f92c66747a69bbab3dc815eb3acb15..b82ff3d8afcf76e0563c71cb78975ac1330de3cd 100644 (file)
@@ -15,7 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "Terminal.h"\r
 \r
 \r
-\r
 /**\r
   Reads the next keystroke from the input device. The WaitForKey Event can\r
   be used to test for existance of a keystroke via WaitForEvent () call.\r
@@ -601,6 +600,9 @@ TerminalConInCheckForKey (
 \r
     SerialInTimeOut = 0;\r
     if (Mode->BaudRate != 0) {\r
+      //\r
+      // According to BAUD rate to calculate the timeout value.\r
+      //\r
       SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN) Mode->BaudRate;\r
     }\r
 \r
@@ -621,11 +623,11 @@ TerminalConInCheckForKey (
     }\r
   }\r
   //\r
-  //  check whether serial buffer is empty\r
+  //  Check whether serial buffer is empty.\r
   //\r
   Status = SerialIo->GetControl (SerialIo, &Control);\r
 \r
-  if (0 != (Control & EFI_SERIAL_INPUT_BUFFER_EMPTY)) {\r
+  if ((Control & EFI_SERIAL_INPUT_BUFFER_EMPTY) != 0) {\r
     //\r
     // Translate all the raw data in RawFIFO into EFI Key,\r
     // according to different terminal type supported.\r
@@ -701,6 +703,9 @@ GetOneKeyFromSerial (
   Size    = 1;\r
   *Output = 0;\r
 \r
+  //\r
+  // Read one key from serial I/O device.\r
+  //\r
   Status  = SerialIo->Read (SerialIo, &Size, Output);\r
 \r
   if (EFI_ERROR (Status)) {\r
@@ -1119,36 +1124,39 @@ UnicodeToEfiKeyFlushState (
 {\r
   EFI_INPUT_KEY Key;\r
 \r
-  if (0 != (TerminalDevice->InputState & INPUT_STATE_ESC)) {\r
+  if ((TerminalDevice->InputState & INPUT_STATE_ESC) != 0) {\r
     Key.ScanCode    = SCAN_ESC;\r
     Key.UnicodeChar = 0;\r
     EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
   }\r
 \r
-  if (0 != (TerminalDevice->InputState & INPUT_STATE_CSI)) {\r
+  if ((TerminalDevice->InputState & INPUT_STATE_CSI) != 0) {\r
     Key.ScanCode    = SCAN_NULL;\r
     Key.UnicodeChar = CSI;\r
     EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
   }\r
 \r
-  if (0 != (TerminalDevice->InputState & INPUT_STATE_LEFTOPENBRACKET)) {\r
+  if ((TerminalDevice->InputState & INPUT_STATE_LEFTOPENBRACKET) != 0) {\r
     Key.ScanCode    = SCAN_NULL;\r
     Key.UnicodeChar = LEFTOPENBRACKET;\r
     EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
   }\r
 \r
-  if (0 != (TerminalDevice->InputState & INPUT_STATE_O)) {\r
+  if ((TerminalDevice->InputState & INPUT_STATE_O) != 0) {\r
     Key.ScanCode    = SCAN_NULL;\r
     Key.UnicodeChar = 'O';\r
     EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
   }\r
 \r
-  if (0 != (TerminalDevice->InputState & INPUT_STATE_2)) {\r
+  if ((TerminalDevice->InputState & INPUT_STATE_2) != 0) {\r
     Key.ScanCode    = SCAN_NULL;\r
     Key.UnicodeChar = '2';\r
     EfiKeyFiFoInsertOneKey (TerminalDevice, Key);\r
   }\r
 \r
+  //\r
+  // Cancel the timer.\r
+  //\r
   gBS->SetTimer (\r
         TerminalDevice->TwoSecondTimeOut,\r
         TimerCancel,\r