0> 固定步骤:
第1步:定义定时器:
struct timer_list my_time;
第2步:初始化:
init_time(&my_time);
第3步:实例化:
my_timer.expirex = jiffies + delay; /*期望定时值*/
my_timer.date = 0; /*传给定时器处理函数的参数,不用时写0*/
my_timer.function = my_fun; /*定时器处理函数*/
第4步:启动:
add_timer(&my_timer); /*这句话后,定时器开始工作*/
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1> 小简化操作:
将2, 3步合并:setup_time(&my_time, my_fun, 0);
my_timer.expirex = jiffies + delay;
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2> 大简化操作:
将1,2,3步合并:DEFINE_TIMER(my_time, my_fun, jiffies+delay, 0);
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
4> 更新定时器时刻:
int mod_timer(struct timer_list *timer, unsigned long expires);
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
5> 移除定时器:
int del_timer_sync(struct timer_list *timer);