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

📄 pll.c

📁 FreeScale imx21开发板Nand flash烧写程序
💻 C
字号:
// ***************************************************************************
//
//  Filename:       pll.c
//
//  Created:        Louis Lai (6/20/2003)
//
//  Modified:       $Author: $ $Date: $
//
// ***************************************************************************


// ***************************************************************************
//  pragmas
// ***************************************************************************


// ***************************************************************************
//  includes
// ***************************************************************************
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
//#include "flash.h"
#include "tht_memory_map_defines.h"
#include "common.h"


// ***************************************************************************
//  macros
// ***************************************************************************


// ***************************************************************************
//  definitions
// ***************************************************************************


	
// ***************************************************************************
//  types
// ***************************************************************************


// ***************************************************************************
//  structures
// ***************************************************************************


// ***************************************************************************
//  data
// ***************************************************************************
	

// ***************************************************************************
//  function implementations
// ***************************************************************************
void pll_setup(void)
{
		U32		PD;
		U32 	MFD;
		U32		MFI;
		U32		MFN;
		U32		PRESC;
		U32		BCLKDIV;

	// *************************************
	// fdpll = 2fref*(MFI+MFN/(MFD+1))/(PD+1)


		*(volatile U32*)CRM_MPCTL0 &=0x0;			// reset the MPLL control register

	switch (mpll_freq)

	case 54:											// HCLK = 54MHz
			CRM_MPCTL0 = 	0x000 << 26 |			// PD = 0	
							0x3E7 << 16 |			// MFD = 999
							0x006 << 10 |			// MFI = 6
							0x1B5 <<  0 |;			// MFN = 437	
							
			CRM_CSCR = 0x1700c207;					// PRESC =4, BCLKDIV = 0; 	

			break;


	case 66:											// HCLK = 66MHz
			
			CRM_MPCTL0 =	0x00 << 26 |			//	PD = 0
							0x07 << 16 |			// MFD = 7
							0x07 << 10 |			// MFI = 7
							0x07 <<  0 |;			// MFN = 7
							
			CRM_CSCR = 0x1700c207;					// PRESC =4, BCLKDIV = 0; 
						
			break;

	CRM_CSCR |= 	



}



⌨️ 快捷键说明

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