All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] rt_intr_wait bug during debugging
@ 2013-09-23  8:48 Paolo Minazzi
  2013-09-23 18:25 ` Gilles Chanteperdrix
  2013-09-24  7:38 ` Philippe Gerum
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Minazzi @ 2013-09-23  8:48 UTC (permalink / raw)
  To: xenomai

Hi to all,
the problem arise when I debug an application that uses an external 
interrupt.
Below there is a sample (pseudo) code that show how I can see the problem.
The irq stuff is related on my specific machine, so I think it is not 
important
give details about GPIO programming and interrupt clear (CLEAR_IRQ).

To see the problem :
1. I put a breakpoint on the usleep
2. I countinue to send "c" to stop always in the breakpoint.

When all is OK the cnt grows up.

Sometime, after several "c", I encounter the bug.
At this point the cnt is always the same and stops to grow up.
This happen because the irq line is disabled ! I check it seeing the VIC 
register.

I verified that if I put only a breakpoint in the
     asm("nop")
the irq line in the VIC register is disabled. This means that xenomai 
disable the irq line because
I enabled the irq line before with
     rt_intr_enable(&int_desc);
When restart with "c", xenomai is able to enable again the irq line.

For some reason xenomai sometimes does not enable irq line anymore and 
the code
in blocked in the
     rt_intr_wait(&int_desc, TM_INFINITE);
line.

If I enter in the bug condition and manually enable the irq line 
(programming the VIC register)
all works again without problem. If I continue my test I will re-enter 
in the bug condition ...

Only a dubt : in the xenomai example

http://www.xenomai.org/documentation/xenomai-2.4/html/api/user__irq_8c-example.html#a1 


there is not the rt_intr_enable in the irq_server. I don't know if it is 
out problem or not.

I tried to debug and I have some log, but for me it is difficult 
understand the real source of the
bug. I have a system on which I can see the problem with a minimal effort.

To be clear, there is no problem executing the xenomai application 
without debugger.

Regards
Paolo Minazzi






######################################################################################### 

void irq_server(void *cookie)
{
         while (1)
         {
                 rt_intr_enable(&int_desc);

                 asm("nop");

                 rt_intr_wait(&int_desc, TM_INFINITE);

                 CLEAR_IRQ();

                 cnt++;
         }
}
void InitIrq(void)
{
         init_irq_fujitsu();

         rt_intr_create(&int_desc, IRQNAME, IRQNUMBER, I_PROPAGATE );

         rt_task_create(&server_desc, "Irq2ms", TASK_STKSZ, TASK_PRIO, 
TASK_MODE);

         rt_task_start(&server_desc, &irq_server, NULL);

         enable_irq_fujitsu();
}

int main(int argc, char* argv[])
{
         mlockall(MCL_CURRENT|MCL_FUTURE);

         rt_timer_set_mode ( 0 );
         rt_task_set_mode(0, 0, /* T_WARNSW ,*/ NULL);

         MapRegistersARM();

         InitIrq();

         while(1)
         {
                 printf("[ %4d ]\n",cnt);
  ======>        usleep(10000);
         }
}
######################################################################################### 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-24  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23  8:48 [Xenomai] rt_intr_wait bug during debugging Paolo Minazzi
2013-09-23 18:25 ` Gilles Chanteperdrix
2013-09-24  7:26   ` Paolo Minazzi
2013-09-24  7:38 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.