提交 7917cf09 编写于 作者: W weety

remain the old handler to keep forward compatibility

上级 9678ee67
......@@ -41,9 +41,10 @@ rt_uint8_t *rt_hw_stack_init(void *entry,
void rt_hw_interrupt_init(void);
void rt_hw_interrupt_mask(int vector);
void rt_hw_interrupt_umask(int vector);
void rt_hw_interrupt_install(int vector,
rt_isr_handler_t rt_hw_interrupt_install(int vector,
rt_isr_handler_t handler,
void *param, char *name);
void *param,
char *name);
void rt_hw_interrupt_handle(int vector);
rt_base_t rt_hw_interrupt_disable(void);
......
......@@ -427,6 +427,14 @@ void rt_module_unload_sethook(void (*hook)(rt_module_t module));
*/
typedef void (*rt_isr_handler_t)(int vector, void *param);
struct rt_irq_desc {
char irq_name[RT_NAME_MAX];
rt_isr_handler_t isr_handle;
void *param;
rt_uint32_t interrupt_cnt;
};
/*
* rt_interrupt_enter and rt_interrupt_leave only can be called by BSP
*/
......
......@@ -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;
}
/*@}*/
......
#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
......@@ -16,7 +16,6 @@
#include <rthw.h>
#include "at91sam926x.h"
#include "interrupt.h"
/**
* @addtogroup AT91SAM926X
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册