00001 /***************************************************************************** 00002 * target.c: Target C file for Philips LPC214x Family Microprocessors 00003 * 00004 * Copyright(C) 2006, Philips Semiconductor 00005 * All rights reserved. 00006 * 00007 * History 00008 * 2005.10.01 ver 1.00 Prelimnary version, first Release 00009 * 00010 *****************************************************************************/ 00011 00012 #include "LPC214x.h" 00013 #include "type.h" 00014 #include "irq.h" 00015 #include "target.h" 00016 00017 /***************************************************************************** 00018 ** Function name: IRQ_Exception 00019 ** 00020 ** Descriptions: interrupt exceptional handler , change it as needed 00021 ** 00022 ** parameters: None 00023 ** Returned value: None 00024 ** 00025 *****************************************************************************/ 00026 void IRQ_Exception(void) __irq; 00027 void IRQ_Exception(void) __irq 00028 { 00029 while(1); /* change it to your code */ 00030 } 00031 00032 /***************************************************************************** 00033 ** Function name: FIQ_Exception 00034 ** 00035 ** Descriptions: Fast interrupt exceptional handler , change it as needed 00036 ** 00037 ** parameters: None 00038 ** Returned value: None 00039 ** 00040 ******************************************************************************/ 00041 void FIQ_Exception(void) __fiq; 00042 void FIQ_Exception(void) __fiq 00043 { 00044 while(1); /* change it to your code */ 00045 } 00046 00047 /****************************************************************************** 00048 ** Function name: TargetInit 00049 ** 00050 ** Descriptions: Initialize the target board; it is called in a necessary 00051 ** place, change it as needed 00052 ** 00053 ** parameters: None 00054 ** Returned value: None 00055 ** 00056 ******************************************************************************/ 00057 void TargetInit(void) 00058 { 00059 /* Add your codes here */ 00060 } 00061 00062 /****************************************************************************** 00063 ** Function name: TargetResetInit 00064 ** 00065 ** Descriptions: Initialize the target board before running the main() 00066 ** function; User may change it as needed, but may not 00067 ** deleted it. 00068 ** 00069 ** parameters: None 00070 ** Returned value: None 00071 ** 00072 ******************************************************************************/ 00073 /* mthomas: all reset-initialisation is done in startup.S */ 00074 void TargetResetInit(void) 00075 { 00076 #ifdef __DEBUG_RAM 00077 MEMMAP = 0x2; /* set remap register */ 00078 #endif 00079 00080 #ifdef __DEBUG_FLASH 00081 MEMMAP = 0x1; /* set remap register */ 00082 #endif 00083 00084 #ifdef __IN_CHIP 00085 MEMMAP = 0x1; /* set remap register */ 00086 #endif 00087 00088 /* Set system timers for each component */ 00089 PLLCON = 1; 00090 #if (Fpclk / (Fcclk / 4)) == 1 00091 VPBDIV = 0; 00092 #endif 00093 #if (Fpclk / (Fcclk / 4)) == 2 00094 VPBDIV = 2; 00095 #endif 00096 #if (Fpclk / (Fcclk / 4)) == 4 00097 VPBDIV = 1; 00098 #endif 00099 00100 #if (Fcco / Fcclk) == 2 00101 PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5); 00102 #endif 00103 #if (Fcco / Fcclk) == 4 00104 PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5); 00105 #endif 00106 #if (Fcco / Fcclk) == 8 00107 PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5); 00108 #endif 00109 #if (Fcco / Fcclk) == 16 00110 PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5); 00111 #endif 00112 PLLFEED = 0xaa; 00113 PLLFEED = 0x55; 00114 while((PLLSTAT & (1 << 10)) == 0); 00115 PLLCON = 3; 00116 PLLFEED = 0xaa; 00117 PLLFEED = 0x55; 00118 00119 /* Set memory accelerater module*/ 00120 MAMCR = 0; 00121 #if Fcclk < 20000000 00122 MAMTIM = 1; 00123 #else 00124 #if Fcclk < 40000000 00125 MAMTIM = 2; 00126 #else 00127 MAMTIM = 3; 00128 #endif 00129 #endif 00130 MAMCR = 2; 00131 00132 /* Add your codes here */ 00133 return; 00134 } 00135 00136 /****************************************************************************** 00137 ** End Of File 00138 ******************************************************************************/