diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-04-30 13:15:49 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-04-30 13:15:49 +0000 |
commit | f4dc319a8f92190c6efac916fb8b9b651d89df7c (patch) | |
tree | 13fc80d373ab83ea5a7111ae927bc8815e9f4fca /c/src/lib/libcpu/arm/mc9328mxl | |
parent | 2010-04-30 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-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/mc9328mxl')
-rw-r--r-- | c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c | 2 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S | 47 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c | 30 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c | 110 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h | 41 |
5 files changed, 31 insertions, 199 deletions
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__ */ |