catching interrupts
Hi,
is it possible to catch e.g. the interrupt of the Parallelport (IRQ7 in my case) in userspace with a RT-Rreempt patched kernel?
--peter
Quoted 2 lines · Peter Feuerer
is it possible to catch e.g. the interrupt of the Parallelport (IRQ7 in my case) in userspace with a RT-Rreempt patched kernel?
A very simple solution would be to create a small kernel device driver that implements a blocking read function that always gets woken up by the parport interrupt service routine, then sending one dummy byte.
But i guess a better variant would be to adopt the IIO framework for your purpose (http://lkml.org/lkml/2006/8/30/22)
regards
Bernhard
Quoted 8 lines · Bernhard Kuhn
Quoted 2 lines · Peter Feuerer
is it possible to catch e.g. the interrupt of the Parallelport (IRQ7 in my case) in userspace with a RT-Rreempt patched kernel?
A very simple solution would be to create a small kernel device driver that implements a blocking read function that always gets woken up by the parport interrupt service routine, then sending one dummy byte.
That would be a very fast and easy to implement solution, but then I have to touch the kernel again. I wanted not to do that.
Quoted 2 lines
But i guess a better variant would be to adopt the IIO framework for your purpose (http://lkml.org/lkml/2006/8/30/22)
Great, seems like that's what I'm searching for. I will have a deeper look into this. Because if this is going to be in the mainline kernel, I don't have to touch the kernel at all.
Thanks.
regards,
--peter
Quoted 9 lines · Peter Feuerer
That would be a very fast and easy to implement solution, but then I have to touch the kernel again. I wanted not to do that.
Quoted 2 lines
But i guess a better variant would be to adopt the IIO framework for your purpose (http://lkml.org/lkml/2006/8/30/22)
Great, seems like that's what I'm searching for. I will have a deeper look into this. Because if this is going to be in the mainline kernel, I don't have to touch the kernel at all.
You have to touch it. You still need to write a kernel module which handles the interrupt in the first place.
tglx
Quoted 7 lines · Thomas Gleixner
Quoted 6 lines · Peter Feuerer
That would be a very fast and easy to implement solution, but then I have to touch the kernel again. I wanted not to do that.
Quoted 2 lines
But i guess a better variant would be to adopt the IIO framework for your purpose (http://lkml.org/lkml/2006/8/30/22)
Quoted 7 lines
Quoted 3 lines
Great, seems like that's what I'm searching for. I will have a deeper look into this. Because if this is going to be in the mainline kernel, I don't have to touch the kernel at all.
You have to touch it. You still need to write a kernel module which handles the interrupt in the first place.
But wouldn't it be a good idea to create a kernel driver which offers an abstract interface and add it to the mainline kernel or to the preempt patch? So that handling interrupts can really just happen by coding a userspace program?
Or is there no way to accomplish that? Sorry if this questions may sound stupid, I'm not that deep in the code,.. yet.
--peter
Quoted 8 lines · Peter Feuerer
Quoted 7 lines
Quoted 3 lines
Great, seems like that's what I'm searching for. I will have a deeper look into this. Because if this is going to be in the mainline kernel, I don't have to touch the kernel at all.
You have to touch it. You still need to write a kernel module which handles the interrupt in the first place.
Quoted 6 lines
But wouldn't it be a good idea to create a kernel driver which offers an abstract interface and add it to the mainline kernel or to the preempt patch? So that handling interrupts can really just happen by coding a userspace program?
Or is there no way to accomplish that? Sorry if this questions may sound stupid, I'm not that deep in the code,.. yet.
No. This can not work. The kernel side must be able to mask the device interrupt before invoking the user space handler. Otherwise it would not work with shared interrupts. Also the kernel needs control to shut down the device interrupt in case that the user space driver is broken, not running or whatever. Please read the UIO documentation, it explains this in detail.
tglx
Quoted 16 lines · Thomas Gleixner
Quoted 8 lines · Peter Feuerer
Quoted 7 lines
Quoted 3 lines
Great, seems like that's what I'm searching for. I will have a deeper look into this. Because if this is going to be in the mainline kernel, I don't have to touch the kernel at all.
You have to touch it. You still need to write a kernel module which handles the interrupt in the first place.
Quoted 6 lines
But wouldn't it be a good idea to create a kernel driver which offers an abstract interface and add it to the mainline kernel or to the preempt patch? So that handling interrupts can really just happen by coding a userspace program?
Or is there no way to accomplish that? Sorry if this questions may sound stupid, I'm not that deep in the code,.. yet.
Quoted 6 lines
No. This can not work. The kernel side must be able to mask the device interrupt before invoking the user space handler. Otherwise it would not work with shared interrupts. Also the kernel needs control to shut down the device interrupt in case that the user space driver is broken, not running or whatever. Please read the UIO documentation, it explains this in detail.
Okay, I'm going to read it as soon as possible. Thanks for the answers.
--peter