Skip to content

Commit

Permalink
remain the old handler to keep forward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
weety committed Mar 19, 2013
1 parent 9678ee6 commit 7917cf0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
5 changes: 3 additions & 2 deletions include/rthw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions include/rtthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
20 changes: 14 additions & 6 deletions libcpu/arm/at91sam926x/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <rtthread.h>
#include "at91sam926x.h"
#include "interrupt.h"

#define MAX_HANDLERS (AIC_IRQS + PIN_IRQS)

Expand Down Expand Up @@ -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;
}

/*@}*/
Expand Down
11 changes: 0 additions & 11 deletions libcpu/arm/at91sam926x/interrupt.h

This file was deleted.

1 change: 0 additions & 1 deletion libcpu/arm/at91sam926x/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <rthw.h>

#include "at91sam926x.h"
#include "interrupt.h"

/**
* @addtogroup AT91SAM926X
Expand Down

0 comments on commit 7917cf0

Please sign in to comment.