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

Function rt_ktime_hrtimer_start

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

Source from the content-addressed store, hash-verified

194}
195
196rt_err_t rt_ktime_hrtimer_start(rt_ktime_hrtimer_t timer, unsigned long delay_cnt)
197{
198 rt_base_t level;
199
200 /* parameter check */
201 RT_ASSERT(timer != RT_NULL);
202 RT_ASSERT(delay_cnt < (_HRTIMER_MAX_CNT / 2));
203
204 timer->delay_cnt = delay_cnt;
205 timer->timeout_cnt = timer->delay_cnt + rt_ktime_cputimer_getcnt();
206
207 level = rt_spin_lock_irqsave(&_spinlock);
208
209 if (timer->flag & RT_TIMER_FLAG_ACTIVATED)
210 {
211 rt_spin_unlock_irqrestore(&_spinlock, level);
212 return -RT_ERROR;
213 }
214
215 _insert_timer_to_list_locked(timer);
216 _set_next_timeout_locked();
217
218 rt_spin_unlock_irqrestore(&_spinlock, level);
219
220 return RT_EOK;
221}
222
223rt_err_t rt_ktime_hrtimer_stop(rt_ktime_hrtimer_t timer)
224{

Callers 3

rt_ktime_hrtimer_sleepFunction · 0.85
rtthread_timer_wrapperFunction · 0.85
timer_settimeFunction · 0.85

Calls 5

_set_next_timeout_lockedFunction · 0.85
rt_ktime_cputimer_getcntFunction · 0.70
rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected