📄 board.c
字号:
/**************************************************************************************************
EDL RTOS Kernel
(c) Copyright 2005, Wu Jun
All Rights Reserved
For further information, please visit http://www.enjoydigitallife.com
* Description: None
* History:
Date Remarks
2005-01-06 Created initial version
2005-12-12 Finished the version 2.01
**************************************************************************************************/
#include "LPC2294.h"
#include "board.h"
#include "datatype.h"
#include "timer.h"
#include "serial.h"
#include "led.h"
#include "system.h"
/**************************************************************************************************
* Description: timer interrupt service routine
**************************************************************************************************/
void tm_isr(void)
{
U32 cpu_flags = sys_disableInterrupt();
T0IR = 0x01;
VICVectAddr = 0x00;
sys_restoreCpuFlags( cpu_flags );
tm_tick();
}
/**************************************************************************************************
* Description: timer low level initializing
**************************************************************************************************/
void tm_init(void)
{
T0TC = 0;
T0PR = 0;
T0MCR = 0x03;
T0MR0 = 11059200 / TICKS_PER_SECOND;
T0TCR = 0x03;
T0TCR = 0x01;
VICVectCntl0 = ( 0x20 | 4 );
VICVectAddr0 = (U32)tm_isr;
VICIntEnable = (U32)( 1 << 4 );
}
/**************************************************************************************************
* Description: initialize board
**************************************************************************************************/
void bd_initBoard( void )
{
/* configure pin function of ARM */
PINSEL2 = 0x0f814914;
/* configure bank */
BCFG0 = 0x1000ffef;
BCFG1 = 0x1000ffef;
/* configure PLL,VPB */
PLLCON = 1;
#if (Fpclk / (Fcclk / 4)) == 1
VPBDIV = 0;
#endif
#if (Fpclk / (Fcclk / 4)) == 2
VPBDIV = 2;
#endif
#if (Fpclk / (Fcclk / 4)) == 4
VPBDIV = 1;
#endif
#if (Fcco / Fcclk) == 2
PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
#endif
#if (Fcco / Fcclk) == 4
PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
#endif
#if (Fcco / Fcclk) == 8
PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
#endif
#if (Fcco / Fcclk) == 16
PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
#endif
PLLFEED = 0xaa;
PLLFEED = 0x55;
while((PLLSTAT & (1 << 10)) == 0);
PLLCON = 3;
PLLFEED = 0xaa;
PLLFEED = 0x55;
/* initialize interrupt vectors */
VICIntEnClr = 0xffffffff;
VICVectAddr = 0;
VICIntSelect = 0;
led_init();
uart0_init(2400);
tm_init(); /* Initialize and enable timer interrupt */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -