Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHi Kazu,
The jump back time I have experience with do_gettimeofday is captured in attached jpg. I apologize the terminology I use may cause confusion. The timestamp showing unreliable outcome. The major concern I have here is the GPIO receive pulse signal supposedly every 100ms so the interrupt handler get trigger on each pulse's rising edge and grab the current timestamp. Nonetheless, as the picture have show, it receive interrupt in 4, 11, 20, or even 40 msec, but not 100msec in between. The input signal come from a signal generator and verified with a scope to ensure each pulse is 100msec in between. I am trying to narrow down the cause of this problem by trying various setting to request_irq and using jiffies to see any different. The results are the same. Is it because I am not suppose to call timestamp in an interrupt handler? or was it because the system can't handle the fast pace pulse trigger? Any help is greatly appreciated. Following is my interrupt handler: static irqreturn_t gpio_irq_handler(int irq, void *dev_id) { int ipending = __builtin_rdctl(4); if((ipending & 0x03) > 0) { *(base_addr + 3) = 0;//Clear the Edge Capture do_gettimeofday(&tv); time_to_tm(tv.tv_sec, 0, &broken); printk ("%02d:%02d:%02d:%03ld\n",broken.tm_hour, broken.tm_min, broken.tm_sec, (tv.tv_usec/1000)); /////////////////////////////////////////////////////////////////////////////// } return IRQ_HANDLED; } Yeung