Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/src/linux_hrtimer.c
Show All 40 Lines | |||||
{ | { | ||||
struct hrtimer *hrtimer; | struct hrtimer *hrtimer; | ||||
enum hrtimer_restart ret; | enum hrtimer_restart ret; | ||||
hrtimer = arg; | hrtimer = arg; | ||||
ret = hrtimer->function(hrtimer); | ret = hrtimer->function(hrtimer); | ||||
if (ret == HRTIMER_RESTART) { | if (ret == HRTIMER_RESTART) { | ||||
callout_schedule_sbt(&hrtimer->callout, | callout_reset_sbt_on_arg1(&hrtimer->callout, | ||||
nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0); | nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), | ||||
hrtimer->callout.c_func, hrtimer->callout.c_arg, | |||||
hrtimer->function, -1, 0); | |||||
} else { | } else { | ||||
callout_deactivate(&hrtimer->callout); | callout_deactivate(&hrtimer->callout); | ||||
} | } | ||||
} | } | ||||
bool | bool | ||||
linux_hrtimer_active(struct hrtimer *hrtimer) | linux_hrtimer_active(struct hrtimer *hrtimer) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, | linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, | ||||
int64_t nsec) | int64_t nsec) | ||||
{ | { | ||||
mtx_lock(&hrtimer->mtx); | mtx_lock(&hrtimer->mtx); | ||||
hrtimer->precision = nsec; | hrtimer->precision = nsec; | ||||
callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(time)), | callout_reset_sbt_on_arg1(&hrtimer->callout, nstosbt(ktime_to_ns(time)), | ||||
nstosbt(nsec), hrtimer_call_handler, hrtimer, 0); | nstosbt(nsec), hrtimer_call_handler, hrtimer, | ||||
hrtimer->function, -1, 0); | |||||
mtx_unlock(&hrtimer->mtx); | mtx_unlock(&hrtimer->mtx); | ||||
} | } | ||||
void | void | ||||
linux_hrtimer_forward_now(struct hrtimer *hrtimer, ktime_t interval) | linux_hrtimer_forward_now(struct hrtimer *hrtimer, ktime_t interval) | ||||
{ | { | ||||
mtx_lock(&hrtimer->mtx); | mtx_lock(&hrtimer->mtx); | ||||
callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(interval)), | callout_reset_sbt_on_arg1(&hrtimer->callout, nstosbt(ktime_to_ns(interval)), | ||||
nstosbt(hrtimer->precision), hrtimer_call_handler, hrtimer, 0); | nstosbt(hrtimer->precision), hrtimer_call_handler, hrtimer, | ||||
hrtimer->function, -1, 0); | |||||
mtx_unlock(&hrtimer->mtx); | mtx_unlock(&hrtimer->mtx); | ||||
} | } | ||||