48 #ifndef MOVE_CODE_TO_FLASH
49 #define MOVE_CODE_TO_FLASH __attribute__ ((section (".text.systeminit")))
57 #include "bsp_board_def.h"
72 #if (__Vendor_SysTickConfig != 0)
74 #if defined (system_LPC_USE_TIMER_0)
75 #define TIMER LPC_TIM0
76 #define VIC_TIMER TIMER0_IRQn
77 #define SysTick_LOAD_RELOAD_Msk 0xffffffff
78 #elif defined (system_LPC_USE_TIMER_2)
79 #define SysTick_LOAD_RELOAD_Msk 0xffffffff
80 #define TIMER LPC_TIM2
81 #define VIC_TIMER TIMER2_IRQn
82 #elif defined (system_LPC_USE_TIMER_3)
83 #define SysTick_LOAD_RELOAD_Msk 0xffffffff
84 #define TIMER LPC_TIM3
85 #define VIC_TIMER TIMER3_IRQn
87 #define SysTick_LOAD_RELOAD_Msk 0xffffffff
88 #define TIMER LPC_TIM1
89 #define VIC_TIMER TIMER1_IRQn
111 #if defined (system_LPC_USE_TIMER_1)
114 #elif defined (system_LPC_USE_TIMER_2)
117 #elif defined (system_LPC_USE_TIMER_3)
148 #if (LPC2xxx_CLOCK_SETUP)
149 #if (LPC2xxx_PLL_SETUP)
150 static void pll_feed(
void) MOVE_CODE_TO_FLASH ;
156 #define PCLKSEL0_Val 0
159 #define PCLKSEL1_Val 0
162 #define LPC_SC_MAM_MODE_DISABLED 0
163 #define LPC_SC_MAM_MODE_PARTIAL 1
164 #define LPC_SC_MAM_MODE_FULL 2
166 #if ((F_CCO_HZ < 60002304) && (F_CCO_HZ > 0))
167 #define MAMTIM_Val ((F_CCO_HZ/20000768) + 1)
174 #define MAMCR_Val LPC_SC_MAM_MODE_FULL
179 #define CHECK_RANGE(val, min, max) ((val < min) || (val > max))
180 #define CHECK_RSVD(val, mask) (val & mask)
182 #if (CHECK_RSVD((1<<LPC_SC_PLLCFG_OSCEN_Pos), ~0x00000030))
183 #error "SCS: Invalid values of reserved bits!"
185 #if (CHECK_RANGE((CLKSRCSEL_Val), 0, 2))
186 #error "CLKSRCSEL: Value out of range!"
188 #if (CHECK_RANGE((APBDIV_Val), 0, 2))
189 #error "APBDIV: Value out of range!"
211 #if (LPC2xxx_VIC_SETUP)
214 #if (LPC2xxx_CLOCK_SETUP)
215 #if (LPC2xxx_PLL_SETUP)
223 #if (i_MCU_MODEL > 2300)
224 LPC_SC->SCS |= (1 << LPC_SC_PLLCFG_OSCEN_Pos);
226 while( !(
LPC_SC->SCS & (1 << LPC_SC_PLLCFG_OSCSTAT_Pos) ));
234 #if (i_MCU_MODEL > 2300)
244 #if (i_MCU_MODEL > 2300)
245 while ( (
LPC_SC->PLLSTAT & 0x00FF7FFF) !=
255 #if (i_MCU_MODEL > 2300)
262 #if (LPC2xxx_FLASH_SETUP == 1)
270 #if (LPC2xxx_SRAM_SETUP == 1)
274 #if (LPC2xxx_SDRAM_SETUP == 1)
277 #if (BSP_BOARD_HOOK_SETUP == 1)
284 #if defined(__cplusplus)
287 #define NULL ((void *)0)
295 signed char priority )
298 #if (i_MCU_MODEL >= 2300)
302 VIC->IntEnClr = 1 << i;
303 if (priority >= 0)
VIC->VectCntl[i] = priority & 0xF;
310 VIC->VectCntl[i] = 0;
311 VIC->VectAddr[i] = 0;
317 if ((
VIC->VectCntl[i] & 0x1f) == (unsigned)IRQ_type) {
331 VIC->vectCntl[i] = 0;
335 VIC->IntEnable = 1 << IRQ_type;
337 VIC->IntEnClr = 1 << IRQ_type;
338 return ((
void *)&
VIC->VectAddr[i]);
340 #if (i_MCU_MODEL >= 2300)
344 VIC->IntEnClr = 0xFFFFFFFF;
346 VIC->VectAddress = 0;
351 VIC->VectCntl[i] = 0xF;
356 #ifndef VIC_DEFAULT_ISR
357 #define VIC_DEFAULT_ISR vic_def_isr
363 VIC->intEnClr = 0xFFFFFFFF;
376 ISR_ptr_type isr_func;
378 if (isr_func !=
NULL)
382 #if (LPC2xxx_CLOCK_SETUP)
383 #if (LPC2xxx_PLL_SETUP)
384 static void pll_feed(
void)
392 #define def_IRQHandler_name(handler_name) handler_name##_IRQHandler
421 #if (i_MCU_MODEL >= 2300)
462 #if (i_MCU_MODEL <= 2100)
467 #if (i_MCU_MODEL <= 2100)
473 #if (i_MCU_MODEL <= 2100)
474 #if (i_MCU_MODEL <= 2100)
483 #if (i_MCU_MODEL < 2300)
495 #if (i_MCU_MODEL >= 2300)