mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
* Makefile.am, configure.ac, preinstall.am: New Gumstix BSP and PXA255 support. * pxa255/clock/clock.c, pxa255/ffuart/ffuart.c, pxa255/include/bits.h, pxa255/include/ffuart.h, pxa255/include/pxa255.h, pxa255/irq/bsp_irq_asm.S, pxa255/irq/bsp_irq_init.c, pxa255/irq/irq.c, pxa255/irq/irq.h, pxa255/pmc/pmc.c, pxa255/timer/timer.c: New files.
116 lines
2.3 KiB
C
Executable File
116 lines
2.3 KiB
C
Executable File
/*
|
|
* PXA255 Interrupt handler by Yang Xi <hiyangxi@gmail.com>
|
|
* 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 <bsp.h>
|
|
#include <irq.h>
|
|
#include <rtems/score/thread.h>
|
|
#include <rtems/score/apiext.h>
|
|
#include <pxa255.h>
|
|
|
|
/*
|
|
* This function check that the value given for the irq line
|
|
* is valid.
|
|
*/
|
|
static int isValidInterrupt(int irq)
|
|
{
|
|
if ( (irq < 0) || (irq >= PRIMARY_IRQS)) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* Installs the interrupt handler.
|
|
*/
|
|
int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
|
{
|
|
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]!= default_int_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;
|
|
}
|
|
|
|
/*
|
|
* Remove and interrupt handler
|
|
*/
|
|
int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
|
{
|
|
rtems_interrupt_level level;
|
|
|
|
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] = default_int_handler;
|
|
|
|
_CPU_ISR_Enable(level);
|
|
|
|
return 1;
|
|
}
|