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

📄 mcf52221_sysinit.c

📁 FreeRTOS - V5.1.1 Last Update: Nov 20 2008 http://sourceforge.net/projects/freertos/
💻 C
字号:
/*
 * File:		mcf52221_sysinit.c
 * Purpose:		Power-on Reset configuration of the MCF52221.
 *
 * Notes: 
 *
 */
#include "support_common.h"
#include "exceptions.h"



/********************************************************************/
static void pll_init(void)
{

   MCF_CLOCK_CCHR =0x05; // The PLL pre divider - 48MHz / 6 = 8MHz 

	/* The PLL pre-divider affects this!!! 
	 * Multiply 8Mhz reference crystal /CCHR by 10 to acheive system clock of 80Mhz
	 */

	MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_MFD(3) | MCF_CLOCK_SYNCR_CLKSRC| MCF_CLOCK_SYNCR_PLLMODE | MCF_CLOCK_SYNCR_PLLEN ;

	while (!(MCF_CLOCK_SYNSR & MCF_CLOCK_SYNSR_LOCK))
	{
	}
}
/********************************************************************/
static void scm_init(void)
{
	/*
	 * Enable on-chip modules to access internal SRAM
	 */
	MCF_SCM_RAMBAR = (0
		| MCF_SCM_RAMBAR_BA(RAMBAR_ADDRESS)
		| MCF_SCM_RAMBAR_BDE);
}

/********************************************************************/

	/*
 * Out of reset, the low-level assembly code calls this routine to
 * initialize the mcf5206e for this board. A temporary stack has been
 * setup in the internal SRAM, and the stack pointer will be changed
 * to point to DRAM once this routine returns.
	 */
void __initialize_hardware(void)
{
	/*******************************************************
	*	Out of reset, the low-level assembly code calls this 
	*	routine to initialize the MCF52221 modules for the  
	*	M522223EVB board. 
	********************************************************/


	asm 
	{
	    /* Initialize IPSBAR */
	    move.l  #__IPSBAR,d0
	       andi.l  #0xC0000000,d0 // need to mask
	    add.l   #0x1,d0
	    move.l  d0,0x40000000

	    

	    /* Initialize FLASHBAR */
	    move.l  #__FLASHBAR,d0
	       andi.l  #0xFFF80000,d0 // need to mask
	    add.l   #0x61,d0
	    movec   d0,FLASHBAR

	}

	
	/* Set real time clock freq */
	MCF_CLOCK_RTCDR = 48000000;
	
	pll_init();
	scm_init();

	initialize_exceptions();
}



⌨️ 快捷键说明

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