/*
*
*HOW TO PROGRAM with timer
*
*/
#include<linux/module.h>
#include<linux/init.h> /* kind of macros */
#include<linux/kernel.h>
#include<linux/timer.h>
static unsigned int i=0;
struct timer_list mytimer;
void timer_callback(void)
{
printk("i=%d\n",i++);
mod_timer(&mytimer,jiffies+10*HZ);
}
/* init the module */
static int __init timer_init(void)
{
printk("timer test.\n");
*
*HOW TO PROGRAM with timer
*
*/
//the tips to use the timer
//1)declare the timer_list structure
//2)call the init_timer();
//3)set the field of the struct timer_list;
//4) add_timer();
//5)write the callback function of timer
//6)mod_timer();
//7)del_timer();
#include<linux/module.h>
#include<linux/init.h> /* kind of macros */
#include<linux/kernel.h>
#include<linux/timer.h>
static unsigned int i=0;
struct timer_list mytimer;
void timer_callback(void)
{
printk("i=%d\n",i++);
mod_timer(&mytimer,jiffies+10*HZ);
}
/* init the module */
static int __init timer_init(void)
{
printk("timer test.\n");