/*************************************************Copyright (c)********************************************************* ** Guangzou ZLG-MCU Development Co.,LTD. ** graduate school ** http://www.zlgmcu.com ** **--------------File Info------------------------------------------------------------------------------------------------------------------------------------------- ** File name : target.c ** Last modified Date : 2004-09-17 ** Last Version : 1.0 ** Descriptions : header file of the specific codes for LPC2100 target boards ** Every project should include a copy of this file, user may modify it as needed **------------------------------------------------------------------------------------------------------------------------------------------------------------------- ** Created by : Chenmingji ** Created date : 2004-02-02 ** Version : 1.0 ** Descriptions : The original version ** **------------------------------------------------------------------------------------------------------------------------------------------------------------------- ** Modified by : Chenmingji ** Modified date : 2004-09-17 ** Version : 1.01 ** Descriptions : Renewed the template, added more compiler supports ** **------------------------------------------------------------------------------------------------------------------------------------------------------------------- ** Modified by : yuanguiyou ** Modified date : 2008-5-6 ** Version : 1.01 ** Descriptions : change ADS 1.2 project to GNU ARM project.change some keyword eg.__irq,__swi ** **************************************************************************************************************************/ #define IN_TARGET #include "config.h" void IRQ_Exception(void) __attribute__((naked)); /* GCC中断处理函数声明 */ void FIQ_Exception(void) __attribute__((naked)); /*GCC中断处理函数声明 */ /************************************************************************************************************************ ** Function name : IRQ_Exception ** ** Descriptions : interrupt exceptional handler , change it as needed ** ** input parameters : None ** Returned value : None ** ** Used global variables: None ** Calling modules : None ** ** Created by : Chenmingji ** Created Date : 2004/02/02 **---------------------------------------------------------------------------------------------------------------------------------------------------------------------- ** Modified by : ** Modified date : **----------------------------------------------------------------------------------------------------------------------------------------------------------------------- **************************************************************************************************************************/ void IRQ_Exception(void) { ISR_ENTRY(); while(1); /* change it to your code 这一句替换为自己的代码*/ ISR_EXIT(); } /************************************************************************************************************************ ** Function name : FIQ_Exception ** ** Descriptions : Fast interrupt exceptional handler , change it as needed ** ** input parameters : None ** Returned value : None ** ** Used global variables: None ** Calling modules : None ** ** Created by : Chenmingji ** Created Date : 2004/02/02 **----------------------------------------------------------------------------------------------------------------------------------------------------------------------- ** Modified by : ** Modified date : **------------------------------------------------------------------------------------------------------------------------------------------------------------------------ **************************************************************************************************************************/ void FIQ_Exception(void) { ISR_ENTRY(); while(1); /* change it to your code 这一句替换为自己的代码*/ ISR_EXIT(); } /************************************************************************************************************************ ** Function name : TargetInit ** ** Descriptions : Initialize the target board; it is called in a necessary place, change it as needed ** ** input parameters : None ** Returned value : None ** ** Used global variables: None ** Calling modules : None ** ** Created by : Chenmingji ** Created Date : 2004/02/02 **---------------------------------------------------------------------------------------------------------------------------------------------------------------------- ** Modified by : Chenxibing ** Modified date : 2004-12-09 ** Notice : Add IntDisable() and IntEnable() Functions **---------------------------------------------------------------------------------------------------------------------------------------------------------------------- **************************************************************************************************************************/ void TargetInit(void) { /* 添加自己的代码 */ /* Add your codes here */ } #define __DEBUG_FLASH /************************************************************************************************************************ ** Function name : TargetResetInit ** ** Descriptions : Initialize the target board before running the main() function; User may ** change it as needed, but may not deleted it. ** ** input parameters : None ** Returned value : None ** ** Used global variables: None ** Calling modules : None ** ** Created by : Chenmingji ** Created Date : 2004/02/02 **---------------------------------------------------------------------------------------------------------------------------------------------------------------------- ** Modified by : Chenxibing ** Modified date : 2004-12-09 ** Notice : Add IntDisable() and IntEnable() Functions **---------------------------------------------------------------------------------------------------------------------------------------------------------------------- **************************************************************************************************************************/ void TargetResetInit(void) { #ifdef __DEBUG_RAM MEMMAP = 0x2; /* remap */ #endif #ifdef __DEBUG_FLASH MEMMAP = 0x1; /* remap */ #endif #ifdef __IN_CHIP MEMMAP = 0x1; /* remap */ #endif /* 设置系统各部分时钟 */ /* Set system timers for each component */ 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; /* 设置存储器加速模块 */ /* Set memory accelerater module*/ MAMCR = 0; #if Fcclk < 20000000 MAMTIM = 1; #else #if Fcclk < 40000000 MAMTIM = 2; #else MAMTIM = 3; #endif #endif MAMCR = 2; /* 初始化VIC */ /* initialize VIC */ VICIntEnClr = 0xffffffff; VICVectAddr = 0; VICIntSelect = 0; /* 添加自己的代码 */ /* Add your codes here */ } /********************************************************************************************************* ** End Of File ********************************************************************************************************/