usleep: use div_const to optimize the usleep

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2024-09-12 18:14:39 +08:00
committed by Xiang Xiao
parent 62047aa3d0
commit f0d3c8ab2b
7 changed files with 23 additions and 10 deletions
+12
View File
@@ -206,10 +206,22 @@
#define TICK2HSEC(tick) div_const_roundnearest(tick, TICK_PER_HSEC)
#define TICK2SEC(tick) div_const_roundnearest(tick, TICK_PER_SEC)
/* MSEC2SEC */
#define MSEC2SEC(usec) div_const(msec, MSEC_PER_SEC)
/* USEC2SEC */
#define USEC2SEC(usec) div_const(usec, USEC_PER_SEC)
/* NSEC2USEC */
#define NSEC2USEC(nsec) div_const(nsec, NSEC_PER_USEC)
/* NSEC2MSEC */
#define NSEC2MSEC(nsec) div_const(nsec, NSEC_PER_MSEC)
#if defined(CONFIG_DEBUG_SCHED) && defined(CONFIG_SYSTEM_TIME64) && \
!defined(CONFIG_SCHED_TICKLESS)
/* Initial system timer ticks value close to maximum 32-bit value, to test