ReactOS 0.4.16-dev-199-g898cc56
hwtimer.c File Reference
#include "acpi.h"
#include "accommon.h"
Include dependency graph for hwtimer.c:

Go to the source code of this file.

Macros

#define EXPORT_ACPI_INTERFACES
 
#define _COMPONENT   ACPI_HARDWARE
 

Functions

ACPI_STATUS AcpiGetTimerResolution (UINT32 *Resolution)
 
ACPI_STATUS AcpiGetTimer (UINT32 *Ticks)
 
ACPI_STATUS AcpiGetTimerDuration (UINT32 StartTicks, UINT32 EndTicks, UINT32 *TimeElapsed)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_HARDWARE

Definition at line 49 of file hwtimer.c.

◆ EXPORT_ACPI_INTERFACES

#define EXPORT_ACPI_INTERFACES

Definition at line 44 of file hwtimer.c.

Function Documentation

◆ AcpiGetTimer()

ACPI_STATUS AcpiGetTimer ( UINT32 Ticks)

Definition at line 106 of file hwtimer.c.

108{
110 UINT64 TimerValue;
111
112
114
115
116 if (!Ticks)
117 {
119 }
120
121 /* ACPI 5.0A: PM Timer is optional */
122
123 if (!AcpiGbl_FADT.XPmTimerBlock.Address)
124 {
126 }
127
128 Status = AcpiHwRead (&TimerValue, &AcpiGbl_FADT.XPmTimerBlock);
129 if (ACPI_SUCCESS (Status))
130 {
131 /* ACPI PM Timer is defined to be 32 bits (PM_TMR_LEN) */
132
133 *Ticks = (UINT32) TimerValue;
134 }
135
137}
unsigned long long UINT64
unsigned int UINT32
#define AE_SUPPORT
Definition: acexcep.h:123
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
UINT32 ACPI_STATUS
Definition: actypes.h:460
Status
Definition: gdiplustypes.h:25
ACPI_STATUS AcpiHwRead(UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg)
Definition: hwregs.c:259
ACPI_STATUS AcpiGetTimer(UINT32 *Ticks)
Definition: hwtimer.c:106

Referenced by AcpiGetTimer().

◆ AcpiGetTimerDuration()

ACPI_STATUS AcpiGetTimerDuration ( UINT32  StartTicks,
UINT32  EndTicks,
UINT32 TimeElapsed 
)

Definition at line 172 of file hwtimer.c.

176{
178 UINT64 DeltaTicks;
179 UINT64 Quotient;
180
181
183
184
185 if (!TimeElapsed)
186 {
188 }
189
190 /* ACPI 5.0A: PM Timer is optional */
191
192 if (!AcpiGbl_FADT.XPmTimerBlock.Address)
193 {
195 }
196
197 if (StartTicks == EndTicks)
198 {
199 *TimeElapsed = 0;
201 }
202
203 /*
204 * Compute Tick Delta:
205 * Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
206 */
207 DeltaTicks = EndTicks;
208 if (StartTicks > EndTicks)
209 {
210 if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0)
211 {
212 /* 24-bit Timer */
213
214 DeltaTicks |= (UINT64) 1 << 24;
215 }
216 else
217 {
218 /* 32-bit Timer */
219
220 DeltaTicks |= (UINT64) 1 << 32;
221 }
222 }
223 DeltaTicks -= StartTicks;
224
225 /*
226 * Compute Duration (Requires a 64-bit multiply and divide):
227 *
228 * TimeElapsed (microseconds) =
229 * (DeltaTicks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
230 */
232 ACPI_PM_TIMER_FREQUENCY, &Quotient, NULL);
233
234 *TimeElapsed = (UINT32) Quotient;
236}
#define AE_OK
Definition: acexcep.h:97
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 EndTicks
Definition: acpixf.h:1199
#define ACPI_FADT_32BIT_TIMER
Definition: actbl.h:344
#define ACPI_USEC_PER_SEC
Definition: actypes.h:471
#define ACPI_PM_TIMER_FREQUENCY
Definition: actypes.h:431
ACPI_STATUS AcpiUtShortDivide(UINT64 InDividend, UINT32 Divisor, UINT64 *OutQuotient, UINT32 *OutRemainder)
Definition: utmath.c:337
#define NULL
Definition: types.h:112
ACPI_STATUS AcpiGetTimerDuration(UINT32 StartTicks, UINT32 EndTicks, UINT32 *TimeElapsed)
Definition: hwtimer.c:172

Referenced by AcpiGetTimerDuration().

◆ AcpiGetTimerResolution()

ACPI_STATUS AcpiGetTimerResolution ( UINT32 Resolution)

Definition at line 67 of file hwtimer.c.

69{
71
72
73 if (!Resolution)
74 {
76 }
77
78 if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0)
79 {
80 *Resolution = 24;
81 }
82 else
83 {
84 *Resolution = 32;
85 }
86
88}
ACPI_STATUS AcpiGetTimerResolution(UINT32 *Resolution)
Definition: hwtimer.c:67
static BYTE Resolution
Definition: mouse.c:35

Referenced by AcpiGetTimerResolution().