update LPC2478: Modify the interrupt interface implementations.

This commit is contained in:
aozima 2013-03-23 20:33:41 +08:00
parent 1549b7db90
commit 2ccb3c7589
4 changed files with 13 additions and 36 deletions

View File

@ -37,7 +37,7 @@ void rt_timer_handler(int vector, void* param)
/** /**
* This function will init LPC2478 board * This function will init LPC2478 board
*/ */
void rt_hw_board_init() void rt_hw_board_init(void)
{ {
#if defined(RT_USING_DEVICE) && defined(RT_USING_UART1) #if defined(RT_USING_DEVICE) && defined(RT_USING_UART1)
rt_hw_serial_init(); rt_hw_serial_init();

View File

@ -64,9 +64,10 @@ void rt_hw_serial_init(void);
#define U0PINS 0x00000005 #define U0PINS 0x00000005
void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial) void rt_hw_uart_isr(int irqno, void *param)
{ {
UNUSED rt_uint32_t iir; UNUSED rt_uint32_t iir;
struct rt_lpcserial* lpc_serial = (struct rt_lpcserial*)param;
RT_ASSERT(lpc_serial != RT_NULL) RT_ASSERT(lpc_serial != RT_NULL)
@ -112,21 +113,6 @@ void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial)
VICVectAddr = 0; VICVectAddr = 0;
} }
#ifdef RT_USING_UART1
void rt_hw_uart_isr_1(int irqno, void* param)
{
/* get lpc serial device */
rt_hw_uart_isr(&serial1);
}
#endif
#ifdef RT_USING_UART2
void rt_hw_uart_isr_2(int irqno, void* param)
{
/* get lpc serial device */
rt_hw_uart_isr(&serial2);
}
#endif
/** /**
* @addtogroup LPC214x * @addtogroup LPC214x
@ -150,19 +136,8 @@ static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag)
UART_IER(lpc_serial->hw_base) = 0x01; UART_IER(lpc_serial->hw_base) = 0x01;
/* install ISR */ /* install ISR */
if (lpc_serial->irqno == UART0_INT) rt_hw_interrupt_install(lpc_serial->irqno,
{ rt_hw_uart_isr, lpc_serial, RT_NULL);
#ifdef RT_USING_UART1
rt_hw_interrupt_install(lpc_serial->irqno, rt_hw_uart_isr_1, RT_NULL, "uart1");
#endif
}
else
{
#ifdef RT_USING_UART2
rt_hw_interrupt_install(lpc_serial->irqno, rt_hw_uart_isr_2, RT_NULL, "uart2");
#endif
}
rt_hw_interrupt_umask(lpc_serial->irqno); rt_hw_interrupt_umask(lpc_serial->irqno);
} }

View File

@ -10,8 +10,10 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2008-12-11 XuXinming first version * 2008-12-11 XuXinming first version
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/ */
#include <rtthread.h>
#include <rthw.h> #include <rthw.h>
#include "LPC24xx.h" #include "LPC24xx.h"
@ -35,7 +37,7 @@ void rt_hw_interrupt_handler(int vector, void *param)
rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); rt_kprintf("Unhandled interrupt %d occured!!!\n", vector);
} }
void rt_hw_interrupt_init() void rt_hw_interrupt_init(void)
{ {
register int i; register int i;
@ -47,10 +49,10 @@ void rt_hw_interrupt_init()
VICIntSelect = 0; VICIntSelect = 0;
/* init exceptions table */ /* init exceptions table */
rt_memset(irq_desc, 0x00, sizeof(irq_desc));
for(i=0; i < MAX_HANDLERS; i++) for(i=0; i < MAX_HANDLERS; i++)
{ {
irq_desc[i].handler = (rt_isr_handler_t)rt_hw_interrupt_handler; irq_desc[i].handler = rt_hw_interrupt_handler;
irq_desc[i].param = RT_NULL;
vect_addr = (rt_uint32_t *)(VIC_BASE_ADDR + 0x100 + i*4); vect_addr = (rt_uint32_t *)(VIC_BASE_ADDR + 0x100 + i*4);
vect_cntl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + i*4); vect_cntl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + i*4);
@ -94,7 +96,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
old_handler = irq_desc[vector].handler; old_handler = irq_desc[vector].handler;
if (handler != RT_NULL) if (handler != RT_NULL)
{ {
irq_desc[vector].handler = (rt_isr_handler_t)handler; irq_desc[vector].handler = handler;
irq_desc[vector].param = param; irq_desc[vector].param = param;
} }
} }

View File

@ -126,7 +126,7 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
} }
extern rt_isr_handler_t isr_table[]; extern rt_isr_handler_t isr_table[];
void rt_hw_trap_irq() void rt_hw_trap_irq(void)
{ {
int irqno; int irqno;
struct rt_irq_desc* irq; struct rt_irq_desc* irq;
@ -139,7 +139,7 @@ void rt_hw_trap_irq()
irq->handler(irqno, irq->param); irq->handler(irqno, irq->param);
} }
void rt_hw_trap_fiq() void rt_hw_trap_fiq(void)
{ {
rt_kprintf("fast interrupt request\n"); rt_kprintf("fast interrupt request\n");
} }