[rtems commit] LEON3: added IRQAMP support

Joel Sherrill joel at rtems.org
Fri Apr 6 14:03:52 UTC 2012


Module:    rtems
Branch:    master
Commit:    3722ff5a735e43e1b3effe03c866d92883eae0de
Changeset: http://git.rtems.org/rtems/commit/?id=3722ff5a735e43e1b3effe03c866d92883eae0de

Author:    Daniel Hellstrom <daniel at gaisler.com>
Date:      Thu Apr  5 10:23:21 2012 -0500

LEON3: added IRQAMP support

---

 c/src/lib/libbsp/sparc/leon3/amba/amba.c       |   14 ++++++++++++++
 c/src/lib/libbsp/sparc/shared/include/ambapp.h |    7 ++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/leon3/amba/amba.c b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
index e334aec..56ff57f 100644
--- a/c/src/lib/libbsp/sparc/leon3/amba/amba.c
+++ b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
@@ -39,6 +39,7 @@ extern int scan_uarts(void);
 void amba_initialize(void)
 {
   int i;
+  int icsel;
   amba_apb_device dev;
 
   /* Scan the AMBA Plug&Play info at the default LEON3 area */
@@ -55,6 +56,19 @@ void amba_initialize(void)
   }
 
   LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start;
+  if ((LEON3_IrqCtrl_Regs->ampctrl >> 28) > 0) {
+    /* IRQ Controller has support for multiple IRQ Controllers, each
+     * CPU can be routed to different Controllers, we find out which
+     * controller by looking at the IRQCTRL Select Register for this CPU.
+     * Each Controller is located at a 4KByte offset.
+     */
+    icsel = LEON3_IrqCtrl_Regs->icsel[LEON3_Cpu_Index/8];
+    icsel = (icsel >> ((7 - (LEON3_Cpu_Index & 0x7)) * 4)) & 0xf;
+    LEON3_IrqCtrl_Regs += icsel;
+    LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] = 0;
+    LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index] = 0;
+    LEON3_IrqCtrl_Regs->iclear = 0xffffffff;
+  }
 
   /* Init Extended IRQ controller if available */
   leon3_ext_irq_init();
diff --git a/c/src/lib/libbsp/sparc/shared/include/ambapp.h b/c/src/lib/libbsp/sparc/shared/include/ambapp.h
index cc8e120..7ca2d13 100644
--- a/c/src/lib/libbsp/sparc/shared/include/ambapp.h
+++ b/c/src/lib/libbsp/sparc/shared/include/ambapp.h
@@ -262,9 +262,8 @@ typedef struct {
   volatile unsigned int notused01;
   volatile unsigned int notused02;
   volatile unsigned int notused03;
-  volatile unsigned int notused10;
-  volatile unsigned int notused11;
-  volatile unsigned int notused12;
+  volatile unsigned int ampctrl;
+  volatile unsigned int icsel[2];
   volatile unsigned int notused13;
   volatile unsigned int notused20;
   volatile unsigned int notused21;
@@ -274,6 +273,8 @@ typedef struct {
   volatile unsigned int force[16];
   /* Extended IRQ registers */
   volatile unsigned int intid[16];
+  /* 0x100, align to 4Kb boundary */
+  volatile unsigned int resv1[(0x1000-0x100)/4];
 } LEON3_IrqCtrl_Regs_Map;
 
 /*****************************/




More information about the vc mailing list