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