diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_common.c b/bsp/stm32/libraries/HAL_Drivers/drv_common.c index c6fb516b0e..d868d63dfc 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_common.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_common.c @@ -58,7 +58,7 @@ void SysTick_Handler(void) uint32_t HAL_GetTick(void) { - return rt_hw_1ms_tick_get(); + return rt_tick_get_millisecond(); } void HAL_SuspendTick(void) diff --git a/components/net/lwip-1.4.1/src/arch/sys_arch.c b/components/net/lwip-1.4.1/src/arch/sys_arch.c index 0919c29e01..2f6dbb4143 100644 --- a/components/net/lwip-1.4.1/src/arch/sys_arch.c +++ b/components/net/lwip-1.4.1/src/arch/sys_arch.c @@ -618,7 +618,7 @@ u32_t sys_jiffies(void) u32_t sys_now(void) { - return rt_hw_1ms_tick_get(); + return rt_tick_get_millisecond(); } #ifdef RT_LWIP_PPP diff --git a/components/net/lwip-2.0.2/src/arch/sys_arch.c b/components/net/lwip-2.0.2/src/arch/sys_arch.c index 1404628a60..fbf02cad0a 100644 --- a/components/net/lwip-2.0.2/src/arch/sys_arch.c +++ b/components/net/lwip-2.0.2/src/arch/sys_arch.c @@ -628,7 +628,7 @@ u32_t sys_jiffies(void) u32_t sys_now(void) { - return rt_hw_1ms_tick_get(); + return rt_tick_get_millisecond(); } diff --git a/components/net/lwip-2.1.2/src/arch/sys_arch.c b/components/net/lwip-2.1.2/src/arch/sys_arch.c index 8905765440..a0eeed1073 100644 --- a/components/net/lwip-2.1.2/src/arch/sys_arch.c +++ b/components/net/lwip-2.1.2/src/arch/sys_arch.c @@ -642,7 +642,7 @@ u32_t sys_jiffies(void) u32_t sys_now(void) { - return rt_hw_1ms_tick_get(); + return rt_tick_get_millisecond(); } #if MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK diff --git a/include/rthw.h b/include/rthw.h index c3960350b8..89877faf90 100644 --- a/include/rthw.h +++ b/include/rthw.h @@ -134,11 +134,6 @@ void rt_hw_exception_install(rt_err_t (*exception_handle)(void *context)); */ void rt_hw_us_delay(rt_uint32_t us); -/* - * provides a tick value ALWAYS in millisecond - */ -rt_tick_t rt_hw_1ms_tick_get(void); - #ifdef RT_USING_SMP typedef union { unsigned long slock; diff --git a/include/rtthread.h b/include/rtthread.h index 27cfea19e0..1e0094e73b 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -77,6 +77,7 @@ rt_tick_t rt_tick_get(void); void rt_tick_set(rt_tick_t tick); void rt_tick_increase(void); rt_tick_t rt_tick_from_millisecond(rt_int32_t ms); +rt_tick_t rt_tick_get_millisecond(void); void rt_system_timer_init(void); void rt_system_timer_thread_init(void); diff --git a/src/clock.c b/src/clock.c index 778126fb23..24456fb23d 100644 --- a/src/clock.c +++ b/src/clock.c @@ -118,14 +118,14 @@ rt_tick_t rt_tick_from_millisecond(rt_int32_t ms) RTM_EXPORT(rt_tick_from_millisecond); /** - * This function provides a tick value ALWAYS in millisecond + * This function will provide the passed millisecond from boot. * - * @return 1ms-based tick + * @return passed millisecond from boot */ -RT_WEAK rt_tick_t rt_hw_1ms_tick_get(void) +RT_WEAK rt_tick_t rt_tick_get_millisecond(void) { -#if 1000 % RT_TICK_PER_SECOND == 0 - return rt_tick_get() * (1000U / RT_TICK_PER_SECOND); +#if 1000 % RT_TICK_PER_SECOND == 0u + return rt_tick_get() * (1000u / RT_TICK_PER_SECOND); #else #warning "rt-thread cannot provide a correct 1ms-based tick any longer,\ please redefine this function in another file by using a high-precision hard-timer."