kernel: Cleanup _ms_to_ticks().

This commit moves all implementations of the _ms_to_ticks() into
single file. Also, the function is now inline even if
_NEED_PRECISE_TICK_MS_CONVERSION is defined.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit is contained in:
Piotr Zięcik 2018-06-11 13:47:39 +02:00 committed by Anas Nashif
commit fe2ac39bf2
2 changed files with 5 additions and 13 deletions

View file

@ -1336,14 +1336,15 @@ __syscall void *k_thread_custom_data_get(void);
#define _NON_OPTIMIZED_TICKS_PER_SEC
#endif
#ifdef _NON_OPTIMIZED_TICKS_PER_SEC
extern s32_t _ms_to_ticks(s32_t ms);
#else
static ALWAYS_INLINE s32_t _ms_to_ticks(s32_t ms)
{
#ifdef _NON_OPTIMIZED_TICKS_PER_SEC
s64_t ms_ticks_per_sec = (s64_t)ms * sys_clock_ticks_per_sec;
return (s32_t)ceiling_fraction(ms_ticks_per_sec, MSEC_PER_SEC);
#else
return (s32_t)ceiling_fraction((u32_t)ms, _ms_per_tick);
}
#endif
}
/* added tick needed to account for tick in progress */
#ifdef CONFIG_TICKLESS_KERNEL