]>
git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.c
2 A non-functional instance of the Timer Library.
4 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/TimerLib.h>
11 #include <Library/DebugLib.h>
12 #include <Library/EmuThunkLib.h>
13 #include <Library/UefiBootServicesTableLib.h>
14 #include <Library/UefiLib.h>
16 #include <Protocol/Timer.h>
21 Stalls the CPU for at least the given number of microseconds.
23 Stalls the CPU for the number of microseconds specified by MicroSeconds.
25 @param MicroSeconds The minimum number of microseconds to delay.
27 @return The value of MicroSeconds inputted.
36 return NanoSecondDelay (MicroSeconds
* 1000);
41 Stalls the CPU for at least the given number of nanoseconds.
43 Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
45 @param NanoSeconds The minimum number of nanoseconds to delay.
47 @return The value of NanoSeconds inputted.
56 gEmuThunk
->Sleep (NanoSeconds
);
62 Retrieves the current value of a 64-bit free running performance counter.
64 The counter can either count up by 1 or count down by 1. If the physical
65 performance counter counts by a larger increment, then the counter values
66 must be translated. The properties of the counter can be retrieved from
67 GetPerformanceCounterProperties().
69 @return The current value of the free running performance counter.
74 GetPerformanceCounter (
78 return gEmuThunk
->QueryPerformanceCounter ();
82 Retrieves the 64-bit frequency in Hz and the range of performance counter
85 If StartValue is not NULL, then the value that the performance counter starts
86 with immediately after is it rolls over is returned in StartValue. If
87 EndValue is not NULL, then the value that the performance counter end with
88 immediately before it rolls over is returned in EndValue. The 64-bit
89 frequency of the performance counter in Hz is always returned. If StartValue
90 is less than EndValue, then the performance counter counts up. If StartValue
91 is greater than EndValue, then the performance counter counts down. For
92 example, a 64-bit free running counter that counts up would have a StartValue
93 of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
94 that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
96 @param StartValue The value the performance counter starts with when it
98 @param EndValue The value that the performance counter ends with before
101 @return The frequency in Hz.
106 GetPerformanceCounterProperties (
107 OUT UINT64
*StartValue
, OPTIONAL
108 OUT UINT64
*EndValue OPTIONAL
112 if (StartValue
!= NULL
) {
115 if (EndValue
!= NULL
) {
116 *EndValue
= (UINT64
)-1LL;
119 return gEmuThunk
->QueryPerformanceFrequency ();