diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-08-27 10:12:00 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-27 10:12:00 +0000 |
commit | 33292af5f13b18ef5124f32a7bbf0b05b2d519c5 (patch) | |
tree | c29b177431d691ee1e6ff0112f0d542605e0a5ee /ArmPkg/Drivers | |
parent | 8f1cbb011faf2435fa976e61ba7e1ab46a5a09d0 (diff) | |
download | edk2-platforms-33292af5f13b18ef5124f32a7bbf0b05b2d519c5.tar.xz |
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/Drivers')
-rw-r--r-- | ArmPkg/Drivers/TimerDxe/TimerDxe.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c index 633876bea6..ccdb38c79b 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c @@ -141,12 +141,13 @@ TimerDriverSetTimerPeriod ( ArmArchTimerDisableTimer ();
if (TimerPeriod != 0) {
- // Convert TimerPeriod to micro sec units
- TimerTicks = DivU64x32 (TimerPeriod, 10);
+ // TimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3
+ // = TimerPeriod.10^-4 x Frequency.10^-3
+ // = (TimerPeriod x Frequency) x 10^-7
+ TimerTicks = MultU64x32 (TimerPeriod, FixedPcdGet32 (PcdArmArchTimerFreqInHz));
+ TimerTicks = DivU64x32 (TimerTicks, 10000000U);
- TimerTicks = MultU64x32 (TimerTicks, (PcdGet32(PcdArmArchTimerFreqInHz)/1000000));
-
- ArmArchTimerSetTimerVal((UINTN)TimerTicks);
+ ArmArchTimerSetTimerVal ((UINTN)TimerTicks);
// Enable the timer
ArmArchTimerEnableTimer ();
|