Index: c/src/lib/libcpu/arm/ChangeLog
===================================================================
--- c/src/lib/libcpu/arm/ChangeLog	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/ChangeLog	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,2 +1,19 @@
+2010-04-30	Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+	* at91rm9200/irq/irq.c, at91rm9200/irq/irq.h, lpc22xx/irq/irq.c,
+	lpc22xx/irq/irq.h, mc9328mxl/irq/irq.c, mc9328mxl/irq/irq.h,
+	pxa255/irq/irq.c, pxa255/irq/irq.h, s3c24xx/irq/irq.c,
+	s3c24xx/irq/irq.h: The previous interrupt warning fix changed the
+	interrupt handler API.  To fix this problem the generic interrupt
+	support framework will be used now.  This eliminates a lot of copy and
+	paste code.  The interrupt header file is now <bsp/irq.h>.
+	* at91rm9200/clock/clock.c, lpc22xx/clock/clockdrv.c,
+	mc9328mxl/clock/clockdrv.c, pxa255/clock/clock.c,
+	s3c24xx/clock/clockdrv.c: Include <bsp/irq.h> instead of <irq.h>.
+	* at91rm9200/irq/bsp_irq_asm.S, at91rm9200/irq/bsp_irq_init.c,
+	mc9328mxl/irq/bsp_irq_asm.S, mc9328mxl/irq/bsp_irq_init.c,
+	s3c24xx/irq/bsp_irq_asm.S, s3c24xx/irq/bsp_irq_init.c: Removed files.
+	* Makefile.am, preinstall.am: Reflect changes above.
+
 2010-04-09	Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
 
Index: c/src/lib/libcpu/arm/Makefile.am
===================================================================
--- c/src/lib/libcpu/arm/Makefile.am	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/Makefile.am	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -11,9 +11,14 @@
 noinst_PROGRAMS =
 
+include_bspdir = $(includedir)/bsp
+include_libcpudir = $(includedir)/libcpu
+
+include_bsp_HEADERS =
+include_libcpu_HEADERS =
+
 ## shared/include
 if shared
-include_libcpudir = $(includedir)/libcpu
 
-include_libcpu_HEADERS = shared/include/mmu.h
+include_libcpu_HEADERS += shared/include/mmu.h
 include_libcpu_HEADERS += shared/include/arm-cp15.h
 
@@ -53,8 +58,7 @@
 
 ## pxa255/interrupt
-include_HEADERS += pxa255/irq/irq.h
+include_bsp_HEADERS += pxa255/irq/irq.h
 noinst_PROGRAMS += pxa255/irq.rel
-pxa255_irq_rel_SOURCES = pxa255/irq/irq.c pxa255/irq/bsp_irq_init.c \
-    ../../libbsp/arm/shared/irq/irq_init.c pxa255/irq/bsp_irq_asm.S \
+pxa255_irq_rel_SOURCES = pxa255/irq/irq.c \
     pxa255/irq/irq.h
 pxa255_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
@@ -99,9 +103,8 @@
 
 ## at91rm9200/interrupt
-include_HEADERS += at91rm9200/irq/irq.h
+include_bsp_HEADERS += at91rm9200/irq/irq.h
 
 noinst_PROGRAMS += at91rm9200/irq.rel
-at91rm9200_irq_rel_SOURCES = at91rm9200/irq/irq.c at91rm9200/irq/bsp_irq_init.c \
-    ../../libbsp/arm/shared/irq/irq_init.c at91rm9200/irq/bsp_irq_asm.S \
+at91rm9200_irq_rel_SOURCES = at91rm9200/irq/irq.c \
     at91rm9200/irq/irq.h
 at91rm9200_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
@@ -125,9 +128,8 @@
 
 ## mc9328mxl/interrupt
-include_HEADERS += mc9328mxl/irq/irq.h
+include_bsp_HEADERS += mc9328mxl/irq/irq.h
 
 noinst_PROGRAMS += mc9328mxl/irq.rel
-mc9328mxl_irq_rel_SOURCES = mc9328mxl/irq/irq.c mc9328mxl/irq/bsp_irq_init.c \
-    ../../libbsp/arm/shared/irq/irq_init.c mc9328mxl/irq/bsp_irq_asm.S \
+mc9328mxl_irq_rel_SOURCES = mc9328mxl/irq/irq.c \
     mc9328mxl/irq/irq.h
 mc9328mxl_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
@@ -151,9 +153,8 @@
 
 ## s3c24xx/interrupt
-include_HEADERS += s3c24xx/irq/irq.h
+include_bsp_HEADERS += s3c24xx/irq/irq.h
 
 noinst_PROGRAMS += s3c24xx/irq.rel
-s3c24xx_irq_rel_SOURCES = s3c24xx/irq/irq.c s3c24xx/irq/bsp_irq_init.c \
-    ../../libbsp/arm/shared/irq/irq_init.c s3c24xx/irq/bsp_irq_asm.S \
+s3c24xx_irq_rel_SOURCES = s3c24xx/irq/irq.c \
     s3c24xx/irq/irq.h
 s3c24xx_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
@@ -177,9 +178,8 @@
 
 ## lpc22xx/interrupt
-include_HEADERS += lpc22xx/irq/irq.h
+include_bsp_HEADERS += lpc22xx/irq/irq.h
 
 noinst_PROGRAMS += lpc22xx/irq.rel
-lpc22xx_irq_rel_SOURCES = lpc22xx/irq/irq.c lpc22xx/irq/bsp_irq_init.c \
-    ../../libbsp/arm/shared/irq/irq_init.c lpc22xx/irq/bsp_irq_asm.S \
+lpc22xx_irq_rel_SOURCES = lpc22xx/irq/irq.c \
     lpc22xx/irq/irq.h
 lpc22xx_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
Index: c/src/lib/libcpu/arm/at91rm9200/clock/clock.c
===================================================================
--- c/src/lib/libcpu/arm/at91rm9200/clock/clock.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/at91rm9200/clock/clock.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -20,5 +20,5 @@
 #include <stdlib.h>
 #include <bsp.h>
-#include <irq.h>
+#include <bsp/irq.h>
 #include <at91rm9200.h>
 #include <at91rm9200_pmc.h>
Index: src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S
===================================================================
--- c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Atmel AT91RM9200 Interrupt handler
- *
- * Copyright (c) 2004 by Jay Monkman <jtm@lopgindog.com>
- *
- *  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.
- *
- *
- *  $Id$
- */
-#define __asm__
-
-        .globl bsp_interrupt_dispatch
-bsp_interrupt_dispatch :
-/*
- * Look at interrupt status register to determine source.
- * From source, determine offset into expanded vector table
- * and load vector into r0 and handler address into r1.
- */
-        ldr     r0, =0xFFFFF100   /* AIC_CTL_BASE + AIC_IVR */
-        ldr     r1, [r0]
-        str     r1, [r0]          /* write back in case we are using protect */
-
-	ldr     r0, =0xFFFFF108   /* AIC_CTL_BASE + AIC_ISR */
-        ldr     r0, [r0]          /* Read interrupt vector  */
-
-        stmdb   sp!,{lr}
-        ldr     lr, =IRQ_return   /* prepare the return from handler  */
-
-        mov     pc, r1            /* execute handler */
-
-IRQ_return:
-        ldr   r2, =0xFFFFF130     /* AIC_CTL_BASE + AIC_EIOCR */
-        str   r1, [r2]
-
-        ldmia sp!,{lr}
-
-        mov pc, lr
Index: src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c
===================================================================
--- c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Atmel AT91RM9200 Interrupt handler
- *
- * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
- *
- *  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.
- *
- *
- *  $Id$
- */
-#include <irq.h>
-#include <bsp.h>
-#include <at91rm9200.h>
-
-/*
- * Interrupt system initialization. Disable interrupts, clear
- * any that are pending.
- */
-void BSP_rtems_irq_mngt_init(void)
-{
-    long *vectorTable;
-    int i;
-
-    vectorTable = (long *) VECTOR_TABLE;
-
-    /* Initialize the vector table contents with default handler */
-    for (i=0; i<BSP_MAX_INT; i++) {
-        *(vectorTable + i) = (long)(default_int_handler);
-    }
-
-    /* disable all interrupts */
-    AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
-}
-
Index: c/src/lib/libcpu/arm/at91rm9200/irq/irq.c
===================================================================
--- c/src/lib/libcpu/arm/at91rm9200/irq/irq.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/at91rm9200/irq/irq.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,4 +1,6 @@
 /*
  * Atmel AT91RM9200 Interrupt handler
+ *
+ * Copyright (c) 2010 embedded brains GmbH.
  *
  * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
@@ -11,105 +13,46 @@
  *  $Id$
  */
+
 #include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
+
 #include <at91rm9200.h>
 
-/*
- * This function check that the value given for the irq line
- * is valid.
- */
-static int isValidInterrupt(int irq)
+void bsp_interrupt_dispatch(void)
 {
-    if ( (irq < 0) || (irq >= AT91RM9200_MAX_INT)) {
-        return 0;
-    }
-    return 1;
+  rtems_vector_number vector = AIC_CTL_REG(AIC_ISR);
+
+  bsp_interrupt_handler_dispatch(vector);
+
+  AIC_CTL_REG(AIC_EOICR) = 0;
 }
 
-/*
- * Installs the interrupt handler.
- */
-int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
+  AIC_CTL_REG(AIC_IECR) = 1 << vector;
 
-    if (!isValidInterrupt(irq->name)) {
-        return 0;
-    }
-
-    /*
-     * Check if default handler is actually connected. If not, issue
-     * an error. Note: irq->name is a number corresponding to the
-     * sources PID (see the at91rm9200_pid for this mapping).  We
-     * convert it to a long word offset to get source's vector register
-     */
-    if (AIC_SVR_REG(irq->name * 4) != (uint32_t) default_int_handler) {
-        return 0;
-    }
-
-    rtems_interrupt_disable(level);
-
-    /*
-     * store the new handler
-     */
-    AIC_SVR_REG(irq->name * 4) = (uint32_t) irq->hdl;
-
-    /*
-     * unmask interrupt
-     */
-    AIC_CTL_REG(AIC_IECR) = 1 << irq->name;
-
-    /*
-     * Enable interrupt on device
-     */
-    if(irq->on) {
-        irq->on(irq);
-    }
-
-    rtems_interrupt_enable(level);
-
-    return 1;
+  return RTEMS_SUCCESSFUL;
 }
 
-/*
- * Remove and interrupt handler
- */
-int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
+  AIC_CTL_REG(AIC_IDCR) = 1 << vector;
 
-    if (!isValidInterrupt(irq->name)) {
-        return 0;
-    }
+  return RTEMS_SUCCESSFUL;
+}
 
-    /*
-     * Check if the handler is actually connected. If not, issue an error.
-     */
-    if (AIC_SVR_REG(irq->name * 4) != (uint32_t) irq->hdl) {
-      return 0;
-    }
-    rtems_interrupt_disable(level);
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+  /* disable all interrupts */
+  AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
 
-    /*
-     * mask interrupt
-     */
-    AIC_CTL_REG(AIC_IDCR) = 1 << irq->name;
+  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
 
-    /*
-     * Disable interrupt on device
-     */
-    if(irq->off) {
-        irq->off(irq);
-    }
+  return RTEMS_SUCCESSFUL;
+}
 
-    /*
-     * restore the default irq value
-     */
-    AIC_SVR_REG(irq->name * 4) = (uint32_t) default_int_handler;
-
-    rtems_interrupt_enable(level);
-
-    return 1;
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+  printk("spurious interrupt: %u\n", vector);
 }
Index: c/src/lib/libcpu/arm/at91rm9200/irq/irq.h
===================================================================
--- c/src/lib/libcpu/arm/at91rm9200/irq/irq.h	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/at91rm9200/irq/irq.h	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,4 +1,6 @@
 /*
  * Interrupt handler Header file
+ *
+ * Copyright (c) 2010 embedded brains GmbH.
  *
  * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
@@ -16,22 +18,12 @@
 #define __IRQ_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #ifndef __asm__
 
-/*
- * Include some preprocessor value also used by assember code
- */
+#include <rtems.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
 
-#include <rtems/irq.h>
-#include <rtems.h>
-#include <at91rm9200.h>
+#endif /* __asm__ */
 
-extern void default_int_handler(rtems_irq_hdl_param unused);
-/***********************************************************************
- * Constants
- **********************************************************************/
 /* possible interrupt sources on the AT91RM9200 */
 #define AT91RM9200_INT_FIQ        0
@@ -69,19 +61,7 @@
 #define AT91RM9200_MAX_INT       32
 
-/* vector table used by shared/irq_init.c */
-/* we can treat the AT91RM9200 AIC_SVR_BASE as */
-/* a vector table */
-#define VECTOR_TABLE AIC_SVR_BASE
+#define BSP_INTERRUPT_VECTOR_MIN 0
 
-/*
- * function to initialize the interrupt for a specific BSP
- */
-void BSP_rtems_irq_mngt_init();
-
-#endif /* __asm__ */
-
-#ifdef __cplusplus
-}
-#endif
+#define BSP_INTERRUPT_VECTOR_MAX (AT91RM9200_MAX_INT - 1)
 
 #endif /* __IRQ_H__ */
Index: c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
===================================================================
--- c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -17,5 +17,5 @@
 #include <rtems.h>
 #include <bsp.h>
-#include <irq.h>
+#include <bsp/irq.h>
 #include <lpc22xx.h>
 #include <rtems/bspIo.h>  /* for printk */
Index: c/src/lib/libcpu/arm/lpc22xx/irq/irq.c
===================================================================
--- c/src/lib/libcpu/arm/lpc22xx/irq/irq.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/lpc22xx/irq/irq.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,4 +1,6 @@
 /*
  * Philps LPC22XX Interrupt handler
+ *
+ * Copyright (c) 2010 embedded brains GmbH.
  *
  * Copyright (c)  2006 by Ray<rayx.cn@gmail.com>  to support LPC ARM
@@ -10,116 +12,67 @@
  *  $Id$
  */
+
 #include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
+
 #include <lpc22xx.h>
 
-/*
- * This function check that the value given for the irq line
- * is valid.
- */
-static int isValidInterrupt(int irq)
+void bsp_interrupt_dispatch(void)
 {
-  if ( (irq < 0) || (irq >= BSP_MAX_INT))
-    return 0;
-  return 1;
+  rtems_vector_number vector = 31 - __builtin_clz(VICIRQStatus);
+
+  bsp_interrupt_handler_dispatch(vector);
+
+  VICVectAddr = 0;
 }
 
-/*
- * Installs the interrupt handler.
- *
- * You should only have to add the code to unmask the interrupt.
- *
- */
-int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
-    rtems_irq_hdl        *bsp_tbl;
-    int                  *vic_cntl;
+  VICIntEnable |= 1 << vector;
 
-    bsp_tbl = (rtems_irq_hdl *)VICVectAddrBase;
-
-    vic_cntl=(int *)VICVectCntlBase;
-
-    if (!isValidInterrupt(irq->name)) {
-      return 0;
-    }
-
-    /*
-     * Check if default handler is actually connected. If not issue an error.
-     */
-
-    if (bsp_tbl[irq->name] != default_int_handler) {
-      return 0;
-    }
-
-    rtems_interrupt_disable(level);
-
-    /*
-     * store the new handler
-     */
-    bsp_tbl[irq->name] = irq->hdl;
-    /* *(volatile unsigned long*)(VICVectAddr0+(irq->name * 4)&0x7c )= (uint32_t) irq->hdl;*/
-    /*
-     * Enable interrupt on device
-     */
-    vic_cntl[irq->name] = 0x20 | irq->name;
-
-    VICIntEnable |= 1 << irq->name;
-
-    if(irq->on)
-    {
-    	irq->on(irq);
-    }
-
-
-    rtems_interrupt_enable(level);
-
-    return 1;
+  return RTEMS_SUCCESSFUL;
 }
 
-/*
- * Remove and interrupt handler
- *
- * You should only have to add the code to mask the interrupt.
- *
- */
-int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
-    rtems_irq_hdl        *bsp_tbl;
+  VICIntEnClr = 1 << vector;
 
-    bsp_tbl = (rtems_irq_hdl *)&VICVectAddr0;
-
-    if (!isValidInterrupt(irq->name)) {
-      return 0;
-    }
-    /*
-     * Check if the handler is actually connected. If not issue an error.
-     */
-    if (bsp_tbl[irq->name] != irq->hdl) {
-      return 0;
-    }
-
-    rtems_interrupt_disable(level);
-
-    VICIntEnClr = 1 << irq->name;
-
-    /*
-     * Disable interrupt on device
-     */
-    if(irq->off) {
-        irq->off(irq);
-    }
-    /*
-     * restore the default irq value
-     */
-    bsp_tbl[irq->name] = default_int_handler;
-
-    rtems_interrupt_enable(level);
-
-    return 1;
+  return RTEMS_SUCCESSFUL;
 }
 
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+  volatile uint32_t *ctrl = (volatile uint32_t *) VICVectCntlBase;
+  size_t i = 0;
 
+  /* Disable all interrupts */
+  VICIntEnClr = 0xffffffff;
+
+  /* Use IRQ category */
+  VICIntSelect = 0;
+
+  /* Enable access in USER mode */
+  VICProtection = 0;
+
+  for (i = 0; i < 16; ++i) {
+    /* Disable vector mode */
+    ctrl [i] = 0;
+
+    /* Acknowledge interrupts for all priorities */
+    VICVectAddr = 0;
+  }
+
+  /* Acknowledge interrupts for all priorities */
+  VICVectAddr = 0;
+
+  /* Install the IRQ exception handler */
+  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
+
+  return RTEMS_SUCCESSFUL;
+}
+
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+  printk("spurious interrupt: %u\n", vector);
+}
Index: c/src/lib/libcpu/arm/lpc22xx/irq/irq.h
===================================================================
--- c/src/lib/libcpu/arm/lpc22xx/irq/irq.h	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/lpc22xx/irq/irq.h	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,4 +1,6 @@
 /*
  * Interrupt handler Header file
+ *
+ * Copyright (c) 2010 embedded brains GmbH.
  *
  * Copyright (c) 2006 by Ray <rayx.cn@gmail.com> to support LPC ARM
@@ -16,23 +18,11 @@
 #define __IRQ_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-  /* define that can be useful (the values are just examples) */
 #ifndef __asm__
 
-/*
- * Include some preprocessor value also used by assember code
- */
+#include <rtems.h>
 #include <rtems/irq.h>
-#include <rtems.h>
-#include <lpc22xx.h>
+#include <rtems/irq-extension.h>
 
-extern void default_int_handler(rtems_irq_hdl_param unused);
-
-/***********************************************************************
- * Constants
- **********************************************************************/
+#endif /* __asm__ */
 
 /* possible interrupt sources on the LPC22xx */
@@ -68,4 +58,8 @@
 #define BSP_MAX_INT              28
 
+#define BSP_INTERRUPT_VECTOR_MIN 0
+
+#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
+
 #define UNDEFINED_INSTRUCTION_VECTOR_ADDR   (*(u_long *)0x00000004L)
 #define SOFTWARE_INTERRUPT_VECTOR_ADDR      (*(u_long *)0x00000008L)
@@ -79,19 +73,3 @@
 #define FIQ_ISR_ADDR                        (*(u_long *)0x0000003CL)
 
-
-//extern rtems_irq_hdl bsp_vector_table[BSP_MAX_INT];
-#define VECTOR_TABLE VICVectAddrBase
-
-
-/*
- * function to initialize the interrupt for a specific BSP
- */
-void BSP_rtems_irq_mngt_init(void);
-
-#endif /* __asm__ */
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* __IRQ_H__ */
Index: c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -18,5 +18,5 @@
 #include <rtems.h>
 #include <bsp.h>
-#include <irq.h>
+#include <bsp/irq.h>
 #include <mc9328mxl.h>
 #include <rtems/bspIo.h>  /* for printk */
Index: src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * MC9328MXL Intererrupt handler
- *
- * Copyright (c) 2002 by Jay Monkman <jtm@lopingdog.com>
- *
- *  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.
- *
- *
- *  $Id$
- */
-#define __asm__
-
-/*
- * BSP specific interrupt handler for INT or FIQ. In here
- * you do determine which interrupt happened and call its
- * handler.
- */
-	.globl bsp_interrupt_dispatch
-bsp_interrupt_dispatch :
-/*
- * Look at interrupt status register to determine source.
- * From source, determine offset into expanded vector table
- * and load handler address into r0.
- */
-  ldr 	r0, =0x00223040  /* Read the vector number */
-  ldr	r1, [r0]
-  mov   r1, r1, LSR #16         /* get the NIVECTOR into 16 LSbits */
-
-  /* find the ISR's address based on the vector */
-  ldr   r0, =bsp_vector_table
-  mov   r1, r1, LSL #3          /* Shift vector to get offset into table */
-  add   r1, r0, r1              /* r1 has address of vector entry */
-  ldr   r0, [r1, #4]            /* Get the data pointer */
-  ldr	r1, [r1]	        /* Get the vector */
-
-  stmdb	  sp!,{lr}
-  ldr     lr, =IRQ_return         /* prepare the return from handler  */
-
-  mov     pc, r1		/* EXECUTE INT HANDLER */
-
-IRQ_return:
-  ldmia sp!,{lr}
-
-  mov pc, lr
Index: src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ 	(revision )
@@ -1,30 +1,0 @@
-/*
- * Motorola MC9328MXL Interrupt handler
- *
- * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
- *
- *  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.
- *
- *
- *  $Id$
- */
-#include <irq.h>
-#include <bsp.h>
-
-/*
- * Interrupt system initialization. Disable interrupts, clear
- * any that are pending.
- */
-void BSP_rtems_irq_mngt_init(void)
-{
-    int i;
-
-    for (i = 0; i < BSP_MAX_INT; i++) {
-        bsp_vector_table[i].vector = default_int_handler;
-        bsp_vector_table[i].data   = NULL;
-    }
-}
-
Index: c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,4 +1,6 @@
 /*
  * Motorola MC9328MXL Interrupt handler
+ *
+ * Copyright (c) 2010 embedded brains GmbH.
  *
  * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
@@ -11,104 +13,38 @@
  *  $Id$
  */
+
 #include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
+
 #include <mc9328mxl.h>
 
-mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
+void bsp_interrupt_dispatch(void)
+{
+  rtems_vector_number vector = *((uint32_t *) 0x00223040) >> 16;
 
-/*
- * This function check that the value given for the irq line
- * is valid.
- */
-static int isValidInterrupt(int irq)
-{
-  if ( (irq < 0) || (irq >= BSP_MAX_INT))
-    return 0;
-  return 1;
+  bsp_interrupt_handler_dispatch(vector);
 }
 
-/*
- * Installs the interrupt handler.
- *
- * You should only have to add the code to unmask the interrupt.
- *
- */
-int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
-
-    if (!isValidInterrupt(irq->name)) {
-      return 0;
-    }
-
-    /*
-     * Check if default handler is actually connected. If not issue an error.
-     */
-    if (bsp_vector_table[irq->name].vector != default_int_handler) {
-        return 0;
-    }
-
-    rtems_interrupt_disable(level);
-
-    /*
-     * store the new handler
-     */
-    bsp_vector_table[irq->name].vector = irq->hdl;
-    bsp_vector_table[irq->name].data = irq->handle;
-
-    /*
-     * Enable interrupt on device
-     */
-    if(irq->on)
-    {
-    	irq->on(irq);
-    }
-
-    rtems_interrupt_enable(level);
-
-    return 1;
+  return RTEMS_SUCCESSFUL;
 }
 
-/*
- * Remove and interrupt handler
- *
- * You should only have to add the code to mask the interrupt.
- *
- */
-int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
-
-    if (!isValidInterrupt(irq->name)) {
-      return 0;
-    }
-    /*
-     * Check if the handler is actually connected. If not issue an error.
-     */
-    if (bsp_vector_table[irq->name].vector != irq->hdl) {
-        return 0;
-    }
-
-    rtems_interrupt_disable(level);
-
-
-    /*
-     * Disable interrupt on device
-     */
-    if(irq->off) {
-        irq->off(irq);
-    }
-    /*
-     * restore the default irq value
-     */
-    bsp_vector_table[irq->name].vector = default_int_handler;
-    bsp_vector_table[irq->name].data = NULL;
-
-    rtems_interrupt_enable(level);
-
-    return 1;
+  return RTEMS_SUCCESSFUL;
 }
 
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
 
+  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
+
+  return RTEMS_SUCCESSFUL;
+}
+
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+  printk("spurious interrupt: %u\n", vector);
+}
Index: c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,4 +1,6 @@
 /*
  * Interrupt handler Header file
+ *
+ * Copyright (c) 2010 embedded brains GmbH.
  *
  * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
@@ -16,24 +18,11 @@
 #define __IRQ_H__
 
-#include <rtems/irq.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-  /* define that can be useful (the values are just examples) */
 #ifndef __asm__
 
-/*
- * Include some preprocessor value also used by assember code
- */
+#include <rtems.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
 
-#include <rtems.h>
-#include <mc9328mxl.h>
-
-extern void default_int_handler(rtems_irq_hdl_param);
-/***********************************************************************
- * Constants
- **********************************************************************/
+#endif /* __asm__ */
 
 /* possible interrupt sources on the MC9328MXL */
@@ -104,23 +93,7 @@
 #define BSP_MAX_INT              64
 
-typedef struct {
-    rtems_irq_hdl       vector;
-    rtems_irq_hdl_param data;
-} mc9328mxl_irq_info_t;
+#define BSP_INTERRUPT_VECTOR_MIN 0
 
-
-
-extern mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
-
-/*
- * function to initialize the interrupt for a specific BSP
- */
-void BSP_rtems_irq_mngt_init(void);
-
-#endif /* __asm__ */
-
-#ifdef __cplusplus
-}
-#endif
+#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
 
 #endif /* __IRQ_H__ */
Index: c/src/lib/libcpu/arm/preinstall.am
===================================================================
--- c/src/lib/libcpu/arm/preinstall.am	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/preinstall.am	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -19,5 +19,9 @@
 PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
 
-if shared
+$(PROJECT_INCLUDE)/bsp/$(dirstamp):
+	@$(MKDIR_P) $(PROJECT_INCLUDE)/bsp
+	@: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+
 $(PROJECT_INCLUDE)/libcpu/$(dirstamp):
 	@$(MKDIR_P) $(PROJECT_INCLUDE)/libcpu
@@ -25,4 +29,5 @@
 PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
 
+if shared
 $(PROJECT_INCLUDE)/libcpu/mmu.h: shared/include/mmu.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/mmu.h
@@ -42,7 +47,7 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/ffuart.h
 
-$(PROJECT_INCLUDE)/irq.h: pxa255/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
+$(PROJECT_INCLUDE)/bsp/irq.h: pxa255/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
 endif
 if at91rm9200
@@ -79,7 +84,7 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/at91rm9200_usart.h
 
-$(PROJECT_INCLUDE)/irq.h: at91rm9200/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
+$(PROJECT_INCLUDE)/bsp/irq.h: at91rm9200/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
 endif
 if mc9328mxl
@@ -88,7 +93,7 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/mc9328mxl.h
 
-$(PROJECT_INCLUDE)/irq.h: mc9328mxl/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
+$(PROJECT_INCLUDE)/bsp/irq.h: mc9328mxl/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
 endif
 if s3c24xx
@@ -105,7 +110,7 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/s3c2410.h
 
-$(PROJECT_INCLUDE)/irq.h: s3c24xx/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
+$(PROJECT_INCLUDE)/bsp/irq.h: s3c24xx/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
 endif
 if lpc22xx
@@ -114,6 +119,6 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/lpc22xx.h
 
-$(PROJECT_INCLUDE)/irq.h: lpc22xx/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
+$(PROJECT_INCLUDE)/bsp/irq.h: lpc22xx/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
 endif
Index: c/src/lib/libcpu/arm/pxa255/clock/clock.c
===================================================================
--- c/src/lib/libcpu/arm/pxa255/clock/clock.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/pxa255/clock/clock.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -19,5 +19,5 @@
 #include <bsp.h>
 #include <bspopts.h>
-#include <irq.h>
+#include <bsp/irq.h>
 #include <pxa255.h>
 
Index: c/src/lib/libcpu/arm/pxa255/irq/irq.c
===================================================================
--- c/src/lib/libcpu/arm/pxa255/irq/irq.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/pxa255/irq/irq.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,3 +1,5 @@
 /*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
  * PXA255 Interrupt handler by Yang Xi <hiyangxi@gmail.com>
  * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
@@ -9,107 +11,48 @@
  *  $Id$
  */
+
 #include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
+
 #include <pxa255.h>
 
-/*
- * This function check that the value given for the irq line
- * is valid.
- */
-static int isValidInterrupt(int irq)
+void bsp_interrupt_dispatch(void)
 {
-    if ( (irq < 0) || (irq >= PRIMARY_IRQS)) {
-        return 0;
-    }
-    return 1;
+  rtems_vector_number vector = 31 - __builtin_clz(XSCALE_INT_ICIP);
+
+  bsp_interrupt_handler_dispatch(vector);
 }
 
-/*
- * Installs the interrupt handler.
- */
-int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
+  XSCALE_INT_ICMR |= 1 << vector;
 
-    if (!isValidInterrupt(irq->name)) {
-        return 0;
-    }
-
-    /*
-     * Check if default handler is actually connected. If not, issue
-     * an error. Note: irq->name is a number corresponding to the
-     * interrupt number .  We
-     * convert it to a long word offset to get source's vector register
-     */
-        if (IRQ_table[irq->name] != dummy_handler) {
-        return 0;
-	}
-
-    _CPU_ISR_Disable(level);
-
-    /*
-     * store the new handler
-     */
-    IRQ_table[irq->name] = irq->hdl;
-
-    /*
-     * unmask interrupt
-     */
-    XSCALE_INT_ICMR = XSCALE_INT_ICMR | 1 << irq->name;
-
-
-
-    /*
-     * Enable interrupt on device
-     */
-    if(irq->on) {
-        irq->on(irq);
-    }
-
-    _CPU_ISR_Enable(level);
-
-    return 1;
+  return RTEMS_SUCCESSFUL;
 }
 
-/*
- * Remove and interrupt handler
- */
-int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-    rtems_interrupt_level level;
+  XSCALE_INT_ICMR  &= ~(1 << vector);
 
-    if (!isValidInterrupt(irq->name)) {
-        return 0;
-    }
+  return RTEMS_SUCCESSFUL;
+}
 
-    /*
-     * Check if the handler is actually connected. If not, issue an error.
-     */
-    if (IRQ_table[irq->name] != irq->hdl) {
-      return 0;
-    }
-    _CPU_ISR_Disable(level);
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+  /* disable all interrupts */
+  XSCALE_INT_ICMR = 0x0;
 
-    /*
-     * mask interrupt
-     */
-    XSCALE_INT_ICMR  =  XSCALE_INT_ICMR  & (~(1 << irq->name));
+  /* Direct the interrupt to IRQ*/
+  XSCALE_INT_ICLR = 0x0;
 
-    /*
-     * Disable interrupt on device
-     */
-    if(irq->off) {
-        irq->off(irq);
-    }
+  /* Install the IRQ exception handler */
+  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
 
-    /*
-     * restore the default irq value
-     */
-    IRQ_table[irq->name] = dummy_handler;
+  return RTEMS_SUCCESSFUL;
+}
 
-    _CPU_ISR_Enable(level);
-
-    return 1;
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+  printk("spurious interrupt: %u\n", vector);
 }
Index: c/src/lib/libcpu/arm/pxa255/irq/irq.h
===================================================================
--- c/src/lib/libcpu/arm/pxa255/irq/irq.h	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/pxa255/irq/irq.h	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,3 +1,5 @@
 /*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
  * Interrupt handler Header file for PXA By Yang Xi <hiyangxi@gmail.com>
  * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
@@ -13,29 +15,17 @@
 #define __IRQ_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #ifndef __asm__
 
-/*
- * Include some preprocessor value also used by assember code
- */
+#include <rtems.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
 
-#include <rtems/irq.h>
-#include <rtems.h>
 #include <pxa255.h>
 
-extern void default_int_handler(rtems_irq_hdl_param unused);
-extern void (*IRQ_table[PRIMARY_IRQS])(rtems_irq_hdl_param param);
-extern void dummy_handler(rtems_irq_hdl_param unused);
+#define BSP_INTERRUPT_VECTOR_MIN 0
 
-extern void BSP_rtems_irq_mngt_init(void);
+#define BSP_INTERRUPT_VECTOR_MAX (PRIMARY_IRQS - 1)
 
 #endif /* __asm__ */
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* __IRQ_H__ */
Index: c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c
===================================================================
--- c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -14,5 +14,5 @@
 */
 #include <rtems.h>
-#include <irq.h>
+#include <bsp/irq.h>
 #include <bsp.h>
 #include <s3c24xx.h>
Index: src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S
===================================================================
--- c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/* bsp_irq_asm.S
- *
- *  This file contains the implementation of the IRQ handler
- *  for a specific BSP
- *
- *  CopyRight (C) 2000 Canon Research France SA.
- *  Emmanuel Raguet,  mailto:raguet@crf.canon.fr
- *
- * merged to common file for s32400 and s32410 by Thomas Doerfler, embedded brains
- *
- *  The license and distribution terms for this file may be
- *  found in found in the file LICENSE in this distribution or at
- *  http://www.rtems.com/license/LICENSE.
- *
- *  $Id$
- */
-
-#include <s3c24xx.h>
-
-/*
- * Function to obtain, execute an IT handler and acknowledge the IT
- */
-
-        .globl bsp_interrupt_dispatch
-
-bsp_interrupt_dispatch :
-
-        ldr     r0, =rINTOFFSET_ADDR /* Read rINTOFFSET */
-        ldr     r1, [r0]
-
-        ldr     r0, =bsp_vector_table
-        ldr     r0, [r0, r1, LSL #2]    /* Read the address */
-
-        stmdb     sp!,{lr}
-        ldr     lr, =IRQ_return         /* prepare the return from handler  */
-
-        mov pc, r0
-
-IRQ_return:
-        ldmia sp!,{lr}
-
-        mov pc, lr
Index: src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c
===================================================================
--- c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/* irq_init.c
- *
- *  This file contains the implementation of rtems initialization
- *  related to interrupt handling.
- *
- *  CopyRight (C) 2000 Canon Research Centre France SA.
- *  Emmanuel Raguet, mailto:raguet@crf.canon.fr
- *
- *  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.
- *
- *  $Id$
- */
-#include <irq.h>
-#include <bsp.h>
-#include <s3c24xx.h>
-
-void BSP_rtems_irq_mngt_init(void)
-{
-    long *vectorTable;
-    int i;
-
-    vectorTable = (long *) VECTOR_TABLE;
-
-    /* Initialize the vector table contents with default handler */
-    for (i=0; i<BSP_MAX_INT; i++) {
-        *(vectorTable + i) = (long)(default_int_handler);
-    }
-
-    /*
-     * Here is the code to initialize the INT for
-     * the specified BSP
-     */
-}
Index: c/src/lib/libcpu/arm/s3c24xx/irq/irq.c
===================================================================
--- c/src/lib/libcpu/arm/s3c24xx/irq/irq.c	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/s3c24xx/irq/irq.c	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -2,4 +2,6 @@
  *
  *  This file contains the implementation of the function described in irq.h
+ *
+ *  Copyright (c) 2010 embedded brains GmbH.
  *
  *  CopyRight (C) 2000 Canon Research France SA.
@@ -13,98 +15,36 @@
  */
 
+#include <bsp.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 
-#include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
 #include <s3c24xx.h>
 
-/*
- * This function check that the value given for the irq line
- * is valid.
- */
+void bsp_interrupt_dispatch(void)
+{
+  rtems_vector_number vector = *((uint32_t *) rINTOFFSET_ADDR);
 
-static int isValidInterrupt(int irq)
-{
-    if ( (irq < 0) || (irq > BSP_MAX_INT)) {
-        return 0;
-    }
-
-    return 1;
+  bsp_interrupt_handler_dispatch(vector);
 }
 
-/*
- * ------------------- RTEMS Single Irq Handler Mngt Routines ----------------
- */
-
-int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-    rtems_irq_hdl *HdlTable;
-    rtems_interrupt_level level;
-
-    if (!isValidInterrupt(irq->name)) {
-        return 0;
-    }
-
-    /*
-     * Check if default handler is actually connected. If not issue an error.
-     */
-    HdlTable = (rtems_irq_hdl *)VECTOR_TABLE;
-    if (*(HdlTable + irq->name) != default_int_handler) {
-        return 0;
-    }
-
-    _CPU_ISR_Disable(level);
-
-    /*
-     * store the new handler
-     */
-    *(HdlTable + irq->name) = irq->hdl;
-
-    /*
-     * Enable interrupt on device
-     */
-    if(irq->on)
-    {
-        irq->on(irq);
-    }
-
-    _CPU_ISR_Enable(level);
-
-    return 1;
+  return RTEMS_SUCCESSFUL;
 }
 
-int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-    rtems_irq_hdl *HdlTable;
-    rtems_interrupt_level level;
+  return RTEMS_SUCCESSFUL;
+}
 
-    if (!isValidInterrupt(irq->name)) {
-        return 0;
-    }
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
 
-    /*
-     * Check if the handler is actually connected. If not issue an error.
-     */
-    HdlTable = (rtems_irq_hdl *)VECTOR_TABLE;
-    if (*(HdlTable + irq->name) != irq->hdl) {
-        return 0;
-    }
-    _CPU_ISR_Disable(level);
+  return RTEMS_SUCCESSFUL;
+}
 
-    /*
-     * Disable interrupt on device
-     */
-    if(irq->off) {
-        irq->off(irq);
-    }
-
-    /*
-     * restore the default irq value
-     */
-    *(HdlTable + irq->name) = default_int_handler;
-
-    _CPU_ISR_Enable(level);
-
-    return 1;
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+  printk("spurious interrupt: %u\n", vector);
 }
Index: c/src/lib/libcpu/arm/s3c24xx/irq/irq.h
===================================================================
--- c/src/lib/libcpu/arm/s3c24xx/irq/irq.h	(revision 2a2469b7d18a2d57cb9a828846f18f3bf39e9005)
+++ c/src/lib/libcpu/arm/s3c24xx/irq/irq.h	(revision f4dc319a8f92190c6efac916fb8b9b651d89df7c)
@@ -1,3 +1,8 @@
 /* irq.h
+ *
+ *  Copyright (c) 2010 embedded brains GmbH.
+ *
+ *  CopyRight (C) 2000 Canon Research France SA.
+ *  Emmanuel Raguet,  mailto:raguet@crf.canon.fr
  *
  *  Common file, merged from s3c2400/irq/irq.h and s3c2410/irq/irq.h
@@ -6,20 +11,10 @@
 #ifndef _IRQ_H_
 #define _IRQ_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
 
-/*
- * Include some preprocessor value also used by assember code
- */
+#include <rtems.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
 
-#include <rtems/irq.h>
-#include <rtems.h>
 #include <s3c24xx.h>
-
-extern void default_int_handler(rtems_irq_hdl_param unused);
-/*-------------------------------------------------------------------------+
-| Constants
-+--------------------------------------------------------------------------*/
 
 #ifdef CPU_S3C2400
@@ -94,23 +89,7 @@
 #endif
 
-extern void *bsp_vector_table;
-#define VECTOR_TABLE &bsp_vector_table
+#define BSP_INTERRUPT_VECTOR_MIN 0
 
-/*-------------------------------------------------------------------------+
-| Function Prototypes.
-+--------------------------------------------------------------------------*/
-/*
- * ------------------ RTEMS Single Irq Handler Mngt Routines ----------------
- */
-
-/*
- * function to initialize the interrupt for a specific BSP
- */
-void BSP_rtems_irq_mngt_init();
-
-
-#ifdef __cplusplus
-}
-#endif
+#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
 
 #endif /* _IRQ_H_ */
