2008-06-17 14:26:01 Can userspace application wait on an interrupt?
Ben Burleson (UNITED STATES)
Message: 57421
This might be showing my lack of Linux understanding, but it seems like there must be an easier way to do this...
I'm using bfin_simple_timer to clock pulses to a stepper motor. My naive approach with the timer was to poll (busy wait) its status and wait until the irq_counts increased. This basically works for one; however, I need multiple, concurrent instances and that poor little CPU gets slammed in this case and the timing is not met.
Ideally, I'd like to have a way to tell my userspace thread to wait until the interrupt used by bfin_simple_timer is triggered. I found one hint of a function that does this (called intwait), but I don't think that is included in any standard linux distro because I can't find any real documentation (or source) on it.
I'm guessing I will need to push more of my stepper motor driver functionality down into the kernel to be able to use the timer interrupt properly.
Please let me know if I'm missing something.
Thanks,
Ben
QuoteReplyEditDelete
2008-06-17 15:47:21 Re: Can userspace application wait on an interrupt?
Graham Davies (UNITED STATES)
Message: 57423
How responsive do you want your application to be to the interrupt? Seconds? Tenths? Milliseconds? The answer to this may help you decide to push more functionality into kernel space (not the kernel itself, I think, as you should be able to do what you need in a tasklet).
Graham.
QuoteReplyEditDelete
2008-06-17 16:53:55 Re: Can userspace application wait on an interrupt?
Ben Burleson (UNITED STATES)
Message: 57428
Thanks for the prompt response Graham.
Tens-of-microseconds. The shorter the period, the faster the motor moves, so it starts with a longer timer and ramps up to full speed which is currently a 40usec period, so two 20usec timers (output high for one, output low for one).
I read the doc wiki page on tasklets and I think it would be more straight-forward to just write a kernel space driver that handles everything.
Cheers,
Ben