]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/Misc/Stall.c
3 UEFI Miscellaneous boot Services Stall service implementation
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 Introduces a fine-grained stall.
27 @param Microseconds The number of microseconds to stall execution.
29 @retval EFI_SUCCESS Execution was stalled for at least the requested
30 amount of microseconds.
31 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
43 if (gMetronome
== NULL
) {
44 return EFI_NOT_AVAILABLE_YET
;
48 // Calculate the number of ticks by dividing the number of microseconds by
50 // Calcullation is based on 100ns unit.
52 Counter
= (UINT32
) DivU64x32Remainder (
54 gMetronome
->TickPeriod
,
59 // Call WaitForTick for Counter + 1 ticks to try to guarantee Counter tick
60 // periods, thus attempting to ensure Microseconds of stall time.
66 gMetronome
->WaitForTick (gMetronome
, Counter
);