summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/arm/lpc22xx
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 /c/src/lib/libcpu/arm/lpc22xx
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.
Diffstat (limited to 'c/src/lib/libcpu/arm/lpc22xx')
-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
3 files changed, 54 insertions, 123 deletions
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__ */