Index: c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S
===================================================================
--- c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S	(revision c193baadaf4ba825374104b150eceaed203800b0)
+++ 	(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: c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c
===================================================================
--- c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c	(revision c193baadaf4ba825374104b150eceaed203800b0)
+++ 	(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 c193baadaf4ba825374104b150eceaed203800b0)
+++ c/src/lib/libcpu/arm/at91rm9200/irq/irq.c	(revision 439d00cab323b64e3092ab16f604e05658c62691)
@@ -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 c193baadaf4ba825374104b150eceaed203800b0)
+++ c/src/lib/libcpu/arm/at91rm9200/irq/irq.h	(revision 439d00cab323b64e3092ab16f604e05658c62691)
@@ -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__ */
