source: rtems/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c @ 93b000e

4.115
Last change on this file since 93b000e was 93b000e, checked in by Daniel Cederman <cederman@…>, on Oct 1, 2014 at 11:53:03 AM

bsp/leon3: Replace the define LEON3_MP_IRQ with a weakly linked variable

The LEON3_MP_IRQ define is used to pick the IRQ to be used by the
shared memory driver and for inter-processor interrupts. On some LEON3
systems, for example the GR712RC, the default value of 14 is not suitable.
To make this value configurable from the application, it is replaced with
a weakly linked variable that can be overridden from the application.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1#include <rtems.h>
2#include <bsp.h>
3#include <bsp/irq-generic.h>
4
5static inline void bsp_dispatch_irq(int irq)
6{
7       bsp_interrupt_handler_entry *e =
8               &bsp_interrupt_handler_table[bsp_interrupt_handler_index(irq)];
9
10       while (e != NULL) {
11               (*e->handler)(e->arg);
12               e = e->next;
13       }
14}
15
16/* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */
17static void BSP_ISR_handler(rtems_vector_number vector)
18{
19       int irq = vector - 0x10;
20
21       /* Let BSP fixup and/or handle incomming IRQ */
22       irq = bsp_irq_fixup(irq);
23
24       bsp_dispatch_irq(irq);
25}
26
27/* Initialize interrupts */
28void BSP_shared_interrupt_init(void)
29{
30       rtems_vector_number vector;
31       rtems_isr_entry previous_isr;
32       int i;
33
34       for (i=0; i <= BSP_INTERRUPT_VECTOR_MAX_STD; i++) {
35#if defined(LEON3) && \
36    (defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING))
37               /* Don't install IRQ handler on IPI interrupt */
38               if (i == LEON3_mp_irq)
39                       continue;
40#endif
41               vector = SPARC_ASYNCHRONOUS_TRAP(i) + 0x10;
42               rtems_interrupt_catch(BSP_ISR_handler, vector, &previous_isr);
43       }
44
45       /* Initalize interrupt support */
46       bsp_interrupt_initialize();
47}
48
49/* Callback from bsp_interrupt_initialize() */
50rtems_status_code bsp_interrupt_facility_initialize(void)
51{
52       return RTEMS_SUCCESSFUL;
53}
54
55rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
56{
57       BSP_Unmask_interrupt((int)vector);
58
59       return RTEMS_SUCCESSFUL;
60}
61
62rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
63{
64       BSP_Mask_interrupt((int)vector);
65
66       return RTEMS_SUCCESSFUL;
67}
68
69void BSP_shared_interrupt_mask(int irq)
70{
71       BSP_Mask_interrupt(irq);
72}
73
74void BSP_shared_interrupt_unmask(int irq)
75{
76       BSP_Unmask_interrupt(irq);
77}
78
79void BSP_shared_interrupt_clear(int irq)
80{
81       /* We don't have to interrupt lock here, because the register is only
82        * written and self clearing
83        */
84       BSP_Clear_interrupt(irq);
85}
Note: See TracBrowser for help on using the repository browser.