]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SourceLevelDebugPkg/DebugTimer: Timer count value 0 not calculated
authorJeff Fan <jeff.fan@intel.com>
Thu, 27 Aug 2015 02:08:56 +0000 (02:08 +0000)
committervanjeff <vanjeff@Edk2>
Thu, 27 Aug 2015 02:08:56 +0000 (02:08 +0000)
Actually, TimerCycle is APIC timer's initial count. Timer count value 0 is
missed when calculating Delta value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18329 6f19259b-4bc3-4df7-8a09-765794883524

SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h

index bf965cb3c94e22fc8e4d0af40a921751aee91568..e287c4cbbe9561d1d2aa4c5249fe9d56e5d4d58e 100644 (file)
@@ -19,7 +19,7 @@
 \r
   @param[out] TimerFrequency  Local APIC timer frequency returned.\r
   @param[in]  DumpFlag        If TRUE, dump Local APIC timer's parameter.\r
\r
+\r
   @return   32-bit Local APIC timer init count.\r
 **/\r
 UINT32\r
@@ -108,8 +108,8 @@ SaveAndSetDebugTimerInterrupt (
 \r
 /**\r
   Check if the timer is time out.\r
-  \r
-  @param[in] TimerCycle             Timer total count.\r
+\r
+  @param[in] TimerCycle             Timer initial count.\r
   @param[in] Timer                  The start timer from the begin.\r
   @param[in] TimeoutTicker          Ticker number need time out.\r
 \r
@@ -138,11 +138,11 @@ IsDebugTimerTimeout (
     Delta = Timer - CurrentTimer;\r
   } else {\r
     //\r
-    // Handle one roll-over. \r
+    // Handle one roll-over.\r
     //\r
-    Delta = TimerCycle - (CurrentTimer - Timer);\r
+    Delta = TimerCycle - (CurrentTimer - Timer) + 1;\r
   }\r
\r
+\r
   return (BOOLEAN) (Delta >= TimeoutTicker);\r
 }\r
 \r
index 60550d42cfe33aaa47e6fd1c9773dabb7f84347c..e480fa3e0cd81c1c5d42aa05d7790c39055f1918 100644 (file)
@@ -20,7 +20,7 @@
 \r
   @param[out] TimerFrequency  Local APIC timer frequency returned.\r
   @param[in]  DumpFlag        If TRUE, dump Local APIC timer's parameter.\r
\r
+\r
   @return   32-bit Local APIC timer init count.\r
 **/\r
 UINT32\r
@@ -31,8 +31,8 @@ InitializeDebugTimer (
 \r
 /**\r
   Check if the timer is time out.\r
-  \r
-  @param[in] TimerCycle             Timer total count.\r
+\r
+  @param[in] TimerCycle             Timer initial count.\r
   @param[in] Timer                  The start timer from the begin.\r
   @param[in] TimeoutTicker          Ticker number need time out.\r
 \r