[rtems commit] bsp/virtex: Use generic interrupt support

Sebastian Huber sebh at rtems.org
Mon Jun 24 08:48:40 UTC 2013


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 18 17:20:28 2013 +0200

bsp/virtex: Use generic interrupt support

---

 c/src/lib/libbsp/powerpc/virtex/Makefile.am        |   14 +-
 c/src/lib/libbsp/powerpc/virtex/include/bsp.h      |    2 +
 .../lib/libbsp/powerpc/virtex/include/opbintctrl.h |   15 -
 c/src/lib/libbsp/powerpc/virtex/irq/irq.h          |    7 +-
 c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c     |  381 ++++++--------------
 .../libbsp/powerpc/virtex/opbintctrl/opbintctrl.c  |  129 -------
 c/src/lib/libbsp/powerpc/virtex/preinstall.am      |    8 +
 c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c |    6 +-
 8 files changed, 135 insertions(+), 427 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/virtex/Makefile.am b/c/src/lib/libbsp/powerpc/virtex/Makefile.am
index a2647e8..cb12e32 100644
--- a/c/src/lib/libbsp/powerpc/virtex/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/virtex/Makefile.am
@@ -53,12 +53,18 @@ libbsp_a_SOURCES += ../shared/src/bsp-start-zero.S
 libbsp_a_SOURCES += console/consolelite.c ../../shared/console.c \
     ../../shared/console_select.c ../../shared/console_control.c \
     ../../shared/console_read.c ../../shared/console_write.c 
-include_bsp_HEADERS += include/opbintctrl.h
-# opbintctrl
-libbsp_a_SOURCES += opbintctrl/opbintctrl.c
 
-include_bsp_HEADERS += irq/irq.h
 # irq
+include_bsp_HEADERS += ../../shared/include/irq-generic.h
+include_bsp_HEADERS += ../../shared/include/irq-info.h
+include_bsp_HEADERS += include/opbintctrl.h
+include_bsp_HEADERS += irq/irq.h
+libbsp_a_SOURCES += ../../shared/src/irq-default-handler.c
+libbsp_a_SOURCES += ../../shared/src/irq-generic.c
+libbsp_a_SOURCES += ../../shared/src/irq-info.c
+libbsp_a_SOURCES += ../../shared/src/irq-legacy.c
+libbsp_a_SOURCES += ../../shared/src/irq-server.c
+libbsp_a_SOURCES += ../../shared/src/irq-shell.c
 libbsp_a_SOURCES += irq/irq_init.c
 
 if HAS_NETWORKING
diff --git a/c/src/lib/libbsp/powerpc/virtex/include/bsp.h b/c/src/lib/libbsp/powerpc/virtex/include/bsp.h
index fac8ca2..c5d8d50 100644
--- a/c/src/lib/libbsp/powerpc/virtex/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/virtex/include/bsp.h
@@ -61,6 +61,8 @@ extern "C" {
 #include <bsp/vectors.h>
 #include <bsp/default-initial-extension.h>
 
+#define BSP_FEATURE_IRQ_EXTENSION
+
 #define BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
 
 /* miscellaneous stuff assumed to exist */
diff --git a/c/src/lib/libbsp/powerpc/virtex/include/opbintctrl.h b/c/src/lib/libbsp/powerpc/virtex/include/opbintctrl.h
index 587f467..59fd3c6 100644
--- a/c/src/lib/libbsp/powerpc/virtex/include/opbintctrl.h
+++ b/c/src/lib/libbsp/powerpc/virtex/include/opbintctrl.h
@@ -68,21 +68,6 @@ extern "C" {
 /* Master Enable Register: Master IRQ Enable */
 #define OPB_INTC_MER_ME		0x1
 
-  /*
-   * make this fast: is this a opbintc interrupt?
-   */
-  void BSP_irq_enable_at_opbintc (rtems_irq_number irqnum);
-
-  void BSP_irq_disable_at_opbintc (rtems_irq_number irqnum);
-  /*
-   *  IRQ Handler: this is called from the primary exception dispatcher
-   */
-  void BSP_irq_handle_at_opbintc(void);
-  /*
-   * activate the interrupt controller
-   */
-  rtems_status_code opb_intc_init(void);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/c/src/lib/libbsp/powerpc/virtex/irq/irq.h b/c/src/lib/libbsp/powerpc/virtex/irq/irq.h
index f8d6eae..d96a5d5 100644
--- a/c/src/lib/libbsp/powerpc/virtex/irq/irq.h
+++ b/c/src/lib/libbsp/powerpc/virtex/irq/irq.h
@@ -20,6 +20,7 @@
 #define VIRTEX_IRQ_IRQ_H
 
 #include <rtems/irq.h>
+#include <rtems/irq-extension.h>
 #include <bsp/opbintctrl.h>
 
 /*
@@ -60,6 +61,9 @@
           (BSP_IS_PROCESSOR_IRQ(irqnum)	\
            || BSP_IS_OPBINTC_IRQ(irqnum))
 
+#define BSP_INTERRUPT_VECTOR_MIN 0
+#define BSP_INTERRUPT_VECTOR_MAX BSP_PROCESSOR_IRQ_MAX_OFFSET
+
 #ifndef ASM
 #ifdef __cplusplus
 extern "C" {
@@ -82,9 +86,6 @@ extern "C" {
 
 #define BSP_OPBINTC_XPAR(xname) (BSP_OPBINTC_IRQ_LOWEST_OFFSET+xname)
 
-  extern rtems_irq_connect_data *BSP_rtems_irq_tbl;
-  void BSP_rtems_irq_mng_init(unsigned cpuId);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c b/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c
index 20f5f40..d5fd79d 100644
--- a/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c
+++ b/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c
@@ -19,329 +19,166 @@
 +-----------------------------------------------------------------+
 | this file contains the irq controller handler                   |
 \*===============================================================*/
-#include <libcpu/spr.h>
-#include <bsp/irq.h>
+
+/*  Content moved from opbintctrl.c:
+ *
+ *  This file contains definitions and declarations for the
+ *  Xilinx Off Processor Bus (OPB) Interrupt Controller
+ *
+ *  Author: Keith Robertson <kjrobert at alumni.uwaterloo.ca>
+ *  COPYRIGHT (c) 2005 Linn Products Ltd, Scotland.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ */
+
 #include <bsp.h>
-#include <rtems/bspIo.h>
-#include <rtems/powerpc/powerpc.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 #include <bsp/vectors.h>
 
-static rtems_irq_connect_data rtemsIrqTbl[BSP_IRQ_NUMBER];
-rtems_irq_connect_data *BSP_rtems_irq_tbl;
-rtems_irq_global_settings* BSP_rtems_irq_config;
-
-/***********************************************************
- * dummy functions for on/off/isOn calls
- * these functions just do nothing fulfill the semantic
- * requirements to enable/disable a certain interrupt or exception
+/*
+ * Acknowledge a mask of interrupts.
  */
-void BSP_irq_nop_func(const rtems_irq_connect_data *unused)
+static void set_iar(uint32_t mask)
 {
-  /*
-   * nothing to do
-   */
+  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_IAR)) = mask;
 }
 
-void BSP_irq_nop_hdl(void *hdl)
+/*
+ * Set IER state.  Used to (dis)enable a mask of vectors.
+ * If you only have to do one, use enable/disable_vector.
+ */
+static void set_ier(uint32_t mask)
 {
-  /*
-   * nothing to do
-   */
+  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_IER)) = mask;
 }
 
-int BSP_irq_true_func(const rtems_irq_connect_data *unused)
+/*
+ * Retrieve contents of Interrupt Pending Register
+ */
+static uint32_t get_ipr(void)
 {
-  /*
-   * nothing to do
-   */
-  return TRUE;
+  uint32_t c = *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_IPR));
+  return c;
 }
 
-/***********************************************************
- * interrupt handler and its enable/disable functions
- ***********************************************************/
-
-/***********************************************************
- * functions to enable/disable/query external/critical interrupts
- */
-void BSP_irqexc_on_fnc(rtems_irq_connect_data *conn_data)
+static void BSP_irq_enable_at_opbintc (rtems_irq_number irqnum)
 {
-  uint32_t msr_value;
-  /*
-   * get current MSR value
-   */
-  _CPU_MSR_GET(msr_value);
-
-
-   msr_value |= PPC_MSR_EE;
-   _CPU_MSR_SET(msr_value);
+  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_SIE))
+    = 1 << (irqnum - BSP_OPBINTC_IRQ_LOWEST_OFFSET);
 }
 
-void BSP_irqexc_off_fnc(rtems_irq_connect_data *unused)
+static void BSP_irq_disable_at_opbintc (rtems_irq_number irqnum)
 {
-  /*
-   * nothing to do
-   */
+  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_CIE))
+    = 1 << (irqnum - BSP_OPBINTC_IRQ_LOWEST_OFFSET);
 }
 
-/***********************************************************
- * High level IRQ handler called from shared_raw_irq_code_entry
+/*
+ *  IRQ Handler: this is called from the primary exception dispatcher
  */
-int C_dispatch_irq_handler (BSP_Exception_frame *frame, unsigned int excNum)
+static void BSP_irq_handle_at_opbintc(void)
 {
+  uint32_t ipr, mask, i, c;
+  ipr = get_ipr();
 
+  c = 0;
+  mask = 0;
 
-  /*
-   * Handle interrupt
-   */
-  switch(excNum) {
-  case ASM_EXT_VECTOR:
-    BSP_irq_handle_at_opbintc();
-    break;
-#if 0 /* We now let the clock driver hook the exception directly */
-  case ASM_BOOKE_DEC_VECTOR:
-    BSP_rtems_irq_tbl[BSP_PIT].hdl
-      (BSP_rtems_irq_tbl[BSP_PIT].handle);
-    break;
-#endif
-#if 0 /* Critical interrupts not yet supported */
-  case ASM_BOOKE_CRIT_VECTOR:
-    break;
-#endif
-  }
-  return 0;
-}
-
-/***********************************************************
- * functions to set/get/remove interrupt handlers
- ***********************************************************/
-int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
-{
-  rtems_interrupt_level level;
+  for (i = 0;
+       (i < BSP_OPBINTC_PER_IRQ_NUMBER)
+	 && (ipr != 0);
+       i++) {
+    c = (1 << i);
 
-  /*
-   * check for valid irq name
-   * if invalid, print error and return 0
-   */
-  if (!BSP_IS_VALID_IRQ(irq->name)) {
-    printk("Invalid interrupt vector %d\n",irq->name);
-    return 0;
-  }
+    if ((ipr & c) != 0) {
+      /* interrupt is asserted */
+      mask |= c;
+      ipr &= ~c;
 
-  /*
-   * disable interrupts
-   */
-  rtems_interrupt_disable(level);
-  /*
-   * check, that default handler is installed now
-   */
-  if (rtemsIrqTbl[irq->name].hdl != BSP_rtems_irq_config->defaultEntry.hdl) {
-    rtems_interrupt_enable(level);
-    printk("IRQ vector %d already connected\n",irq->name);
-    return 0;
+      bsp_interrupt_handler_dispatch(i+BSP_OPBINTC_IRQ_LOWEST_OFFSET);
+    }
   }
-  /*
-   * store new handler data
-   */
-  rtemsIrqTbl[irq->name] = *irq;
 
-  /*
-   * enable irq at interrupt controller
-   */
-  if (BSP_IS_OPBINTC_IRQ(irq->name)) {
-    BSP_irq_enable_at_opbintc(irq->name);
+  if (mask) {
+    /* ack all the interrupts we serviced */
+    set_iar(mask);
   }
-  /*
-   * call "on" function to enable interrupt at device
-   */
-  irq->on(irq);
-  /*
-   * reenable interrupts
-   */
-  rtems_interrupt_enable(level);
-
-  return 1;
 }
 
-int BSP_get_current_rtems_irq_handler	(rtems_irq_connect_data* irq)
+/*
+ * activate the interrupt controller
+ */
+static void opb_intc_init(void)
 {
-  rtems_interrupt_level level;
+  uint32_t i, mask = 0;
 
-  /*
-   * check for valid IRQ name
-   */
-  if (!BSP_IS_VALID_IRQ(irq->name)) {
-    return 0;
+  /* mask off all interrupts */
+  set_ier(0x0);
+
+  for (i = 0; i < OPB_INTC_IRQ_MAX; i++) {
+    mask |= (1 << i);
   }
-  rtems_interrupt_disable(level);
-  /*
-   * return current IRQ entry
-   */
-  *irq = rtemsIrqTbl[irq->name];
-  rtems_interrupt_enable(level);
-  return 1;
-}
 
-int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
-{
-  rtems_interrupt_level level;
+  /* make sure interupt status register is clear before we enable the interrupt controller */
+  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_ISR)) = 0;
 
-  /*
-   * check for valid IRQ name
-   */
-  if (!BSP_IS_VALID_IRQ(irq->name)) {
-    return 0;
-  }
-  rtems_interrupt_disable(level);
-  /*
-   * check, that specified handler is really connected now
-   */
-  if (rtemsIrqTbl[irq->name].hdl != irq->hdl) {
-    rtems_interrupt_enable(level);
-    return 0;
-  }
-  /*
-   * disable interrupt at interrupt controller
-   */
-  if (BSP_IS_OPBINTC_IRQ(irq->name)) {
-    BSP_irq_disable_at_opbintc(irq->name);
-  }
-  /*
-   * disable interrupt at source
-   */
-  irq->off(irq);
-  /*
-   * restore default interrupt handler
-   */
-  rtemsIrqTbl[irq->name] = BSP_rtems_irq_config->defaultEntry;
+  /* acknowledge all interrupt sources */
+  set_iar(mask);
 
-  /*
-   * reenable interrupts
-   */
-  rtems_interrupt_enable(level);
+  /* Turn on normal hardware operation of interrupt controller */
+  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_MER)) =
+    (OPB_INTC_MER_HIE);
 
-  return 1;
+  /* Enable master interrupt switch for the interrupt controller */
+  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_MER)) =
+    (OPB_INTC_MER_HIE | OPB_INTC_MER_ME);
 }
 
-/***********************************************************
- * functions to set/get the basic interrupt management setup
- ***********************************************************/
-/*
- * (Re) get info on current RTEMS interrupt management.
- */
-int BSP_rtems_irq_mngt_get(rtems_irq_global_settings** ret_ptr)
+rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  *ret_ptr = BSP_rtems_irq_config;
-  return 0;
-}
+  rtems_status_code sc = RTEMS_SUCCESSFUL;
+
+  if (bsp_interrupt_is_valid_vector(vector)) {
+    if (BSP_IS_OPBINTC_IRQ(vector)) {
+      BSP_irq_enable_at_opbintc(vector);
+    }
+  } else {
+    sc = RTEMS_INVALID_ID;
+  }
 
+  return sc;
+}
 
-/*
- * set management stuff
- */
-int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config)
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  int                    i;
-  rtems_interrupt_level  level;
+  rtems_status_code sc = RTEMS_SUCCESSFUL;
 
-  rtems_interrupt_disable(level);
-  /*
-   * store given configuration
-   */
-  BSP_rtems_irq_config = config;
-  BSP_rtems_irq_tbl    = BSP_rtems_irq_config->irqHdlTbl;
-  /*
-   * enable any non-empty IRQ entries at OPBINTC
-   */
-  for (i =  BSP_OPBINTC_IRQ_LOWEST_OFFSET;
-       i <= BSP_OPBINTC_IRQ_MAX_OFFSET;
-       i++) {
-    if (BSP_rtems_irq_tbl[i].hdl != config->defaultEntry.hdl) {
-      BSP_irq_enable_at_opbintc(i);
-      BSP_rtems_irq_tbl[i].on((&BSP_rtems_irq_tbl[i]));
-    }
-    else {
-      BSP_rtems_irq_tbl[i].off(&(BSP_rtems_irq_tbl[i]));
-      BSP_irq_disable_at_opbintc(i);
+  if (bsp_interrupt_is_valid_vector(vector)) {
+    if (BSP_IS_OPBINTC_IRQ(vector)) {
+      BSP_irq_disable_at_opbintc(vector);
     }
+  } else {
+    sc = RTEMS_INVALID_ID;
   }
-  /*
-   * store any irq-like processor exceptions
-   */
-  for (i = BSP_PROCESSOR_IRQ_LOWEST_OFFSET;
-       i < BSP_PROCESSOR_IRQ_MAX_OFFSET;
-       i++) {
-    if (BSP_rtems_irq_tbl[i].hdl != config->defaultEntry.hdl) {
-      if (BSP_rtems_irq_tbl[i].on != NULL) {
-	BSP_rtems_irq_tbl[i].on
-	  (&(BSP_rtems_irq_tbl[i]));
-      }
-    }
-    else {
-      if (BSP_rtems_irq_tbl[i].off != NULL) {
-	BSP_rtems_irq_tbl[i].off
-	  (&(BSP_rtems_irq_tbl[i]));
-      }
-    }
-  }
-  rtems_interrupt_enable(level);
-  return 1;
+
+  return sc;
 }
 
-/*
- * dummy for an empty IRQ handler entry
- */
-static rtems_irq_connect_data emptyIrq = {
-  0, 		         /* Irq Name                 */
-  BSP_irq_nop_hdl,       /* handler function         */
-  NULL,                  /* handle passed to handler */
-  BSP_irq_nop_func,      /* on function              */
-  BSP_irq_nop_func,      /* off function             */
-  BSP_irq_true_func      /* isOn function            */
-};
+static int C_dispatch_irq_handler(BSP_Exception_frame *frame, unsigned int excNum)
+{
+  BSP_irq_handle_at_opbintc();
 
-static rtems_irq_global_settings initialConfig = {
-  BSP_IRQ_NUMBER,    /* irqNb */
-  {  0, 		         /* Irq Name                 */
-     BSP_irq_nop_hdl,       /* handler function         */
-     NULL,                  /* handle passed to handler */
-     BSP_irq_nop_func,      /* on function              */
-     BSP_irq_nop_func,      /* off function             */
-     BSP_irq_true_func      /* isOn function            */
-  }, /* emptyIrq */
-  rtemsIrqTbl, /* irqHdlTbl  */
-  0,           /* irqBase    */
-  NULL         /* irqPrioTbl */
-};
+  return 0;
+}
 
-void BSP_rtems_irq_mng_init(unsigned cpuId)
+rtems_status_code bsp_interrupt_facility_initialize(void)
 {
-  int i;
+  opb_intc_init();
 
-  /*
-   * connect all exception vectors needed
-   */
- ppc_exc_set_handler(ASM_EXT_VECTOR, C_dispatch_irq_handler);
- ppc_exc_set_handler(ASM_BOOKE_DEC_VECTOR, C_dispatch_irq_handler);
+  ppc_exc_set_handler(ASM_EXT_VECTOR, C_dispatch_irq_handler);
 
-  /*
-   * setup interrupt handlers table
-   */
-  for (i = 0;
-       i < BSP_IRQ_NUMBER;
-       i++) {
-    rtemsIrqTbl[i]      = emptyIrq;
-    rtemsIrqTbl[i].name = i;
-  }
-  /*
-   * init interrupt controller
-   */
-  opb_intc_init();
-  /*
-   * initialize interrupt management
-   */
-  if (!BSP_rtems_irq_mngt_set(&initialConfig)) {
-    BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
-  }
+  return RTEMS_SUCCESSFUL;
 }
-
diff --git a/c/src/lib/libbsp/powerpc/virtex/opbintctrl/opbintctrl.c b/c/src/lib/libbsp/powerpc/virtex/opbintctrl/opbintctrl.c
deleted file mode 100644
index cc59aae..0000000
--- a/c/src/lib/libbsp/powerpc/virtex/opbintctrl/opbintctrl.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*  opbintctrl.c
- *
- *  This file contains definitions and declarations for the
- *  Xilinx Off Processor Bus (OPB) Interrupt Controller
- *
- *  Author: Keith Robertson <kjrobert at alumni.uwaterloo.ca>
- *  COPYRIGHT (c) 2005 Linn Products Ltd, Scotland.
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.com/license/LICENSE.
- */
-
-#include <bsp/opbintctrl.h>
-#include <rtems.h>
-#include <rtems/bspIo.h>
-#include <bsp/irq.h>
-#include <rtems/powerpc/powerpc.h>
-
-/*
- * Acknowledge a mask of interrupts.
- */
-RTEMS_INLINE_ROUTINE void set_iar(uint32_t mask)
-{
-  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_IAR)) = mask;
-}
-
-/*
- * Set IER state.  Used to (dis)enable a mask of vectors.
- * If you only have to do one, use enable/disable_vector.
- */
-RTEMS_INLINE_ROUTINE void set_ier(uint32_t mask)
-{
-  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_IER)) = mask;
-}
-
-/*
- * Retrieve contents of Interrupt Pending Register
- */
-RTEMS_INLINE_ROUTINE uint32_t get_ipr(void)
-{
-  uint32_t c = *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_IPR));
-  return c;
-}
-
-void BSP_irq_enable_at_opbintc (rtems_irq_number irqnum)
-{
-  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_SIE))
-    = 1 << (irqnum - BSP_OPBINTC_IRQ_LOWEST_OFFSET);
-}
-
-void BSP_irq_disable_at_opbintc (rtems_irq_number irqnum)
-{
-  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_CIE))
-    = 1 << (irqnum - BSP_OPBINTC_IRQ_LOWEST_OFFSET);
-}
-
-/*
- *  IRQ Handler: this is called from the primary exception dispatcher
- */
-void BSP_irq_handle_at_opbintc(void)
-{
-  uint32_t ipr, iprcopy, mask, i, c;
-  rtems_irq_connect_data *tbl_entry;
-  iprcopy = ipr = get_ipr();
-
-  c = 0;
-  mask = 0;
-
-  for (i = 0;
-       (i < BSP_OPBINTC_PER_IRQ_NUMBER)
-	 && (ipr != 0);
-       i++) {
-    c = (1 << i);
-
-    if ((ipr & c) != 0) {
-      /* interrupt is asserted */
-      mask |= c;
-      ipr &= ~c;
-
-      tbl_entry = &BSP_rtems_irq_tbl[i+BSP_OPBINTC_IRQ_LOWEST_OFFSET];
-      if (tbl_entry->hdl != NULL) {
-        (tbl_entry->hdl) (tbl_entry->handle);
-      } else {
-        printk("opbintctrl: Spurious interrupt; IPR 0x%08X, vector 0x%x\n\r",
-               iprcopy, i);
-      }
-    }
-  }
-
-  if (mask) {
-    /* ack all the interrupts we serviced */
-    set_iar(mask);
-  }
-}
-
-
-/*
- * activate the interrupt controller
- */
-rtems_status_code opb_intc_init(void)
-{
-  uint32_t i, mask = 0;
-
-  /* mask off all interrupts */
-  set_ier(0x0);
-
-  for (i = 0; i < OPB_INTC_IRQ_MAX; i++) {
-    mask |= (1 << i);
-  }
-  printk("opb_intc_init: mask = 0x%x\n", (unsigned) mask);
-
-  /* make sure interupt status register is clear before we enable the interrupt controller */
-  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_ISR)) = 0;
-
-  /* acknowledge all interrupt sources */
-  set_iar(mask);
-
-  /* Turn on normal hardware operation of interrupt controller */
-  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_MER)) =
-    (OPB_INTC_MER_HIE);
-
-  /* Enable master interrupt switch for the interrupt controller */
-  *((volatile uint32_t *) (OPB_INTC_BASE + OPB_INTC_MER)) =
-    (OPB_INTC_MER_HIE | OPB_INTC_MER_ME);
-
-  return RTEMS_SUCCESSFUL;
-}
-
diff --git a/c/src/lib/libbsp/powerpc/virtex/preinstall.am b/c/src/lib/libbsp/powerpc/virtex/preinstall.am
index 95b748e..07c6ff9 100644
--- a/c/src/lib/libbsp/powerpc/virtex/preinstall.am
+++ b/c/src/lib/libbsp/powerpc/virtex/preinstall.am
@@ -86,6 +86,14 @@ $(PROJECT_LIB)/linkcmds.base: ../shared/startup/linkcmds.base $(PROJECT_LIB)/$(d
 	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.base
 PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.base
 
+$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
+
+$(PROJECT_INCLUDE)/bsp/irq-info.h: ../../shared/include/irq-info.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-info.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-info.h
+
 $(PROJECT_INCLUDE)/bsp/opbintctrl.h: include/opbintctrl.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/opbintctrl.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/opbintctrl.h
diff --git a/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c b/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
index 9f27ef6..7eff388 100644
--- a/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
@@ -56,6 +56,7 @@
 
 #include <bsp.h>
 #include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 #include <bsp/bootcard.h>
 #include <bsp/linker-symbols.h>
 
@@ -104,10 +105,7 @@ void bsp_start( void )
   );
   __asm__ volatile ("mtevpr %0" : : "r" (virtex_exc_vector_base));
 
-  /*
-   * Install our own set of exception vectors
-   */
-  BSP_rtems_irq_mng_init(0);
+  bsp_interrupt_initialize();
 }
 
 void BSP_ask_for_reset(void)




More information about the vc mailing list