summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-04-30 13:15:49 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-04-30 13:15:49 +0000
commitf4dc319a8f92190c6efac916fb8b9b651d89df7c (patch)
tree13fc80d373ab83ea5a7111ae927bc8815e9f4fca
parent2010-04-30 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-f4dc319a8f92190c6efac916fb8b9b651d89df7c.tar.bz2
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.
-rw-r--r--c/src/lib/libcpu/arm/ChangeLog17
-rw-r--r--c/src/lib/libcpu/arm/Makefile.am34
-rw-r--r--c/src/lib/libcpu/arm/at91rm9200/clock/clock.c2
-rw-r--r--c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S41
-rw-r--r--c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c37
-rw-r--r--c/src/lib/libcpu/arm/at91rm9200/irq/irq.c115
-rw-r--r--c/src/lib/libcpu/arm/at91rm9200/irq/irq.h36
-rw-r--r--c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c2
-rw-r--r--c/src/lib/libcpu/arm/lpc22xx/irq/irq.c135
-rw-r--r--c/src/lib/libcpu/arm/lpc22xx/irq/irq.h40
-rw-r--r--c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c2
-rw-r--r--c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S47
-rw-r--r--c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c30
-rw-r--r--c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c110
-rw-r--r--c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h41
-rw-r--r--c/src/lib/libcpu/arm/preinstall.am37
-rwxr-xr-xc/src/lib/libcpu/arm/pxa255/clock/clock.c2
-rwxr-xr-xc/src/lib/libcpu/arm/pxa255/irq/irq.c117
-rwxr-xr-xc/src/lib/libcpu/arm/pxa255/irq/irq.h24
-rw-r--r--c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c2
-rw-r--r--c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S42
-rw-r--r--c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c35
-rw-r--r--c/src/lib/libcpu/arm/s3c24xx/irq/irq.c102
-rw-r--r--c/src/lib/libcpu/arm/s3c24xx/irq/irq.h41
24 files changed, 248 insertions, 843 deletions
diff --git a/c/src/lib/libcpu/arm/ChangeLog b/c/src/lib/libcpu/arm/ChangeLog
index 3e4348e3e4..912c928829 100644
--- a/c/src/lib/libcpu/arm/ChangeLog
+++ b/c/src/lib/libcpu/arm/ChangeLog
@@ -1,3 +1,20 @@
+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>
* configure.ac, Makefile.am, at91rm9200/clock/clock.c,
diff --git a/c/src/lib/libcpu/arm/Makefile.am b/c/src/lib/libcpu/arm/Makefile.am
index d2e18e4f26..07c8f6fdbe 100644
--- a/c/src/lib/libcpu/arm/Makefile.am
+++ b/c/src/lib/libcpu/arm/Makefile.am
@@ -10,11 +10,16 @@ EXTRA_DIST =
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
## shared/arm920
@@ -52,10 +57,9 @@ pxa255_pmc_rel_CPPFLAGS = $(AM_CPPFLAGS)
pxa255_pmc_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
## 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)
pxa255_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
@@ -98,11 +102,10 @@ at91rm9200_pmc_rel_CPPFLAGS = $(AM_CPPFLAGS)
at91rm9200_pmc_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
## 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)
at91rm9200_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
@@ -124,11 +127,10 @@ mc9328mxl_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
mc9328mxl_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
## 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)
mc9328mxl_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
@@ -150,11 +152,10 @@ s3c24xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
s3c24xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
## 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)
s3c24xx_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
@@ -176,11 +177,10 @@ lpc22xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
lpc22xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
## 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)
lpc22xx_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
diff --git a/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c b/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c
index 503239613b..3de17af1a5 100644
--- a/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c
+++ b/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <bsp.h>
-#include <irq.h>
+#include <bsp/irq.h>
#include <at91rm9200.h>
#include <at91rm9200_pmc.h>
diff --git a/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S b/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S
deleted file mode 100644
index d8b6757e4c..0000000000
--- a/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S
+++ /dev/null
@@ -1,41 +0,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
diff --git a/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c
deleted file mode 100644
index eaf21e37b1..0000000000
--- a/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c
+++ /dev/null
@@ -1,37 +0,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;
-}
-
diff --git a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c
index 416c63125b..a2b34d4525 100644
--- a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c
+++ b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c
@@ -1,6 +1,8 @@
/*
* Atmel AT91RM9200 Interrupt handler
*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
* Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
*
* The license and distribution terms for this file may be
@@ -10,106 +12,47 @@
*
* $Id$
*/
+
#include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
-#include <at91rm9200.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
-/*
- * This function check that the value given for the irq line
- * is valid.
- */
-static int isValidInterrupt(int irq)
-{
- if ( (irq < 0) || (irq >= AT91RM9200_MAX_INT)) {
- return 0;
- }
- return 1;
-}
+#include <at91rm9200.h>
-/*
- * Installs the interrupt handler.
- */
-int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
+void bsp_interrupt_dispatch(void)
{
- rtems_interrupt_level level;
-
- 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_vector_number vector = AIC_CTL_REG(AIC_ISR);
- rtems_interrupt_disable(level);
+ bsp_interrupt_handler_dispatch(vector);
- /*
- * 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;
+ AIC_CTL_REG(AIC_EOICR) = 0;
}
-/*
- * Remove and interrupt handler
- */
-int BSP_remove_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;
- }
+ 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_vector_disable(rtems_vector_number vector)
+{
+ AIC_CTL_REG(AIC_IDCR) = 1 << vector;
- /*
- * mask interrupt
- */
- AIC_CTL_REG(AIC_IDCR) = 1 << irq->name;
+ return RTEMS_SUCCESSFUL;
+}
- /*
- * Disable interrupt on device
- */
- if(irq->off) {
- irq->off(irq);
- }
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+ /* disable all interrupts */
+ AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
- /*
- * restore the default irq value
- */
- AIC_SVR_REG(irq->name * 4) = (uint32_t) default_int_handler;
+ _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
- rtems_interrupt_enable(level);
+ return RTEMS_SUCCESSFUL;
+}
- return 1;
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+ printk("spurious interrupt: %u\n", vector);
}
diff --git a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h
index 1219c07e26..8ca865e1c1 100644
--- a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h
+++ b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.h
@@ -1,6 +1,8 @@
/*
* Interrupt handler Header file
*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
* Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
*
* The license and distribution terms for this file may be
@@ -15,24 +17,14 @@
#ifndef __IRQ_H__
#define __IRQ_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef __asm__
-/*
- * Include some preprocessor value also used by assember code
- */
-
-#include <rtems/irq.h>
#include <rtems.h>
-#include <at91rm9200.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.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
#define AT91RM9200_INT_SYSIRQ 1
@@ -68,20 +60,8 @@ extern void default_int_handler(rtems_irq_hdl_param unused);
#define AT91RM9200_INT_IRQ6 31
#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
-
-/*
- * function to initialize the interrupt for a specific BSP
- */
-void BSP_rtems_irq_mngt_init();
-
-#endif /* __asm__ */
+#define BSP_INTERRUPT_VECTOR_MIN 0
-#ifdef __cplusplus
-}
-#endif
+#define BSP_INTERRUPT_VECTOR_MAX (AT91RM9200_MAX_INT - 1)
#endif /* __IRQ_H__ */
diff --git a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
index 4f8a31bd9a..7ce4ec6c63 100644
--- a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
+++ b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
@@ -16,7 +16,7 @@
*/
#include <rtems.h>
#include <bsp.h>
-#include <irq.h>
+#include <bsp/irq.h>
#include <lpc22xx.h>
#include <rtems/bspIo.h> /* for printk */
diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c
index dfc97f9135..2c5f392cb7 100644
--- a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c
+++ b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c
@@ -1,6 +1,8 @@
/*
* Philps LPC22XX Interrupt handler
*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
* Copyright (c) 2006 by Ray<rayx.cn@gmail.com> to support LPC ARM
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -9,117 +11,68 @@
*
* $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;
+ return RTEMS_SUCCESSFUL;
+}
- vic_cntl=(int *)VICVectCntlBase;
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+{
+ VICIntEnClr = 1 << vector;
- if (!isValidInterrupt(irq->name)) {
- return 0;
- }
+ return RTEMS_SUCCESSFUL;
+}
- /*
- * Check if default handler is actually connected. If not issue an error.
- */
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+ volatile uint32_t *ctrl = (volatile uint32_t *) VICVectCntlBase;
+ size_t i = 0;
- if (bsp_tbl[irq->name] != default_int_handler) {
- return 0;
- }
+ /* Disable all interrupts */
+ VICIntEnClr = 0xffffffff;
- rtems_interrupt_disable(level);
+ /* Use IRQ category */
+ VICIntSelect = 0;
- /*
- * 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;
+ /* Enable access in USER mode */
+ VICProtection = 0;
- VICIntEnable |= 1 << irq->name;
+ for (i = 0; i < 16; ++i) {
+ /* Disable vector mode */
+ ctrl [i] = 0;
- if(irq->on)
- {
- irq->on(irq);
- }
+ /* Acknowledge interrupts for all priorities */
+ VICVectAddr = 0;
+ }
+ /* Acknowledge interrupts for all priorities */
+ VICVectAddr = 0;
- rtems_interrupt_enable(level);
+ /* Install the IRQ exception handler */
+ _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
- 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)
+void bsp_interrupt_handler_default(rtems_vector_number vector)
{
- rtems_interrupt_level level;
- rtems_irq_hdl *bsp_tbl;
-
- 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;
+ printk("spurious interrupt: %u\n", vector);
}
-
-
diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h
index 3904484585..def9b61e5b 100644
--- a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h
+++ b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h
@@ -1,6 +1,8 @@
/*
* Interrupt handler Header file
*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
* Copyright (c) 2006 by Ray <rayx.cn@gmail.com> to support LPC ARM
*
* The license and distribution terms for this file may be
@@ -15,25 +17,13 @@
#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/irq.h>
#include <rtems.h>
-#include <lpc22xx.h>
-
-extern void default_int_handler(rtems_irq_hdl_param unused);
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
-/***********************************************************************
- * Constants
- **********************************************************************/
+#endif /* __asm__ */
/* possible interrupt sources on the LPC22xx */
#define LPC22xx_INTERRUPT_WDINT 0 /* Watchdog int. 0 */
@@ -67,6 +57,10 @@ extern void default_int_handler(rtems_irq_hdl_param unused);
#define LPC22xx_INTERRUPT_CAN4RX 27 /* CAN2 Rx interrupt */
#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)
#define PREFETCH_ABORT_VECTOR_ADDR (*(u_long *)0x0000000CL)
@@ -78,20 +72,4 @@ extern void default_int_handler(rtems_irq_hdl_param unused);
#define IRQ_ISR_ADDR (*(u_long *)0x00000038L)
#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__ */
diff --git a/c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c b/c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c
index 1f18e1ce76..2a4b0876e1 100644
--- a/c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c
+++ b/c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c
@@ -17,7 +17,7 @@
*/
#include <rtems.h>
#include <bsp.h>
-#include <irq.h>
+#include <bsp/irq.h>
#include <mc9328mxl.h>
#include <rtems/bspIo.h> /* for printk */
diff --git a/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S b/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S
deleted file mode 100644
index c2a33c4b22..0000000000
--- a/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S
+++ /dev/null
@@ -1,47 +0,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
diff --git a/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c
deleted file mode 100644
index 078d246b49..0000000000
--- a/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c
+++ /dev/null
@@ -1,30 +0,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;
- }
-}
-
diff --git a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
index 36d23dc1d9..d0d492782d 100644
--- a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
+++ b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
@@ -1,6 +1,8 @@
/*
* Motorola MC9328MXL Interrupt handler
*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
* Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
*
* The license and distribution terms for this file may be
@@ -10,105 +12,39 @@
*
* $Id$
*/
+
#include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
-#include <mc9328mxl.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
-mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
+#include <mc9328mxl.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 = *((uint32_t *) 0x00223040) >> 16;
+
+ 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);
-
+ return RTEMS_SUCCESSFUL;
+}
- /*
- * 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_status_code bsp_interrupt_facility_initialize(void)
+{
- rtems_interrupt_enable(level);
+ _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
- return 1;
+ return RTEMS_SUCCESSFUL;
}
-
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+ printk("spurious interrupt: %u\n", vector);
+}
diff --git a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h
index 9998d2903c..eeb958027b 100644
--- a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h
+++ b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h
@@ -1,6 +1,8 @@
/*
* Interrupt handler Header file
*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
* Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
*
* The license and distribution terms for this file may be
@@ -15,26 +17,13 @@
#ifndef __IRQ_H__
#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 <mc9328mxl.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
-extern void default_int_handler(rtems_irq_hdl_param);
-/***********************************************************************
- * Constants
- **********************************************************************/
+#endif /* __asm__ */
/* possible interrupt sources on the MC9328MXL */
#define BSP_INT_UART3_PFERR 0
@@ -103,24 +92,8 @@ extern void default_int_handler(rtems_irq_hdl_param);
#define BSP_INT_WDT 63
#define BSP_MAX_INT 64
-typedef struct {
- rtems_irq_hdl vector;
- rtems_irq_hdl_param data;
-} mc9328mxl_irq_info_t;
-
-
-
-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__ */
+#define BSP_INTERRUPT_VECTOR_MIN 0
-#ifdef __cplusplus
-}
-#endif
+#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
#endif /* __IRQ_H__ */
diff --git a/c/src/lib/libcpu/arm/preinstall.am b/c/src/lib/libcpu/arm/preinstall.am
index 7077f0e142..751a085f58 100644
--- a/c/src/lib/libcpu/arm/preinstall.am
+++ b/c/src/lib/libcpu/arm/preinstall.am
@@ -18,12 +18,17 @@ $(PROJECT_INCLUDE)/$(dirstamp):
@: > $(PROJECT_INCLUDE)/$(dirstamp)
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
@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
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
PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/mmu.h
@@ -41,9 +46,9 @@ $(PROJECT_INCLUDE)/ffuart.h: pxa255/include/ffuart.h $(PROJECT_INCLUDE)/$(dirsta
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/ffuart.h
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
$(PROJECT_INCLUDE)/at91rm9200.h: at91rm9200/include/at91rm9200.h $(PROJECT_INCLUDE)/$(dirstamp)
@@ -78,18 +83,18 @@ $(PROJECT_INCLUDE)/at91rm9200_usart.h: at91rm9200/include/at91rm9200_usart.h $(P
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/at91rm9200_usart.h
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
$(PROJECT_INCLUDE)/mc9328mxl.h: mc9328mxl/include/mc9328mxl.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mc9328mxl.h
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
$(PROJECT_INCLUDE)/s3c24xx.h: s3c24xx/include/s3c24xx.h $(PROJECT_INCLUDE)/$(dirstamp)
@@ -104,16 +109,16 @@ $(PROJECT_INCLUDE)/s3c2410.h: s3c24xx/include/s3c2410.h $(PROJECT_INCLUDE)/$(dir
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/s3c2410.h
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
$(PROJECT_INCLUDE)/lpc22xx.h: lpc22xx/include/lpc22xx.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/lpc22xx.h
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
diff --git a/c/src/lib/libcpu/arm/pxa255/clock/clock.c b/c/src/lib/libcpu/arm/pxa255/clock/clock.c
index bb9e85c698..dadccd7d2e 100755
--- a/c/src/lib/libcpu/arm/pxa255/clock/clock.c
+++ b/c/src/lib/libcpu/arm/pxa255/clock/clock.c
@@ -18,7 +18,7 @@
#include <stdlib.h>
#include <bsp.h>
#include <bspopts.h>
-#include <irq.h>
+#include <bsp/irq.h>
#include <pxa255.h>
#if ON_SKYEYE==1
diff --git a/c/src/lib/libcpu/arm/pxa255/irq/irq.c b/c/src/lib/libcpu/arm/pxa255/irq/irq.c
index 2bfcadc98f..61df3f312b 100755
--- a/c/src/lib/libcpu/arm/pxa255/irq/irq.c
+++ b/c/src/lib/libcpu/arm/pxa255/irq/irq.c
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
* PXA255 Interrupt handler by Yang Xi <hiyangxi@gmail.com>
* Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
*
@@ -8,108 +10,49 @@
*
* $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;
-
- 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;
+ XSCALE_INT_ICMR |= 1 << vector;
- /*
- * 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;
-
- if (!isValidInterrupt(irq->name)) {
- return 0;
- }
+ XSCALE_INT_ICMR &= ~(1 << vector);
- /*
- * 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);
+ return RTEMS_SUCCESSFUL;
+}
- /*
- * mask interrupt
- */
- XSCALE_INT_ICMR = XSCALE_INT_ICMR & (~(1 << irq->name));
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+ /* disable all interrupts */
+ XSCALE_INT_ICMR = 0x0;
- /*
- * Disable interrupt on device
- */
- if(irq->off) {
- irq->off(irq);
- }
+ /* Direct the interrupt to IRQ*/
+ XSCALE_INT_ICLR = 0x0;
- /*
- * restore the default irq value
- */
- IRQ_table[irq->name] = dummy_handler;
+ /* Install the IRQ exception handler */
+ _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
- _CPU_ISR_Enable(level);
+ return RTEMS_SUCCESSFUL;
+}
- return 1;
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+ printk("spurious interrupt: %u\n", vector);
}
diff --git a/c/src/lib/libcpu/arm/pxa255/irq/irq.h b/c/src/lib/libcpu/arm/pxa255/irq/irq.h
index 40ad888696..ddb8b70115 100755
--- a/c/src/lib/libcpu/arm/pxa255/irq/irq.h
+++ b/c/src/lib/libcpu/arm/pxa255/irq/irq.h
@@ -1,4 +1,6 @@
/*
+ * 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>
*
@@ -12,30 +14,18 @@
#ifndef __IRQ_H__
#define __IRQ_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef __asm__
-/*
- * Include some preprocessor value also used by assember code
- */
-
-#include <rtems/irq.h>
#include <rtems.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.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__ */
diff --git a/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c b/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c
index 76ff9376e1..8a05c6bb1a 100644
--- a/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c
+++ b/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c
@@ -13,7 +13,7 @@
* $Id$
*/
#include <rtems.h>
-#include <irq.h>
+#include <bsp/irq.h>
#include <bsp.h>
#include <s3c24xx.h>
diff --git a/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S b/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S
deleted file mode 100644
index 78d0c5ce44..0000000000
--- a/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_asm.S
+++ /dev/null
@@ -1,42 +0,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
diff --git a/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c
deleted file mode 100644
index 97c24c4fb4..0000000000
--- a/c/src/lib/libcpu/arm/s3c24xx/irq/bsp_irq_init.c
+++ /dev/null
@@ -1,35 +0,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
- */
-}
diff --git a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c
index d64ace0f63..954ae49960 100644
--- a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c
+++ b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c
@@ -2,6 +2,8 @@
*
* 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.
* Emmanuel Raguet, mailto:raguet@crf.canon.fr
*
@@ -12,99 +14,37 @@
* $Id$
*/
-
#include <bsp.h>
-#include <irq.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apiext.h>
-#include <s3c24xx.h>
+#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
-/*
- * This function check that the value given for the irq line
- * is valid.
- */
+#include <s3c24xx.h>
-static int isValidInterrupt(int irq)
+void bsp_interrupt_dispatch(void)
{
- if ( (irq < 0) || (irq > BSP_MAX_INT)) {
- return 0;
- }
+ rtems_vector_number vector = *((uint32_t *) rINTOFFSET_ADDR);
- 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;
-
- if (!isValidInterrupt(irq->name)) {
- return 0;
- }
-
- /*
- * 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);
-
- /*
- * Disable interrupt on device
- */
- if(irq->off) {
- irq->off(irq);
- }
+ return RTEMS_SUCCESSFUL;
+}
- /*
- * restore the default irq value
- */
- *(HdlTable + irq->name) = default_int_handler;
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+ _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
- _CPU_ISR_Enable(level);
+ return RTEMS_SUCCESSFUL;
+}
- return 1;
+void bsp_interrupt_handler_default(rtems_vector_number vector)
+{
+ printk("spurious interrupt: %u\n", vector);
}
diff --git a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h
index 5870f06377..8882b4362b 100644
--- a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h
+++ b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.h
@@ -1,26 +1,21 @@
/* 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
*/
#ifndef _IRQ_H_
#define _IRQ_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Include some preprocessor value also used by assember code
- */
-#include <rtems/irq.h>
#include <rtems.h>
-#include <s3c24xx.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
-extern void default_int_handler(rtems_irq_hdl_param unused);
-/*-------------------------------------------------------------------------+
-| Constants
-+--------------------------------------------------------------------------*/
+#include <s3c24xx.h>
#ifdef CPU_S3C2400
/* possible interrupt sources */
@@ -93,25 +88,9 @@ extern void default_int_handler(rtems_irq_hdl_param unused);
#define BSP_MAX_INT 32
#endif
-extern void *bsp_vector_table;
-#define VECTOR_TABLE &bsp_vector_table
-
-/*-------------------------------------------------------------------------+
-| Function Prototypes.
-+--------------------------------------------------------------------------*/
-/*
- * ------------------ RTEMS Single Irq Handler Mngt Routines ----------------
- */
+#define BSP_INTERRUPT_VECTOR_MIN 0
-/*
- * 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_ */
/* end of include file */