Need to disable timer or all interrupts from user space
I'm not sure if this is the right place to ask this question but here you go.
I have implemented a very fast (8KHz loops) PID controller in user space. I am getting the time from gettimeofday(). I use usleep to complete the loop (125us). When I dump the time values, I have loops that are over 125us. The system is soft_RT (99.9% it is within 125us). However, every 1sec I have very long loops (400us) and other 200us loops move often. I think these are due to the timer interrupt. Timer interrupt is suppose to be every 10ms in my kernel version (2.4.18). But somehow it needs longer servicing once every second. So, in order to get rid of these, I think I need to make a kernel loadable module and that I can call to disable timer interrupt from user space, then make another call to enable the timer interrupt (maybe even disable/enable all interrupts). The problem is I have not written KLM before. It seems that it is easy to do in this case. But I don't know how to make the module accessible from user space (how to make the call the mydisable/myenable). If anyone has done this and has it handy, it will be a lot of help! Also, since my control loops is dependant from micro-second time resolution, I am afraid that when I re-enable the timer interrupt, I may have time "jumps". Is this true? BTW, I will have to disable the timer interrupt close 5-20sec!!! This is the time it take for the stage I control to move from one end to the other. I hope my problem is clear! Help is greatly appreciated! System: Single board VME 800MHZ processor PC no Xwindows, no Network, basically nothing but my program Process is set as highest priority in user space. |
All times are GMT -5. The time now is 07:41 AM. |