diff options
| author | weety <[email protected]> | 2013-03-18 16:42:29 +0800 |
|---|---|---|
| committer | weety <[email protected]> | 2013-03-19 11:25:46 +0800 |
| commit | 7917cf09e78636699ddea076d049324c9c303294 (patch) | |
| tree | e9db2dbeb89e835d853ebb4b6f124cbe9d6c92f4 /libcpu | |
| parent | 9678ee67e94483e68caf018a10486e411861a178 (diff) | |
remain the old handler to keep forward compatibility
Diffstat (limited to 'libcpu')
| -rwxr-xr-x | libcpu/arm/at91sam926x/interrupt.c | 20 | ||||
| -rw-r--r-- | libcpu/arm/at91sam926x/interrupt.h | 11 | ||||
| -rwxr-xr-x | libcpu/arm/at91sam926x/trap.c | 1 |
3 files changed, 14 insertions, 18 deletions
diff --git a/libcpu/arm/at91sam926x/interrupt.c b/libcpu/arm/at91sam926x/interrupt.c index 206444b3aa..012ecc66aa 100755 --- a/libcpu/arm/at91sam926x/interrupt.c +++ b/libcpu/arm/at91sam926x/interrupt.c @@ -14,7 +14,6 @@ #include <rtthread.h> #include "at91sam926x.h" -#include "interrupt.h" #define MAX_HANDLERS (AIC_IRQS + PIN_IRQS) @@ -308,17 +307,26 @@ void rt_hw_interrupt_umask(int irq) * @param handler the interrupt service routine to be installed * @param param the interrupt service function parameter * @param name the interrupt name + * @return old handler */ -void rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, +rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, void *param, char *name) { + rt_isr_handler_t old_handler = RT_NULL; + if(vector < MAX_HANDLERS) { - rt_snprintf(irq_desc[vector].irq_name, RT_NAME_MAX - 1, "%s", name); - irq_desc[vector].isr_handle = (rt_isr_handler_t)handler; - irq_desc[vector].param = param; - irq_desc[vector].interrupt_cnt = 0; + old_handler = irq_desc[vector].isr_handle; + if (handler != RT_NULL) + { + rt_snprintf(irq_desc[vector].irq_name, RT_NAME_MAX - 1, "%s", name); + irq_desc[vector].isr_handle = (rt_isr_handler_t)handler; + irq_desc[vector].param = param; + irq_desc[vector].interrupt_cnt = 0; + } } + + return old_handler; } /*@}*/ diff --git a/libcpu/arm/at91sam926x/interrupt.h b/libcpu/arm/at91sam926x/interrupt.h deleted file mode 100644 index 582f279f1a..0000000000 --- a/libcpu/arm/at91sam926x/interrupt.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __INTERRUPT_H__ -#define __INTERRUPT_H__ - -struct rt_irq_desc { - char irq_name[RT_NAME_MAX]; - rt_isr_handler_t isr_handle; - void *param; - rt_uint32_t interrupt_cnt; -}; - -#endif
\ No newline at end of file diff --git a/libcpu/arm/at91sam926x/trap.c b/libcpu/arm/at91sam926x/trap.c index de53fe61af..841c8b6813 100755 --- a/libcpu/arm/at91sam926x/trap.c +++ b/libcpu/arm/at91sam926x/trap.c @@ -16,7 +16,6 @@ #include <rthw.h> #include "at91sam926x.h" -#include "interrupt.h" /** * @addtogroup AT91SAM926X |
