/** @file\r
Generic ARM implementation of TimerLib.h\r
\r
- Copyright (c) 2011, ARM Limited. All rights reserved.\r
+ Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
\r
#include <Base.h>\r
+#include <Library/ArmLib.h>\r
#include <Library/BaseLib.h>\r
#include <Library/TimerLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/PcdLib.h>\r
-#include <Library/ArmV7ArchTimerLib.h>\r
-#include <Chipset/ArmV7.h>\r
+#include <Library/ArmArchTimerLib.h>\r
\r
#define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/1000000U)\r
\r
RETURN_STATUS\r
EFIAPI\r
-ArmArchTimerLibConstructor (\r
+TimerConstructor (\r
VOID\r
)\r
{\r
// manual lower bound of the frequency is in the range of 1-10MHz\r
ASSERT (TICKS_PER_MICRO_SEC);\r
\r
+#ifdef MDE_CPU_ARM\r
+ // Only set the frequency for ARMv7. We expect the secure firmware to have already do it\r
// If the security extensions are not implemented set Timer Frequency\r
- if ((ArmReadIdPfr1 () & 0xF0)) {\r
+ if ((ArmReadIdPfr1 () & 0xF0) == 0x0) {\r
ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));\r
}\r
+#endif\r
\r
// Architectural Timer Frequency must be set in the Secure privileged(if secure extensions are supported) mode.\r
// If the reset value (0) is returned just ASSERT.\r
TimerFreq = ArmArchTimerGetTimerFreq ();\r
- ASSERT (TimerFreq);\r
+ ASSERT (TimerFreq != 0);\r
\r
} else {\r
- DEBUG ((EFI_D_ERROR, "ARM Architectural Timer is not available in the CPU, Hence cann't use this library \n"));\r
+ DEBUG ((EFI_D_ERROR, "ARM Architectural Timer is not available in the CPU, hence this library can not be used.\n"));\r
ASSERT (0);\r
}\r
\r
UINT64 TimerTicks64;\r
UINT64 SystemCounterVal;\r
\r
- // Calculate counter ticks that can represent requsted delay\r
+ // Calculate counter ticks that can represent requested delay\r
TimerTicks64 = MultU64x32 (MicroSeconds, TICKS_PER_MICRO_SEC);\r
\r
// Read System Counter value\r
\r
@param NanoSeconds The minimum number of nanoseconds to delay.\r
\r
- @return The value of NanoSeconds inputted.\r
+ @return The value of NanoSeconds inputed.\r
\r
**/\r
UINTN\r
\r
if (EndValue != NULL) {\r
// Timer counts down to 0x0\r
- *EndValue = 0xFFFFFFFFFFFFFFFF;;\r
+ *EndValue = 0xFFFFFFFFFFFFFFFFUL;\r
}\r
\r
return (UINT64)ArmArchTimerGetTimerFreq ();\r