]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/TimerLib.h
Correct parameter UINTN to UINT32
[mirror_edk2.git] / MdePkg / Include / Library / TimerLib.h
1 /** @file
2 Timer Library Functions
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. 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
9
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.
12
13 **/
14
15 #ifndef __TIMER_LIB__
16 #define __TIMER_LIB__
17
18 /**
19 Stalls the CPU for at least the given number of microseconds.
20
21 Stalls the CPU for the number of microseconds specified by MicroSeconds.
22
23 @param MicroSeconds The minimum number of microseconds to delay.
24
25 @return MicroSeconds
26
27 **/
28 UINTN
29 EFIAPI
30 MicroSecondDelay (
31 IN UINTN MicroSeconds
32 );
33
34 /**
35 Stalls the CPU for at least the given number of nanoseconds.
36
37 Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
38
39 @param NanoSeconds The minimum number of nanoseconds to delay.
40
41 @return NanoSeconds
42
43 **/
44 UINTN
45 EFIAPI
46 NanoSecondDelay (
47 IN UINTN NanoSeconds
48 );
49
50 /**
51 Retrieves the current value of a 64-bit free running performance counter.
52
53 Retrieves the current value of a 64-bit free running performance counter. The
54 counter can either count up by 1 or count down by 1. If the physical
55 performance counter counts by a larger increment, then the counter values
56 must be translated. The properties of the counter can be retrieved from
57 GetPerformanceCounterProperties().
58
59 @return The current value of the free running performance counter.
60
61 **/
62 UINT64
63 EFIAPI
64 GetPerformanceCounter (
65 VOID
66 );
67
68 /**
69 Retrieves the 64-bit frequency in Hz and the range of performance counter
70 values.
71
72 If StartValue is not NULL, then the value that the performance counter starts
73 with immediately after is it rolls over is returned in StartValue. If
74 EndValue is not NULL, then the value that the performance counter end with
75 immediately before it rolls over is returned in EndValue. The 64-bit
76 frequency of the performance counter in Hz is always returned. If StartValue
77 is less than EndValue, then the performance counter counts up. If StartValue
78 is greater than EndValue, then the performance counter counts down. For
79 example, a 64-bit free running counter that counts up would have a StartValue
80 of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
81 that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
82
83 @param StartValue The value the performance counter starts with when it
84 rolls over.
85 @param EndValue The value that the performance counter ends with before
86 it rolls over.
87
88 @return The frequency in Hz.
89
90 **/
91 UINT64
92 EFIAPI
93 GetPerformanceCounterProperties (
94 OUT UINT64 *StartValue, OPTIONAL
95 OUT UINT64 *EndValue OPTIONAL
96 );
97
98 #endif