Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/src/linux_hrtimer.c
Context not available. | |||||
hrtimer = arg; | hrtimer = arg; | ||||
ret = hrtimer->function(hrtimer); | ret = hrtimer->function(hrtimer); | ||||
MPASS(ret == HRTIMER_NORESTART); | |||||
callout_deactivate(&hrtimer->callout); | if (ret == HRTIMER_RESTART) { | ||||
callout_schedule_sbt(&hrtimer->callout, | |||||
nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0); | |||||
} else { | |||||
callout_deactivate(&hrtimer->callout); | |||||
} | |||||
} | } | ||||
bool | bool | ||||
Context not available. | |||||
{ | { | ||||
hrtimer->function = NULL; | hrtimer->function = NULL; | ||||
hrtimer->expires = 0; | |||||
hrtimer->precision = 0; | |||||
mtx_init(&hrtimer->mtx, "hrtimer", NULL, MTX_DEF | MTX_RECURSE); | mtx_init(&hrtimer->mtx, "hrtimer", NULL, MTX_DEF | MTX_RECURSE); | ||||
callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0); | callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0); | ||||
} | } | ||||
void | void | ||||
linux_hrtimer_set_expires(struct hrtimer *hrtimer __unused, | linux_hrtimer_set_expires(struct hrtimer *hrtimer, ktime_t time) | ||||
ktime_t time __unused) | |||||
{ | { | ||||
hrtimer->expires = ktime_to_ns(time); | |||||
} | } | ||||
void | void | ||||
Context not available. | |||||
} | } | ||||
void | void | ||||
linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, int64_t nsec) | linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, | ||||
int64_t nsec) | |||||
{ | |||||
mtx_lock(&hrtimer->mtx); | |||||
hrtimer->precision = nsec; | |||||
callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(time)), | |||||
nstosbt(nsec), hrtimer_call_handler, hrtimer, 0); | |||||
mtx_unlock(&hrtimer->mtx); | |||||
} | |||||
void | |||||
linux_hrtimer_forward_now(struct hrtimer *hrtimer, ktime_t interval) | |||||
{ | { | ||||
mtx_lock(&hrtimer->mtx); | mtx_lock(&hrtimer->mtx); | ||||
callout_reset_sbt(&hrtimer->callout, nstosbt(time), nstosbt(nsec), | callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(interval)), | ||||
hrtimer_call_handler, hrtimer, 0); | nstosbt(hrtimer->precision), hrtimer_call_handler, hrtimer, 0); | ||||
mtx_unlock(&hrtimer->mtx); | mtx_unlock(&hrtimer->mtx); | ||||
} | } | ||||
Context not available. |