⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysinit.c

📁 基于飞利浦公司ARM7处理器
💻 C
字号:
/*************************************************************************
 *
 *    Used with ICCARM and AARM.
 *
 *    (c) Copyright IAR Systems 2003
 *
 *    File name   : LPC_Vic.h
 *    Description : Define API for VIC
 *
 *    $Revision: 1.1.6.1 $
 **************************************************************************/

#include "LPC2294.h"

extern void TIMER_Init(void);
extern void UART_Init(void);
extern void VIC_Init(void);

/*************************************************************************
 * Function Name: CPU_Init
 * Parameters: void
 * Return: void
 *
 * Description: Hardware initialize
 *		
 *************************************************************************/
void CPU_Init(void)
{
/* Config memory mapping */

#ifdef __DEBUG_RAM    
    MEMMAP = 0x2;   // Int Vectors remap to RAM
#endif

#ifdef __DEBUG_FLASH    
    MEMMAP = 0x1;   // Int Vectors remap to Flash
#endif

#ifdef __IN_CHIP    
    MEMMAP = 0x1;   // Int Vectors remap to Flash
#endif
  
/* Config System clock and Peripheral clock */
  PLLCON = 1;		// enable PLL
  PLLCFG = 0x44;	// M = 5, P = 2
//  PLLCFG = 0x44;	// M = 5, P = 2
//	Fosc = 11.059MHz, Fcclk = 55.295MHz, Fcco = 156~320MHz
//	Fcclk = Fosc*M, M = 5
//	Fcco = Fcclk*P*2, P = 2
//	PLLCFG[4:0] = 4, PLLCFG[6:5] = 1
  PLLFEED = 0xAA;
  PLLFEED = 0x55;
  while((PLLSTAT & (1<<10)) == 0);	// wait PLL lock
  PLLCON = 3;		// connect PLL
  PLLFEED = 0xAA;
  PLLFEED = 0x55;
  VPBDIV = 1;		// VPB Clock = CPU Clock
  
/* Config memory accelerater*/
    MAMCR = 0;
	MAMTIM = 3;		// Flash fetch = 3 CPU Cycles
//	MAMTIM = 1, if Fcclk < 20MHz
//	MAMTIM = 2, if 20MHz < Fcclk < 40MHz
//  MAMTIM = 3, if 40Mhz < Fcclk < 60MHz
  MAMCR = 2;		// MAM fully enable
  
/* Disable unused peripherals */  
  PCONP |= 0x3E;	// enable Peripherals required
  
/* Config GPIO */
  IO0DIR = 0;
  IO0CLR = 0;
  IO0SET = 0;		// read from IO0PIN	
  
  IO1DIR = 0;
  IO1CLR = 0;  
  IO1SET = 0;		// read from IO1PIN
  
/* Config Ext Int */  
  EXTINT = 0xf;		// Clear Ext Int flag
  EXTMODE = 0xf;	// edge sensitive
  EXTPOLAR = 0;		// falling edge
  
/* Config UART0 & UART1 */
  UART_Init();
  
/* Config Timer0 & Timer1 */
  TIMER_Init();
  
/* Config VIC */
  VIC_Init();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -