forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -10,11 +10,16 @@ EXTRA_DIST =
|
||||
|
||||
noinst_PROGRAMS =
|
||||
|
||||
## shared/include
|
||||
if shared
|
||||
include_bspdir = $(includedir)/bsp
|
||||
include_libcpudir = $(includedir)/libcpu
|
||||
|
||||
include_libcpu_HEADERS = shared/include/mmu.h
|
||||
include_bsp_HEADERS =
|
||||
include_libcpu_HEADERS =
|
||||
|
||||
## shared/include
|
||||
if shared
|
||||
|
||||
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)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <bsp.h>
|
||||
#include <irq.h>
|
||||
#include <bsp/irq.h>
|
||||
#include <at91rm9200.h>
|
||||
#include <at91rm9200_pmc.h>
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 <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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* mask interrupt
|
||||
*/
|
||||
AIC_CTL_REG(AIC_IDCR) = 1 << irq->name;
|
||||
|
||||
/*
|
||||
* Disable interrupt on device
|
||||
*/
|
||||
if(irq->off) {
|
||||
irq->off(irq);
|
||||
}
|
||||
|
||||
/*
|
||||
* restore the default irq value
|
||||
*/
|
||||
AIC_SVR_REG(irq->name * 4) = (uint32_t) default_int_handler;
|
||||
|
||||
rtems_interrupt_enable(level);
|
||||
|
||||
return 1;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_facility_initialize(void)
|
||||
{
|
||||
/* disable all interrupts */
|
||||
AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
|
||||
|
||||
_CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void bsp_interrupt_handler_default(rtems_vector_number vector)
|
||||
{
|
||||
printk("spurious interrupt: %u\n", vector);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
#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__ */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
vic_cntl=(int *)VICVectCntlBase;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
VICIntEnable |= 1 << irq->name;
|
||||
|
||||
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;
|
||||
rtems_irq_hdl *bsp_tbl;
|
||||
VICIntEnClr = 1 << vector;
|
||||
|
||||
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;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_facility_initialize(void)
|
||||
{
|
||||
volatile uint32_t *ctrl = (volatile uint32_t *) VICVectCntlBase;
|
||||
size_t i = 0;
|
||||
|
||||
/* Disable all interrupts */
|
||||
VICIntEnClr = 0xffffffff;
|
||||
|
||||
/* Use IRQ category */
|
||||
VICIntSelect = 0;
|
||||
|
||||
/* Enable access in USER mode */
|
||||
VICProtection = 0;
|
||||
|
||||
for (i = 0; i < 16; ++i) {
|
||||
/* Disable vector mode */
|
||||
ctrl [i] = 0;
|
||||
|
||||
/* Acknowledge interrupts for all priorities */
|
||||
VICVectAddr = 0;
|
||||
}
|
||||
|
||||
/* Acknowledge interrupts for all priorities */
|
||||
VICVectAddr = 0;
|
||||
|
||||
/* Install the IRQ exception handler */
|
||||
_CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void bsp_interrupt_handler_default(rtems_vector_number vector)
|
||||
{
|
||||
printk("spurious interrupt: %u\n", vector);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
#include <rtems/irq.h>
|
||||
#include <rtems/irq-extension.h>
|
||||
|
||||
extern void default_int_handler(rtems_irq_hdl_param unused);
|
||||
|
||||
/***********************************************************************
|
||||
* 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__ */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <bsp/irq.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
|
||||
#include <mc9328mxl.h>
|
||||
|
||||
mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
||||
/*
|
||||
* 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_interrupt_enable(level);
|
||||
|
||||
return 1;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_facility_initialize(void)
|
||||
{
|
||||
|
||||
_CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void bsp_interrupt_handler_default(rtems_vector_number vector)
|
||||
{
|
||||
printk("spurious interrupt: %u\n", vector);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
#define BSP_INTERRUPT_VECTOR_MIN 0
|
||||
|
||||
|
||||
|
||||
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__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
|
||||
|
||||
#endif /* __IRQ_H__ */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
XSCALE_INT_ICMR |= 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
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
XSCALE_INT_ICMR &= ~(1 << vector);
|
||||
|
||||
if (!isValidInterrupt(irq->name)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* mask interrupt
|
||||
*/
|
||||
XSCALE_INT_ICMR = XSCALE_INT_ICMR & (~(1 << irq->name));
|
||||
|
||||
/*
|
||||
* Disable interrupt on device
|
||||
*/
|
||||
if(irq->off) {
|
||||
irq->off(irq);
|
||||
}
|
||||
|
||||
/*
|
||||
* restore the default irq value
|
||||
*/
|
||||
IRQ_table[irq->name] = dummy_handler;
|
||||
|
||||
_CPU_ISR_Enable(level);
|
||||
|
||||
return 1;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_facility_initialize(void)
|
||||
{
|
||||
/* disable all interrupts */
|
||||
XSCALE_INT_ICMR = 0x0;
|
||||
|
||||
/* Direct the interrupt to IRQ*/
|
||||
XSCALE_INT_ICLR = 0x0;
|
||||
|
||||
/* Install the IRQ exception handler */
|
||||
_CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void bsp_interrupt_handler_default(rtems_vector_number vector)
|
||||
{
|
||||
printk("spurious interrupt: %u\n", vector);
|
||||
}
|
||||
|
||||
@@ -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__ */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* $Id$
|
||||
*/
|
||||
#include <rtems.h>
|
||||
#include <irq.h>
|
||||
#include <bsp/irq.h>
|
||||
#include <bsp.h>
|
||||
#include <s3c24xx.h>
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
*/
|
||||
}
|
||||
@@ -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 <bsp/irq.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
|
||||
#include <s3c24xx.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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
* restore the default irq value
|
||||
*/
|
||||
*(HdlTable + irq->name) = default_int_handler;
|
||||
|
||||
_CPU_ISR_Enable(level);
|
||||
|
||||
return 1;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_facility_initialize(void)
|
||||
{
|
||||
_CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void bsp_interrupt_handler_default(rtems_vector_number vector)
|
||||
{
|
||||
printk("spurious interrupt: %u\n", vector);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
#define BSP_INTERRUPT_VECTOR_MIN 0
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Function Prototypes.
|
||||
+--------------------------------------------------------------------------*/
|
||||
/*
|
||||
* ------------------ RTEMS Single Irq Handler Mngt Routines ----------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
Reference in New Issue
Block a user