+ //\r
+\r
+ // Get current counter value\r
+ CurrentValue = ArmReadCntPct ();\r
+ // Get the counter value to compare with\r
+ CompareValue = ArmReadCntpCval ();\r
+\r
+ // This loop is needed in case we missed interrupts (eg: case when the interrupt handling\r
+ // has taken longer than mTickPeriod).\r
+ // Note: Physical Counter is counting up\r
+ mElapsedPeriod = 0;\r
+ do {\r
+ CompareValue += mTimerTicks;\r
+ mElapsedPeriod++;\r
+ } while (CompareValue < CurrentValue);\r
+\r
+ // Set next compare value\r
+ ArmWriteCntpCval (CompareValue);\r