]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/TimerLib.h
Synchronization of MDE Library Spec., Mde.dec, and corresponding head files in MdePkg...
[mirror_edk2.git] / MdePkg / Include / Library / TimerLib.h
CommitLineData
fb3df220 1/** @file\r
50a64e5b 2 Provides calibrated delay and performance counter services.\r
fb3df220 3\r
50a64e5b 4Copyright (c) 2006 - 2008, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
fb3df220 9\r
50a64e5b 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
fb3df220 12\r
fb3df220 13**/\r
14\r
15#ifndef __TIMER_LIB__\r
16#define __TIMER_LIB__\r
17\r
18/**\r
fb3df220 19 Stalls the CPU for the number of microseconds specified by MicroSeconds.\r
20\r
21 @param MicroSeconds The minimum number of microseconds to delay.\r
22\r
8cefc2ee 23 @return The value of MicroSeconds inputted.\r
fb3df220 24\r
25**/\r
26UINTN\r
27EFIAPI\r
28MicroSecondDelay (\r
29 IN UINTN MicroSeconds\r
30 );\r
31\r
32/**\r
fb3df220 33 Stalls the CPU for the number of nanoseconds specified by NanoSeconds.\r
34\r
35 @param NanoSeconds The minimum number of nanoseconds to delay.\r
36\r
8cefc2ee 37 @return The value of NanoSeconds inputted.\r
fb3df220 38\r
39**/\r
40UINTN\r
41EFIAPI\r
42NanoSecondDelay (\r
43 IN UINTN NanoSeconds\r
44 );\r
45\r
46/**\r
2c8547ab 47 Retrieves the current value of a 64-bit free running performance counter. \r
48 The counter can either count up by 1 or count down by 1. If the physical\r
fb3df220 49 performance counter counts by a larger increment, then the counter values\r
50 must be translated. The properties of the counter can be retrieved from\r
51 GetPerformanceCounterProperties().\r
52\r
53 @return The current value of the free running performance counter.\r
54\r
55**/\r
56UINT64\r
57EFIAPI\r
58GetPerformanceCounter (\r
59 VOID\r
60 );\r
61\r
62/**\r
63 Retrieves the 64-bit frequency in Hz and the range of performance counter\r
64 values.\r
65\r
66 If StartValue is not NULL, then the value that the performance counter starts\r
67 with immediately after is it rolls over is returned in StartValue. If\r
68 EndValue is not NULL, then the value that the performance counter end with\r
69 immediately before it rolls over is returned in EndValue. The 64-bit\r
70 frequency of the performance counter in Hz is always returned. If StartValue\r
71 is less than EndValue, then the performance counter counts up. If StartValue\r
72 is greater than EndValue, then the performance counter counts down. For\r
73 example, a 64-bit free running counter that counts up would have a StartValue\r
74 of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter\r
75 that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.\r
76\r
77 @param StartValue The value the performance counter starts with when it\r
78 rolls over.\r
79 @param EndValue The value that the performance counter ends with before\r
80 it rolls over.\r
81\r
82 @return The frequency in Hz.\r
83\r
84**/\r
85UINT64\r
86EFIAPI\r
87GetPerformanceCounterProperties (\r
88 OUT UINT64 *StartValue, OPTIONAL\r
89 OUT UINT64 *EndValue OPTIONAL\r
90 );\r
91\r
92#endif\r