HI
My system: Ubuntu 2.6.31. Language C, compiler: gcc
I am running dynamic timer as a kernel module and my issue is that the once the timer overflows , the program finishes. On the other hand i have forced to arm the timer again because of a while loop but the timer never is started again.
i am targetting a periodic timer but it runs once and thats it.
any ideas?
thx
Code:
#include <asm/param.h>
#include <linux/sched.h>
#include "ktimer.h"
struct timer_list mtimer;
int actual_module(void);
void handler(unsigned long z);
int actual_module()
{
int k=0,x=0;
init_timer(&mtimer);
mtimer.function=handler;
while(k<2){
x=mod_timer(&mtimer, jiffies +2*HZ ) ;
schedule();
k++;
}
//timeout=expire-jiffies;
return 0;
}
void handler(unsigned long z)
{
printk("the timer overflows \n");
return;
}
static int __init ktimer_init(void)
{
int err = 0;
printk(KERN_INFO "dynamic timer module init\n");
err= actual_module();
if(err != 0)
{
return err;
}
return 0;
}
static void __exit ktimer_exit(void)
{
del_singleshot_timer_sync(&mtimer);
return;
}
module_init(ktimer_init);
module_exit(ktimer_exit);