MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _cnt_convert

Function _cnt_convert

components/drivers/ktime/src/hrtimer.c:80–89  ·  view source on GitHub ↗

* @brief convert cnt from cputimer cnt to hrtimer cnt * * @param cnt * @return unsigned long */

Source from the content-addressed store, hash-verified

78 * @return unsigned long
79 */
80static unsigned long _cnt_convert(unsigned long cnt)
81{
82 unsigned long rtn = 0;
83 unsigned long count = cnt - rt_ktime_cputimer_getcnt();
84 if (count > (_HRTIMER_MAX_CNT / 2))
85 return 0;
86
87 rtn = (count * rt_ktime_cputimer_getres()) / rt_ktime_hrtimer_getres();
88 return rtn == 0 ? 1 : rtn; /* at least 1 */
89}
90
91static void _sleep_timeout(void *parameter)
92{

Callers 1

_set_next_timeout_lockedFunction · 0.85

Calls 3

rt_ktime_hrtimer_getresFunction · 0.85
rt_ktime_cputimer_getcntFunction · 0.70
rt_ktime_cputimer_getresFunction · 0.50

Tested by

no test coverage detected