summaryrefslogtreecommitdiffstats
path: root/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-08-27 10:12:00 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-27 10:12:00 +0000
commit33292af5f13b18ef5124f32a7bbf0b05b2d519c5 (patch)
treec29b177431d691ee1e6ff0112f0d542605e0a5ee /ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
parent8f1cbb011faf2435fa976e61ba7e1ab46a5a09d0 (diff)
downloadedk2-33292af5f13b18ef5124f32a7bbf0b05b2d519c5.tar.gz
edk2-33292af5f13b18ef5124f32a7bbf0b05b2d519c5.tar.bz2
edk2-33292af5f13b18ef5124f32a7bbf0b05b2d519c5.zip
ArmPkg/TimerDxe: Changed calculation to allow 1KHz granularity frequency
Prior to this change the frequency was rounded to 1Mhz. This change rounds the timer frequency to 1KHz. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15921 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c')
-rw-r--r--ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
index d1cd0c8e6e..4fe7cb8d64 100644
--- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
+++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
@@ -82,8 +82,10 @@ MicroSecondDelay (
UINT64 TimerTicks64;
UINT64 SystemCounterVal;
- // Calculate counter ticks that can represent requested delay
- TimerTicks64 = MultU64x32 (MicroSeconds, TICKS_PER_MICRO_SEC);
+ // Calculate counter ticks that can represent requested delay:
+ // = MicroSeconds x TICKS_PER_MICRO_SEC
+ // = MicroSeconds x Frequency.10^-6
+ TimerTicks64 = (MicroSeconds * PcdGet32 (PcdArmArchTimerFreqInHz)) / 1000000U;
// Read System Counter value
SystemCounterVal = ArmArchTimerGetSystemCount ();