interrupt example leon3

yaron o jaron0123 at gmail.com
Mon Oct 23 08:21:26 UTC 2017


Hello all

I want to add a new interrupt in my program ,
i check the rtems sample folder in order to see how to add one ,i found
the rtems-irq.c file and i did as the file says but im using a leon 3 and
theirs it says: error Example not intended for LEON3 CPU.
my question's are:
firs how to call an interrupt in leon3 after i put it inside the ISR table,
(i know that in some OS you just write asm {INT #} in order to invoke the
interrupt).

second i need some explain for the lines :
*(unsigned long *) (0x80000090) = 0xc;
*(unsigned long *) (0x80000098) = 0xc;
in code below  because i don't quit understand it ( maybe it's invoke the
interrupt but how does it relate to the handleExternalIrq) .

i add the rtems-irq.c bellow"
--------------------------------------------------------------------------
#include <rtems.h>
/* configuration information */

#define CONFIGURE_INIT

#include <bsp.h> /* for device driver prototypes */

rtems_task Init (rtems_task_argument argument);
rtems_isr handleExternalIrq (rtems_vector_number vector);

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER

#define CONFIGURE_MAXIMUM_TASKS             4

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)

#include <rtems/confdefs.h>

#include <stdlib.h>
#include <stdio.h>

rtems_task
Init
(
    rtems_task_argument argument
)
{
    rtems_status_code status;
    rtems_isr_entry old_handle;

    status = rtems_interrupt_catch (handleExternalIrq, 0x12, &old_handle);
    status = rtems_interrupt_catch (handleExternalIrq, 0x13, &old_handle);

#ifdef __erc32__
    *(unsigned long *) (0x1f8004c) = 0x7ff0;
    *(unsigned long *) (0x1f800d0) = 0x80000;
    *(unsigned long *) (0x1f80054) = 0x0c;
#elif defined(LEON2)
    *(unsigned long *) (0x80000090) = 0xc;
    *(unsigned long *) (0x80000098) = 0xc;
#elif defined(LEON3)
#error Example not intended for LEON3 CPU
#endif
    exit(0);
}

rtems_isr
handleExternalIrq
(
    rtems_vector_number vector
)
{
    printf ("External interrupt received with vector 0x%x\n", vector);
}


----------------------------------------------------------------

thanks a lot for the helpers !

Yaron .



--

[image: signature-1.gif]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20171023/9abfefb1/attachment.html>


More information about the users mailing list