[libcpu][arm926] Optimize irq trap code.

This commit is contained in:
ardafu 2015-05-04 16:13:43 +08:00
parent 854d8866d3
commit a13132b302
1 changed files with 14 additions and 23 deletions

View File

@ -25,8 +25,9 @@
#include <rtthread.h> #include <rtthread.h>
#include <rthw.h> #include <rthw.h>
#include <interrupt.h>
#define INT_IRQ 0x00
#define INT_FIQ 0x01
extern struct rt_thread *rt_current_thread; extern struct rt_thread *rt_current_thread;
#ifdef RT_USING_FINSH #ifdef RT_USING_FINSH
@ -171,24 +172,18 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
rt_hw_cpu_shutdown(); rt_hw_cpu_shutdown();
} }
extern struct rt_irq_desc irq_desc[];
extern rt_uint32_t rt_hw_interrupt_get_active(rt_uint32_t fiq_irq);
extern void rt_hw_interrupt_ack(rt_uint32_t fiq_irq, rt_uint32_t id);
void rt_hw_trap_irq() void rt_hw_trap_irq()
{ {
rt_isr_handler_t isr_func; rt_isr_handler_t isr_func;
rt_uint32_t irqstat;
rt_uint32_t irq; rt_uint32_t irq;
void *param; void *param;
extern struct rt_irq_desc irq_desc[];
/* get irq number */ /* get irq number */
irqstat = rt_hw_interrupt_get_active(INT_IRQ, &irq); irq = rt_hw_interrupt_get_active(INT_IRQ);
if (irqstat == 0)
{
rt_kprintf("No interrupt occur\n");
rt_hw_interrupt_ack(INT_IRQ);
return;
}
/* get interrupt service routine */ /* get interrupt service routine */
isr_func = irq_desc[irq].handler; isr_func = irq_desc[irq].handler;
@ -197,26 +192,20 @@ void rt_hw_trap_irq()
/* turn to interrupt service routine */ /* turn to interrupt service routine */
isr_func(irq, param); isr_func(irq, param);
rt_hw_interrupt_ack(INT_IRQ); rt_hw_interrupt_ack(INT_IRQ, irq);
#ifdef RT_USING_INTERRUPT_INFO
irq_desc[irq].counter ++; irq_desc[irq].counter ++;
#endif
} }
void rt_hw_trap_fiq() void rt_hw_trap_fiq()
{ {
rt_isr_handler_t isr_func; rt_isr_handler_t isr_func;
rt_uint32_t irqstat;
rt_uint32_t irq; rt_uint32_t irq;
void *param; void *param;
extern struct rt_irq_desc irq_desc[];
/* get irq number */ /* get irq number */
irqstat = rt_hw_interrupt_get_active(INT_FIQ, &irq); irq = rt_hw_interrupt_get_active(INT_FIQ);
if (irqstat == 0)
{
rt_kprintf("No interrupt occur\n");
rt_hw_interrupt_ack(INT_FIQ);
return;
}
/* get interrupt service routine */ /* get interrupt service routine */
isr_func = irq_desc[irq].handler; isr_func = irq_desc[irq].handler;
@ -225,6 +214,8 @@ void rt_hw_trap_fiq()
/* turn to interrupt service routine */ /* turn to interrupt service routine */
isr_func(irq, param); isr_func(irq, param);
rt_hw_interrupt_ack(INT_FIQ); rt_hw_interrupt_ack(INT_FIQ, irq);
#ifdef RT_USING_INTERRUPT_INFO
irq_desc[irq].counter ++; irq_desc[irq].counter ++;
#endif
} }