hrtimer

High-resolutionkernel timers(hrtimer)

1.create hrtimer object

struct hrtimer vibe_timer;

2.initialization object

void hrtimer_init(struct hrtimer *timer, clockid_tclock_id,

enum hrtimer_mode mode);

hrtimer_int(&vibe_timer,CLOCK_MONOTONIC,HRTIMER_MODE_REL);
vibe_timer.function = vibrator_timer_func;

3.star thrtimer

inthrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode);

static inlinektime_t ktime_set(const long secs, const unsigned long nsecs)

hrtimer_start(&vibe_timer,ktime_set(value /1000,(value %1000)*1000000),HRTIMER_MODE_REL);

4.cancle hrtimer

inthrtimer_cancel(struct hrtimer *timer);

5.function

 
 

ktime_thrtimer_get_remaining(const struct hrtimer *timer)


你可能感兴趣的:(linux,hrtimer)