]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseTimerLibNullTemplate/TimerLibNull.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseTimerLibNullTemplate / TimerLibNull.c
1 /** @file
2 A non-functional instance of the Timer Library.
3
4 Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Base.h>
10 #include <Library/TimerLib.h>
11 #include <Library/DebugLib.h>
12
13 /**
14 Stalls the CPU for at least the given number of microseconds.
15
16 Stalls the CPU for the number of microseconds specified by MicroSeconds.
17
18 @param MicroSeconds The minimum number of microseconds to delay.
19
20 @return The value of MicroSeconds inputted.
21
22 **/
23 UINTN
24 EFIAPI
25 MicroSecondDelay (
26 IN UINTN MicroSeconds
27 )
28 {
29 ASSERT (FALSE);
30 return MicroSeconds;
31 }
32
33 /**
34 Stalls the CPU for at least the given number of nanoseconds.
35
36 Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
37
38 @param NanoSeconds The minimum number of nanoseconds to delay.
39
40 @return The value of NanoSeconds inputted.
41
42 **/
43 UINTN
44 EFIAPI
45 NanoSecondDelay (
46 IN UINTN NanoSeconds
47 )
48 {
49 ASSERT (FALSE);
50 return 0;
51 }
52
53 /**
54 Retrieves the current value of a 64-bit free running performance counter.
55
56 The counter can either count up by 1 or count down by 1. If the physical
57 performance counter counts by a larger increment, then the counter values
58 must be translated. The properties of the counter can be retrieved from
59 GetPerformanceCounterProperties().
60
61 @return The current value of the free running performance counter.
62
63 **/
64 UINT64
65 EFIAPI
66 GetPerformanceCounter (
67 VOID
68 )
69 {
70 ASSERT (FALSE);
71 return 0;
72 }
73
74 /**
75 Retrieves the 64-bit frequency in Hz and the range of performance counter
76 values.
77
78 If StartValue is not NULL, then the value that the performance counter starts
79 with immediately after is it rolls over is returned in StartValue. If
80 EndValue is not NULL, then the value that the performance counter end with
81 immediately before it rolls over is returned in EndValue. The 64-bit
82 frequency of the performance counter in Hz is always returned. If StartValue
83 is less than EndValue, then the performance counter counts up. If StartValue
84 is greater than EndValue, then the performance counter counts down. For
85 example, a 64-bit free running counter that counts up would have a StartValue
86 of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
87 that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
88
89 @param StartValue The value the performance counter starts with when it
90 rolls over.
91 @param EndValue The value that the performance counter ends with before
92 it rolls over.
93
94 @return The frequency in Hz.
95
96 **/
97 UINT64
98 EFIAPI
99 GetPerformanceCounterProperties (
100 OUT UINT64 *StartValue, OPTIONAL
101 OUT UINT64 *EndValue OPTIONAL
102 )
103 {
104 ASSERT (FALSE);
105
106 return (UINT64)(-1);
107 }
108
109 /**
110 Converts elapsed ticks of performance counter to time in nanoseconds.
111
112 This function converts the elapsed ticks of running performance counter to
113 time value in unit of nanoseconds.
114
115 @param Ticks The number of elapsed ticks of running performance counter.
116
117 @return The elapsed time in nanoseconds.
118
119 **/
120 UINT64
121 EFIAPI
122 GetTimeInNanoSecond (
123 IN UINT64 Ticks
124 )
125 {
126 ASSERT (FALSE);
127 return 0;
128 }