Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/hrtimer.h
Show All 30 Lines | |||||
#include <sys/_callout.h> | #include <sys/_callout.h> | ||||
#include <sys/_mutex.h> | #include <sys/_mutex.h> | ||||
#include <linux/ktime.h> | #include <linux/ktime.h> | ||||
#include <linux/timer.h> | #include <linux/timer.h> | ||||
enum hrtimer_mode { | enum hrtimer_mode { | ||||
HRTIMER_MODE_REL, | HRTIMER_MODE_REL, | ||||
HRTIMER_MODE_REL_PINNED, | |||||
}; | }; | ||||
enum hrtimer_restart { | enum hrtimer_restart { | ||||
HRTIMER_RESTART, | HRTIMER_RESTART, | ||||
HRTIMER_NORESTART, | HRTIMER_NORESTART, | ||||
}; | }; | ||||
struct hrtimer { | struct hrtimer { | ||||
enum hrtimer_restart (*function)(struct hrtimer *); | enum hrtimer_restart (*function)(struct hrtimer *); | ||||
struct mtx mtx; | struct mtx mtx; | ||||
struct callout callout; | struct callout callout; | ||||
s64 expires; /* relative time in nanoseconds */ | |||||
s64 precision; /* in nanoseconds */ | |||||
}; | }; | ||||
#define hrtimer_active(hrtimer) linux_hrtimer_active(hrtimer) | #define hrtimer_active(hrtimer) linux_hrtimer_active(hrtimer) | ||||
#define hrtimer_cancel(hrtimer) linux_hrtimer_cancel(hrtimer) | #define hrtimer_cancel(hrtimer) linux_hrtimer_cancel(hrtimer) | ||||
#define hrtimer_init(hrtimer, clock, mode) do { \ | #define hrtimer_init(hrtimer, clock, mode) do { \ | ||||
CTASSERT((clock) == CLOCK_MONOTONIC); \ | CTASSERT((clock) == CLOCK_MONOTONIC); \ | ||||
CTASSERT((mode) == HRTIMER_MODE_REL); \ | CTASSERT((mode) == HRTIMER_MODE_REL); \ | ||||
linux_hrtimer_init(hrtimer); \ | linux_hrtimer_init(hrtimer); \ | ||||
} while (0) | } while (0) | ||||
#define hrtimer_set_expires(hrtimer, time) \ | #define hrtimer_set_expires(hrtimer, time) \ | ||||
linux_hrtimer_set_expires(hrtimer, time) | linux_hrtimer_set_expires(hrtimer, time) | ||||
#define hrtimer_start(hrtimer, time, mode) do { \ | #define hrtimer_start(hrtimer, time, mode) do { \ | ||||
CTASSERT((mode) == HRTIMER_MODE_REL); \ | CTASSERT((mode) == HRTIMER_MODE_REL); \ | ||||
linux_hrtimer_start(hrtimer, time); \ | linux_hrtimer_start(hrtimer, time); \ | ||||
} while (0) | } while (0) | ||||
#define hrtimer_start_range_ns(hrtimer, time, prec, mode) do { \ | #define hrtimer_start_range_ns(hrtimer, time, prec, mode) do { \ | ||||
CTASSERT((mode) == HRTIMER_MODE_REL); \ | CTASSERT((mode) == HRTIMER_MODE_REL); \ | ||||
linux_hrtimer_start_range_ns(hrtimer, time, prec); \ | linux_hrtimer_start_range_ns(hrtimer, time, prec); \ | ||||
} while (0) | } while (0) | ||||
#define hrtimer_forward_now(hrtimer, interval) do { \ | |||||
linux_hrtimer_forward_now(hrtimer, interval) \ | |||||
} while (0) | |||||
bool linux_hrtimer_active(struct hrtimer *); | bool linux_hrtimer_active(struct hrtimer *); | ||||
int linux_hrtimer_cancel(struct hrtimer *); | int linux_hrtimer_cancel(struct hrtimer *); | ||||
void linux_hrtimer_init(struct hrtimer *); | void linux_hrtimer_init(struct hrtimer *); | ||||
void linux_hrtimer_set_expires(struct hrtimer *, ktime_t); | void linux_hrtimer_set_expires(struct hrtimer *, ktime_t); | ||||
void linux_hrtimer_start(struct hrtimer *, ktime_t); | void linux_hrtimer_start(struct hrtimer *, ktime_t); | ||||
void linux_hrtimer_start_range_ns(struct hrtimer *, ktime_t, int64_t); | void linux_hrtimer_start_range_ns(struct hrtimer *, ktime_t, int64_t); | ||||
void linux_hrtimer_forward_now(struct hrtimer *, ktime_t); | |||||
#endif /* _LINUX_HRTIMER_H_ */ | #endif /* _LINUX_HRTIMER_H_ */ |