Linux 高精度定时器(hrtimer)

(174条消息) Linux内核开发基础-低精度timer_list和高精度hrtimer定时器_hrtimer和timer_奔跑的码仔的博客-CSDN博客

(174条消息) Linux内核高精度定时器hrtimer的使用_Kunaly的博客-CSDN博客

启动定时器:

hrtimer_init(&sw_uport->uart_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);

sw_uport->uart_timer.function = uart_set_rs485;

hrtimer_start(&sw_uport->uart_timer, sw_uport->tout ,HRTIMER_MODE_REL);

static enum hrtimer_restart uart_set_rs485(struct hrtimer *u_timer) {     

        /*

        ....

        */

         hrtimer_forward_now(u_timer, sw_uport->tout);     

        return HRTIMER_RESTART;

}

你可能感兴趣的:(学习)