Re: Sharing real time interrupts with linux kernel interrupts
"Calin A. Culianu" <[email protected]> Fri, 30 Dec 2005 13:46:06 -0500 (EST)
| Newsgroups | gmane.linux.real-time.rtlinux.general |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 3 Sep 2004, Der Herr Hofrat wrote:
>> Hello to all!
>>
>>
>> I would like to share the Linux kernel space interrupts with a rt task.
>>
>>
>> When an interrupt arrives, the rt task check if the interrupt is from
>> the specific hardware of the task. If not, the rt task redirect the
>> interrupt to Linux kernel (like a software interrupt).
>>
>> How I implement this? Someone have some ideas?
>>
> Basically all you would need to do in the RT-isr is
> to check if the irq is from the RT-device and if not
> then mark the interrupt pending, when the rt-system is
> idle then the next non-rt interrupt (that is atleast the
> next timer interrupt) would hand the interrupt on to Linux
>
> give main/rtl_core.c:rtl_intercept a look.
Yeah, exactly what Hofrat said.
Here's a pseudocode example of this (actually this is code taken from my
driver):
static unsigned int interrupt_handler_rt(unsigned int irq,
struct pt_regs *regs)
{
(void)regs;
board_handle_interrupt(); /* This sets interrupt_was_for_me */
if (interrupt_was_for_me) { /* Force this IRQ enabled right now if
this interrupt was for me, so as to
immediately invoke this handler again
if another interrupt is waiting.. */
/* rtl_hard_enable_irq tells the IRQ controller to turn on a
particular IRQ right *now*.
This hangs the system if called unconditionally -- DESPITE what the
RTLinux docs will tell you! */
rtl_hard_enable_irq(irq);
} else {
/* Now, pend the IRQ to linux if the interrupt wasn't for me.
NB: I am not sure if this can mean interrupts could potentially be
lost if the board and a different board both asserted the same IRQ
line at the same time. I am assuming that can't happen, so I only pend
the IRQ to linux if the interrupt wasn't for me. */
rtl_global_pend_irq(irq);
}
return 0;
}
_______________________________________________
Rtl mailing list
[email protected]
http://hq.fsmlabs.com/mailman/listinfo/rtl
http:/www.rtlinux-gpl.org/