2 ACPI Timer implements one instance of Timer Library.
4 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/TimerLib.h>
17 #include <Library/BaseLib.h>
20 // Cached performance counter frequency
22 UINT64 mPerformanceCounterFrequency
= 0;
25 Internal function to retrieves the 64-bit frequency in Hz.
27 Internal function to retrieves the 64-bit frequency in Hz.
29 @return The frequency in Hz.
33 InternalGetPerformanceCounterFrequency (
37 BOOLEAN InterruptState
;
40 if (mPerformanceCounterFrequency
== 0) {
41 InterruptState
= SaveAndDisableInterrupts ();
42 Count
= GetPerformanceCounter ();
43 MicroSecondDelay (100);
44 mPerformanceCounterFrequency
= MultU64x32 (GetPerformanceCounter () - Count
, 10000);
45 SetInterruptState (InterruptState
);
47 return mPerformanceCounterFrequency
;