RTAI Interript Problem

Wolfgang Grandegger wolfgang.grandegger at bluewin.ch
Thu Aug 1 19:15:33 CEST 2002


On 08/01/2002 06:40 PM, Usman S. Ansari wrote:

>Thanks to all of those who replied.
>
>Initially, I was trying to rt_enable_irq in the ISR itself, but this turn out to be a bad idea,
>since it locks up the system.
>

Why is it a bad idea? It should work assuming you have correctly handled
your interrupt source. If the interrupt is still pending when you do the
rt_enable_irq() it will hang your system (that's true for level-sensitive
interrupts only). In the "example/ppc" directory there is the example
cmp_irqs.c
using the CPM timer of the 8xx (you need the CPM-Multilevel-Patch
enabled in
the kernel). More comments below:

>Follwoing suggestion by some of you, I have a bottom half, which I am only using it to enable the
>interrupt after ISR is done. My ISR curretly is only  3 lines of code + 3 rt_printks.
>
>So, my init_module, beside registering irq and eanabling it, does following
>static RT_TASK     rtai_bh;
>int init_module (void)
>{
> .
> .
> .
>  rt_task_init(&rtai_bh, rtai_bottom_half, 0, 2000, 5, 0, 0);
>  rt_task_resume(&rtai_bh);
>  .
>  .
>}
>
>My bottom half
>
>static void rtai_bottom_half(int t)
>{
> while (1)
>    {
>     rt_printk("bottom half waiting for siganl\n");
>     rt_sleep(5);
>rt_printk("*** before suspend ***\n");
>     rt_task_suspend(rt_whoami());
>rt_printk("*** before suspend ***\n");
>     rt_printk("bottom half enabling interrupt\n");
>     rt_enable_irq(HUDSON_INTR_NUMBER);
>    }
>}
>
>I see the 
>bottom half waiting for siganl
>line printed in the syslog and never see 
>
>*** before suspend ***
>printed
>
>and it never pass rt_task_suspend line.
>

Remove rt_sleep(5). It will already suspend processing. Remember that you
do not have a RT timer running ==> your tasks will not be (re)scheduled.
You may want to use rt_busy_sleep() instead.

>In my ISR, 
>
>static void hudson_intr(void)
>{
> UINT16  control_1;
>
> printk("*** entering hudson ISR ***\n");
> control_1 = HB_HDSN_IRQ_STAT;
> HB_HDSN_IRQ_LCK = HUDSON_IRQ_RESET;
>
>printk("*** before resume ***\n");
>rt_task_resume(&rtai_bh);
>printk("*** after resume ***\n");
>
> return;
>}
>
>I see both 
>
>*** before resume ***\n
>*** after resume ***
>
>lines printed. Can you tell me what I am doing wrong, please ?
>

Hope it helps,

Wolfgang.







More information about the Rtai mailing list