2009-07-03 07:19:19 +08:00
|
|
|
/*
|
|
|
|
* File : board.c
|
|
|
|
* This file is part of RT-Thread RTOS
|
|
|
|
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
|
|
|
*
|
|
|
|
* The license and distribution terms for this file may be
|
|
|
|
* found in the file LICENSE in this distribution or at
|
|
|
|
* http://openlab.rt-thread.com/license/LICENSE
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2008-12-11 xuxinming first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include <rthw.h>
|
|
|
|
|
|
|
|
#include <LPC24xx.h>
|
|
|
|
#include "board.h"
|
|
|
|
|
2013-01-08 22:40:58 +08:00
|
|
|
#define DATA_COUNT 14400000/RT_TICK_PER_SECOND /* T0MR0 = delayInMs * (Fpclk / 1000); */
|
2009-07-03 07:19:19 +08:00
|
|
|
|
2011-03-17 17:14:38 +08:00
|
|
|
extern void rt_hw_serial_init(void);
|
2009-07-03 07:19:19 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup LPC2478
|
|
|
|
*/
|
|
|
|
/*@{*/
|
|
|
|
|
|
|
|
void rt_timer_handler(int vector)
|
|
|
|
{
|
|
|
|
T0IR |= 0x01; /* clear interrupt flag */
|
|
|
|
rt_tick_increase();
|
|
|
|
VICVectAddr = 0; /* Acknowledge Interrupt */
|
2010-06-04 15:47:17 +08:00
|
|
|
}
|
|
|
|
|
2009-07-03 07:19:19 +08:00
|
|
|
/**
|
|
|
|
* This function will init LPC2478 board
|
|
|
|
*/
|
|
|
|
void rt_hw_board_init()
|
2010-06-04 15:47:17 +08:00
|
|
|
{
|
2013-01-08 22:40:58 +08:00
|
|
|
#if defined(RT_USING_DEVICE) && defined(RT_USING_UART1)
|
|
|
|
rt_hw_serial_init();
|
|
|
|
rt_console_set_device("uart1");
|
|
|
|
#endif
|
|
|
|
|
2009-07-03 07:19:19 +08:00
|
|
|
T0IR = 0xff;
|
|
|
|
T0TC = 0;
|
|
|
|
T0MCR = 0x03;
|
2010-06-04 15:47:17 +08:00
|
|
|
T0MR0 = (DATA_COUNT);
|
2009-07-03 07:19:19 +08:00
|
|
|
|
2010-06-04 15:47:17 +08:00
|
|
|
rt_hw_interrupt_install(TIMER0_INT, rt_timer_handler, RT_NULL);
|
|
|
|
rt_hw_interrupt_umask(TIMER0_INT);
|
2009-07-03 07:19:19 +08:00
|
|
|
|
|
|
|
T0TCR = 0x01; //enable timer0 counter
|
|
|
|
}
|
|
|
|
|
|
|
|
/*@}*/
|