acrn-hypervisor/hypervisor/include/lib
Junjie Mao e75cca64c8 HV: timer: keep TSC frequency in KHz
This patch represents TSC freqeuency in KHz using a 32-bit unsigned integer.

The conversion macros between ticks and us/ms are changed to inline functions to
enforce the types of the input parameters. Note that us_to_ticks accepts only
uint32_t (~4K us at most) and never overflows.

Results of some unit tests on the conversion functions:

    calibrate_tsc, tsc_khz=1881600
    64us -> ticks: 120422
    64us -> ticks -> us: 63
    511us -> ticks: 961497
    511us -> ticks -> us: 510
    1280000 ticks -> us: 680
    1280000 ticks -> us -> ticks: 1279488

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-03 10:18:06 +08:00
..
crypto license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00
atomic.h hv: refine the left atomic operation 2018-05-18 10:52:31 +08:00
bits.h HV:treewide:Update return type of function ffs64 and ffz64 2018-07-02 15:11:22 +08:00
errno.h license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00
list.h HV:header:fix "expression is not Boolean" 2018-06-20 14:19:47 +08:00
macros.h license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00
mem_mgt.h HV:treewide:Update return type of function ffs64 and ffz64 2018-07-02 15:11:22 +08:00
rtl.h HV: timer: keep TSC frequency in KHz 2018-07-03 10:18:06 +08:00
spinlock.h fix parted of "missing for discarded return value" 2018-06-19 16:21:45 +08:00
sprintf.h hv:replace unsigned long long with uint64_t 2018-06-12 10:21:19 +08:00
stdarg.h license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00
types.h HV:header:fix "expression is not Boolean" 2018-06-20 14:19:47 +08:00
util.h license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00