mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 04:02:05 +00:00
hv:move 'udelay' to timer.c
-- move this api from misc.c to timer.c to avoid reverse dependency, and remove misc.c Tracked-On: #1842 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
parent
370998ba5a
commit
5585084c00
@ -189,7 +189,6 @@ C_SRCS += arch/x86/guest/vmexit.c
|
||||
S_SRCS += arch/x86/guest/vmx_asm.S
|
||||
C_SRCS += arch/x86/guest/trusty.c
|
||||
C_SRCS += arch/x86/cat.c
|
||||
C_SRCS += lib/misc.c
|
||||
C_SRCS += lib/string.c
|
||||
C_SRCS += lib/memory.c
|
||||
C_SRCS += lib/crypto/crypto_api.c
|
||||
|
@ -318,3 +318,16 @@ uint64_t ticks_to_ms(uint64_t ticks)
|
||||
{
|
||||
return ticks / (uint64_t)tsc_khz;
|
||||
}
|
||||
|
||||
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) {
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ struct hv_timer {
|
||||
|
||||
#define CYCLES_PER_MS us_to_ticks(1000U)
|
||||
|
||||
void udelay(uint32_t us);
|
||||
|
||||
/**
|
||||
* @brief convert us to ticks.
|
||||
*
|
||||
|
@ -30,7 +30,6 @@ static inline bool is_space(char c)
|
||||
}
|
||||
|
||||
/* Function prototypes */
|
||||
void udelay(uint32_t us);
|
||||
int32_t strcmp(const char *s1_arg, const char *s2_arg);
|
||||
int32_t strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg);
|
||||
char *strncpy_s(char *d_arg, size_t dmax, const char *s_arg, size_t slen_arg);
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <hypervisor.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) {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user