📄 init_c.c
字号:
// *********************************
// LPC2000 SYSTEM WITHOUT OS
// FILE: INIT_C.C
// MODIFIED: ZPCYP 2005-3-16 20:16
// *********************************
#include "config.h"
#include "lpc22xx.h"
#include "serial.h"
void target_init(void) {
int i; // Variables for copying vectors
int *p1, *p2;
i = i; p1 = p1; p2 = p2; // To avoid compiler warning
#if PLL_SETUP > 0
PLLCFG = PLLCFG_VAL;
PLLCON = 0x01; // Enable PLL
PLLFEED = 0xAA; // Feed
PLLFEED = 0x55;
while ((PLLSTAT & (1<<10)) == 0); // Wait
PLLCON = 0x03; // Connect PLL
PLLFEED = 0xAA; // Feed
PLLFEED = 0x55;
#endif
#if MAM_SETUP > 0
MAMTIM = MAMTIM_VAL;
MAMCR = MAMCR_VAL;
#endif
#if VPBDIV_SETUP > 0
VPBDIV = VPBDIV_VAL;
#endif
#if MEMMAP_SETUP > 0
#if MEMMAP_VAL == 0x02 // Note: Check scatter file to make sure that
// spaces for RAM based vectors has been reserved.
p1 = (int *) 0x00000000; // From current vectors (always 0x00000000)
p2 = (int *) 0x40000000; // To RAM based vectors
for (i = 0; i < 16; i++) { // Copy 16 words (64 bytes)
*p2++ = *p1++;
}
#endif
MEMMAP = MEMMAP_VAL;
#endif
#if EMC_SETUP > 0
#if BCFG0_SETUP > 0
BCFG0 = BCFG0_VAL;
#endif
#if BCFG1_SETUP > 0
BCFG1 = BCFG1_VAL;
#endif
#if BCFG2_SETUP > 0
BCFG2 = BCFG2_VAL;
#endif
#if BCFG3_SETUP > 0
BCFG3 = BCFG3_VAL;
#endif
#endif
#if PINSEL_SETUP > 0
#if PINSEL0_SETUP > 0
PINSEL0 = PINSEL0_VAL;
#endif
#if PINSEL1_SETUP > 0
PINSEL1 = PINSEL1_VAL;
#endif
#if PINSEL2_SETUP > 0
PINSEL2 = PINSEL2_VAL;
#endif
#endif
#if UART0_SETUP > 0 // Remember to select TXD, RXD pin in config.h
init_serial_0();
#endif
PREINT = F_PCLK / 32768 - 1; // RTC Setup
PREFRAC = F_PCLK - (F_PCLK / 32768) * 32768;
CCR = 0x01; // Enable RTC
VICIntEnClr = 0xFFFFFFFF; // Disable all interrupts at first
VICIntSelect = 0x00000000; // All interrupts are IRQs (no FIQ)
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -