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