Index: c/src/lib/libcpu/arm/mc9328mxl/irq/.cvsignore
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/.cvsignore	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
+++ c/src/lib/libcpu/arm/mc9328mxl/irq/.cvsignore	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
@@ -0,0 +1,14 @@
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+config.cache
+config.guess
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+missing
+mkinstalldirs
Index: c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
+++ c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
@@ -0,0 +1,45 @@
+/*
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ *
+ *  bsp_irq_asm.S,v 1.1 2002/11/13 17:55:06 joel Exp
+ */
+#define __asm__
+	
+/* 
+ * BSP specific interrupt handler for INT or FIQ. In here
+ * you do determine which interrupt happened and call its
+ * handler.
+ */
+	.globl ExecuteITHandler
+ExecuteITHandler :
+/*
+ * 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
+  ldr	r0, [r0, r1, LSL #2]	/* Read the address */
+
+
+  stmdb	  sp!,{lr}
+  ldr     lr, =IRQ_return         /* prepare the return from handler  */
+
+  mov     pc, r0		/* EXECUTE INT HANDLER */
+
+IRQ_return:
+  ldmia sp!,{lr}
+
+  mov pc, lr
Index: c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
+++ c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
@@ -0,0 +1,32 @@
+/*
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ *
+ *  $Id$
+ */
+#include <irq.h>
+#include <bsp.h>
+#include <mc9328mxl.h>
+
+extern void default_int_handler();
+
+/* 
+ * Interrupt system initialization. Disable interrupts, clear 
+ * any that are pending.
+ */
+void BSP_rtems_irq_mngt_init()
+{
+#if 0
+    /* disable all interrupts */
+    AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
+#endif
+
+}
+
Index: c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
+++ c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
@@ -0,0 +1,117 @@
+/*
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+#include <bsp.h>
+#include <irq.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/apiext.h>
+#include <mc9328mxl.h>
+
+/*
+ * 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;
+}
+
+/*
+ * 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_interrupt_level level;
+    uint32_t *bsp_tbl;
+
+    bsp_tbl = (uint32_t*)&bsp_vector_table;
+    
+    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;
+    }
+
+    _CPU_ISR_Disable(level);
+
+    /*
+     * store the new handler
+     */
+    bsp_tbl[irq->name] = irq->hdl;
+
+    /*
+     * Enable interrupt on device
+     */
+    if(irq->on)
+    {
+    	irq->on(irq);
+    }
+    
+    _CPU_ISR_Enable(level);
+    
+    return 1;
+}
+
+/* 
+ * 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_interrupt_level level;
+    uint32_t *bsp_tbl;
+
+    bsp_tbl = (uint32_t*)&bsp_vector_table;
+  
+    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;
+    }
+
+    _CPU_ISR_Disable(level);
+
+
+    /*
+     * Disable interrupt on device
+     */
+    if(irq->off) {
+        irq->off(irq);
+    }
+    /*
+     * restore the default irq value
+     */
+    bsp_tbl[irq->name] = default_int_handler;
+    
+
+    _CPU_ISR_Enable(level);
+
+    return 1;
+}
+
+
Index: c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h
===================================================================
--- c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
+++ c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h	(revision 1cfcfd3cfbf65c0d3171e8939134329db4539f08)
@@ -0,0 +1,170 @@
+/*
+ * Interrupt handler Header file
+ *
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ *
+ *  $Id$
+ */
+
+#ifndef __IRQ_H__
+#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 <mc9328mxl.h>
+
+extern void default_int_handler();
+/***********************************************************************
+ * Constants
+ **********************************************************************/
+
+/* enum of the possible interrupt sources on the AT91RM9200 */
+typedef enum {
+    BSP_INT_UART3_PFERR = 0,
+    BSP_INT_UART3_RTS,
+    BSP_INT_UART3_DTR,
+    BSP_INT_UART3_UARTC,
+    BSP_INT_UART3_TX,
+    BSP_INT_PEN_UP,
+    BSP_INT_CSI,
+    BSP_INT_MMA_MAC,
+    BSP_INT_MMA,
+    BSP_INT_COMP,
+    BSP_INT_MSIRQ,
+    BSP_INT_GPIO_PORTA,
+    BSP_INT_GPIO_PORTB,
+    BSP_INT_GPIO_PORTC,
+    BSP_INT_LCDC,
+    BSP_INT_SIM_IRQ,
+    BSP_INT_SIM_DATA,
+    BSP_INT_RTC,
+    BSP_INT_RTC_SAM,
+    BSP_INT_UART2_PFERR,
+    BSP_INT_UART2_RTS,
+    BSP_INT_UART2_DTR,
+    BSP_INT_UART2_UARTC,
+    BSP_INT_UART2_TX,
+    BSP_INT_UART2_RX,
+    BSP_INT_UART1_PFERR,
+    BSP_INT_UART1_RTS,
+    BSP_INT_UART1_DTR,
+    BSP_INT_UART1_UARTC,
+    BSP_INT_UART1_TX,
+    BSP_INT_UART1_RX,
+    BSP_INT_RES31,
+    BSP_INT_RES32,
+    BSP_INT_PEN_DATA,
+    BSP_INT_PWM,
+    BSP_INT_MMC_IRQ,
+    BSP_INT_SSI2_TX,
+    BSP_INT_SSI2_RX,
+    BSP_INT_SSI2_ERR,
+    BSP_INT_I2C,
+    BSP_INT_SPI2,
+    BSP_INT_SPI1,
+    BSP_INT_SSI_TX,
+    BSP_INT_SSI_TX_ERR,
+    BSP_INT_SSI_RX,
+    BSP_INT_SSI_RX_ERR,
+    BSP_INT_TOUCH,
+    BSP_INT_USBD0,
+    BSP_INT_USBD1,
+    BSP_INT_USBD2,
+    BSP_INT_USBD3,
+    BSP_INT_USBD4,
+    BSP_INT_USBD5,
+    BSP_INT_USBD6,
+    BSP_INT_UART3_RX,
+    BSP_INT_BTSYS,
+    BSP_INT_BTTIM,
+    BSP_INT_BTWUI,
+    BSP_INT_TIMER2,
+    BSP_INT_TIMER1,
+    BSP_INT_DMA_ERR,
+    BSP_INT_DMA,
+    BSP_INT_GPIO_PORTD,
+    BSP_INT_WDT,
+
+    BSP_MAX_INT
+} rtems_irq_symbolic_name;
+
+extern void *bsp_vector_table;
+#define VECTOR_TABLE &bsp_vector_table;
+  											   
+typedef unsigned char  rtems_irq_level;
+typedef unsigned char  rtems_irq_trigger;
+
+struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
+
+typedef void (*rtems_irq_hdl)       (void);
+typedef void (*rtems_irq_enable)    (const struct __rtems_irq_connect_data__*);
+typedef void (*rtems_irq_disable)   (const struct __rtems_irq_connect_data__*);
+typedef int  (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*);
+
+typedef struct __rtems_irq_connect_data__ {
+    /* IRQ line */
+    rtems_irq_symbolic_name       name;
+
+    /* Handler */
+    rtems_irq_hdl                 hdl;
+
+    /* function for enabling interrupts at device level. */
+    rtems_irq_enable              on;
+
+    /* function for disabling interrupts at device level. */
+    rtems_irq_disable             off;
+
+    /* Function to test if interrupt is enabled */
+    rtems_irq_is_enabled        isOn;
+
+    /* priority level of interrupt */
+    rtems_irq_level               irqLevel;
+
+    /* Trigger method (rising/falling edge or high/low level) */
+    rtems_irq_trigger             irqTrigger;
+} rtems_irq_connect_data;
+
+/*
+ * function to initialize the interrupt for a specific BSP
+ */
+void BSP_rtems_irq_mngt_init();
+
+
+/*
+ * function to connect a particular irq handler.
+ */
+int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
+
+/*
+ * function to get the current RTEMS irq handler for ptr->name. 
+ */
+int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
+
+/*
+ * function to disconnect the RTEMS irq handler for ptr->name.
+ */
+int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
+
+#endif /* __asm__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IRQ_H__ */
