Kernel timers#
See: embetronicx tutorial
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| #include <linux/timer.h>
static struct timer_list *timer;
static int loop = 5;
static void timer_fn(struct timer_list *t)
{
pr_info("timer function invoked\n");
if (loop--) {
timer.expires = jiffies + HZ;
add_timer(timer);
}
}
static void init_dev(void)
{
[...]
timer_setup(timer, timer_fn, 0);
timer.expires = jiffies + HZ;
add_timer(&timer);
[...]
}
|
References#