]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/Misc/Stall.c
2 UEFI Miscellaneous boot Services Stall service implementation
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
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
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.
24 Introduces a fine-grained stall.
26 @param Microseconds The number of microseconds to stall execution.
28 @retval EFI_SUCCESS Execution was stalled for at least the requested
29 amount of microseconds.
30 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
42 if (gMetronome
== NULL
) {
43 return EFI_NOT_AVAILABLE_YET
;
47 // Calculate the number of ticks by dividing the number of microseconds by
49 // Calculation is based on 100ns unit.
51 Counter
= (UINT32
) DivU64x32Remainder (
53 gMetronome
->TickPeriod
,
58 // Call WaitForTick for Counter + 1 ticks to try to guarantee Counter tick
59 // periods, thus attempting to ensure Microseconds of stall time.
65 gMetronome
->WaitForTick (gMetronome
, Counter
);