Revision: 18329
          http://sourceforge.net/p/edk2/code/18329
Author:   vanjeff
Date:     2015-08-27 02:08:56 +0000 (Thu, 27 Aug 2015)
Log Message:
-----------
SourceLevelDebugPkg/DebugTimer: Timer count value 0 not calculated

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 <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
    
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h

Modified: 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c
===================================================================
--- 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c 
    2015-08-27 02:05:20 UTC (rev 18328)
+++ 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.c 
    2015-08-27 02:08:56 UTC (rev 18329)
@@ -19,7 +19,7 @@
 
   @param[out] TimerFrequency  Local APIC timer frequency returned.
   @param[in]  DumpFlag        If TRUE, dump Local APIC timer's parameter.
- 
+
   @return   32-bit Local APIC timer init count.
 **/
 UINT32
@@ -108,8 +108,8 @@
 
 /**
   Check if the timer is time out.
-  
-  @param[in] TimerCycle             Timer total count.
+
+  @param[in] TimerCycle             Timer initial count.
   @param[in] Timer                  The start timer from the begin.
   @param[in] TimeoutTicker          Ticker number need time out.
 
@@ -138,11 +138,11 @@
     Delta = Timer - CurrentTimer;
   } else {
     //
-    // Handle one roll-over. 
+    // Handle one roll-over.
     //
-    Delta = TimerCycle - (CurrentTimer - Timer);
+    Delta = TimerCycle - (CurrentTimer - Timer) + 1;
   }
- 
+
   return (BOOLEAN) (Delta >= TimeoutTicker);
 }
 

Modified: 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h
===================================================================
--- 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h 
    2015-08-27 02:05:20 UTC (rev 18328)
+++ 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugTimer.h 
    2015-08-27 02:08:56 UTC (rev 18329)
@@ -20,7 +20,7 @@
 
   @param[out] TimerFrequency  Local APIC timer frequency returned.
   @param[in]  DumpFlag        If TRUE, dump Local APIC timer's parameter.
- 
+
   @return   32-bit Local APIC timer init count.
 **/
 UINT32
@@ -31,8 +31,8 @@
 
 /**
   Check if the timer is time out.
-  
-  @param[in] TimerCycle             Timer total count.
+
+  @param[in] TimerCycle             Timer initial count.
   @param[in] Timer                  The start timer from the begin.
   @param[in] TimeoutTicker          Ticker number need time out.
 


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to