mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-04 18:30:18 +00:00
hv:move several tsc APIs to timer.c
-- change 'tsc_khz' to static -- move these APIs from rtl.h to timer.c us_to_ticks() ticks_to_us() ticks_to_ms() rdtsc() Tracked-On: #1842 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
#define TIMER_H
|
||||
|
||||
#include <list.h>
|
||||
#include <rtl.h>
|
||||
|
||||
/**
|
||||
* @brief Timer
|
||||
@@ -48,6 +47,36 @@ struct hv_timer {
|
||||
|
||||
/* External Interfaces */
|
||||
|
||||
#define CYCLES_PER_MS us_to_ticks(1000U)
|
||||
|
||||
/**
|
||||
* @brief convert us to ticks.
|
||||
*
|
||||
* @return ticks
|
||||
*/
|
||||
uint64_t us_to_ticks(uint32_t us);
|
||||
|
||||
/**
|
||||
* @brief convert ticks to us.
|
||||
*
|
||||
* @return microsecond
|
||||
*/
|
||||
uint64_t ticks_to_us(uint64_t ticks);
|
||||
|
||||
/**
|
||||
* @brief convert ticks to ms.
|
||||
*
|
||||
* @return millisecond
|
||||
*/
|
||||
uint64_t ticks_to_ms(uint64_t ticks);
|
||||
|
||||
/**
|
||||
* @brief read tsc.
|
||||
*
|
||||
* @return tsc value
|
||||
*/
|
||||
uint64_t rdtsc(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize a timer structure.
|
||||
*
|
||||
@@ -138,6 +167,13 @@ void timer_init(void);
|
||||
*/
|
||||
void calibrate_tsc(void);
|
||||
|
||||
/**
|
||||
* @brief Get tsc.
|
||||
*
|
||||
* @return tsc(KHz)
|
||||
*/
|
||||
uint32_t get_tsc_khz(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user