3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
12 NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
16 #include "Metronome.h"
21 EFI_METRONOME_ARCH_PROTOCOL mMetronome
= {
22 WinNtMetronomeDriverWaitForTick
,
32 WinNtMetronomeDriverWaitForTick (
33 IN EFI_METRONOME_ARCH_PROTOCOL
*This
,
40 The WaitForTick() function waits for the number of ticks specified by
41 TickNumber from a known time source in the platform. If TickNumber of
42 ticks are detected, then EFI_SUCCESS is returned. The actual time passed
43 between entry of this function and the first tick is between 0 and
44 TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod
45 time has elapsed, wait for two ticks. This function waits for a hardware
46 event to determine when a tick occurs. It is possible for interrupt
47 processing, or exception processing to interrupt the execution of the
48 WaitForTick() function. Depending on the hardware source for the ticks, it
49 is possible for a tick to be missed. This function cannot guarantee that
50 ticks will not be missed. If a timeout occurs waiting for the specified
51 number of ticks, then EFI_TIMEOUT is returned.
55 This - The EFI_METRONOME_ARCH_PROTOCOL instance.
56 TickNumber - Number of ticks to wait.
60 EFI_SUCCESS - The wait for the number of ticks specified by TickNumber
68 // Calculate the time to sleep. Win API smallest unit to sleep is 1 millisec
69 // Tick Period is in 100ns units, divide by 10000 to convert to ms
71 SleepTime
= DivU64x32 (MultU64x32 ((UINT64
) TickNumber
, TICK_PERIOD
) + 9999, 10000);
72 gWinNt
->Sleep ((UINT32
) SleepTime
);
80 WinNtMetronomeDriverInitialize (
81 IN EFI_HANDLE ImageHandle
,
82 IN EFI_SYSTEM_TABLE
*SystemTable
88 Initialize the Metronome Architectural Protocol driver
92 ImageHandle - ImageHandle of the loaded driver
95 SystemTable - Pointer to the System Table
99 EFI_SUCCESS - Metronome Architectural Protocol created
101 EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
103 EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
112 // Install the Metronome Architectural Protocol onto a new handle
115 Status
= gBS
->InstallProtocolInterface (
117 &gEfiMetronomeArchProtocolGuid
,
118 EFI_NATIVE_INTERFACE
,