mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-02 05:34:04 +00:00
- replace the usage of mdelay with udelay - remove lib/mdelay.c - rename udelay.c to misc.c future other small APIs could put in misc.c Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
21 lines
365 B
C
21 lines
365 B
C
/*
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <hv_lib.h>
|
|
|
|
void udelay(uint32_t us)
|
|
{
|
|
uint64_t dest_tsc, delta_tsc;
|
|
|
|
/* Calculate number of ticks to wait */
|
|
delta_tsc = us_to_ticks(us);
|
|
dest_tsc = rdtsc() + delta_tsc;
|
|
|
|
/* Loop until time expired */
|
|
while (rdtsc() < dest_tsc) {
|
|
}
|
|
}
|