Doubt about interrupts in xilinx zedboard BSP

Sergio Paracuellos sparacuellos at orbitalcs.com
Tue Apr 18 07:24:25 UTC 2017


Hi all,

I am trying to exec some code over xilinx-zynq zedboard. The code tries to
make use of interrupts. I am installing the interrupt routine for the
interrupt vector  using rtems_interrupt_handler_install routine which is
seems the correct one for this board. When the interrupt is trigered the
handler is correctly called but it becomes in a infinite loop status when
the interrupt is being handled. So is obvious that i am doing something
wrong. The pseudo code for this is like the following:

#include <bsp.h>
#include <stdlib.h>
#include <rtems/irq.h>
#include <rtems/irq-extension.h>

#define MAX_NUMBER_OF_MESSAGES 5

#define INTERRUPT_VECTOR_NUMBER 100

volatile int seq;

void MyInterruptHandler(void *arg)
{
    puts("Interrupt handler called\n");
    seq++;
}

rtems_task Init(rtems_task_argument argument)
{
    rtems_status_code sc;

    sc = rtems_interrupt_handler_install(
                           INTERRUPT_VECTOR_NUMBER,
                           "MY_INTERRUPT",
                           RTEMS_INTERRUPT_UNIQUE,
                           (rtems_interrupt_handler) MyInterruptHandler,
                            NULL
           );

     if (sc != RTEMS_SUCCESSFUL)
     {
           puts("MyInterruptHandler -> rtems_interrupt_handler_install()
error: %d\n", sc);
           exit(-1);
      }

     puts("Waiting for messages...\n");

     /* wait for five interrupts to be triggered */
    while (1)
    {
          if (seq == MAX_NUMBER_OF_MESSAGES)
              break;
     }

     puts("Max number of messages retrieved\n");
     exit(0);
}

The result is:

Waiting for messages...

Interrupt handler called
Interrupt handler called
Interrupt handler called
Interrupt handler called
Interrupt handler called
Interrupt handler called
Interrupt handler called
....

Enters in a infinite loop calling the interrupt handler....

This similar code runs for me in other OS, so i am a little lost. Also, I
couldn't find any example of using interrupts for zedboard.

What is missing in this code?

Thanks in advance,

Cheers,
    Sergio Paracuellos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170418/b39ad93d/attachment.html>


More information about the users mailing list