?? systemclock.c
字號:
/******************************************************************
本程序只供學習使用,未經作者許可,不得用于其它任何用途
歡迎訪問我的USB專區:http://group.ednchina.com/93/
歡迎訪問我的blog: http://www.ednchina.com/blog/computer00
http://computer00.21ic.org
SystemClock.c file
作者:Computer-lov
建立日期: 2009-03-04
修改日期: 2009-03-04
版本:V1.0
版權所有,盜版必究。
Copyright(C) Computer-lov 2009-2019
All rights reserved
*******************************************************************/
#include <AT91SAM7S64.H>
/********************************************************************
函數功能:系統時鐘初始化。
入口參數:無。
返 回:無。
備 注:晶體頻率18.432MHz。DIV=14,MUL=72,PLL輸出頻率為96.1MHz。
********************************************************************/
void SystemClockInit(void)
{
*AT91C_PMC_IDR = 0xFFFFFFFF; //disable all PMC interrupt
*AT91C_PMC_SCER = (1<<0) //Processor Clock Enable
|(1<<7); //USB Device Port Clock Enable
*AT91C_CKGR_MOR = (1<<0) //Main Oscillator Enable
|(0<<1) //Oscillator is NOT Bypassed
|(0xFF<<8); //Main Oscillator Start-up Time(255)
while(!((*AT91C_PMC_SR)&0x01)); //wait for MOSCS to be set
*AT91C_CKGR_PLLR = (0x0E<<0) //DIV
|(0x3F<<8) //PLL COUNT
|(0x00<<14) //OUT
|(0x48<<16) //MUL
|(0x01<<28); //USB DIV
while(!((*AT91C_PMC_SR)&(0x01<<2))); //wait for LOCK to be set
while(!((*AT91C_PMC_SR)&(0x01<<3))); //wait for MCKRDY to be set
*AT91C_PMC_MCKR = (0<<0) //Slow Clock is selected
|(1<<2); //Selected clock divided by 2
while(!((*AT91C_PMC_SR)&(0x01<<3))); //wait for MCKRDY to be set
*AT91C_PMC_MCKR |= (0x03<<0); //PLL Clock is selected.
while(!((*AT91C_PMC_SR)&(0x01<<3))); //wait for MCKRDY to be set
*AT91C_PMC_PCER =0xFFFFFFFF; //enable all Peripheral Clock
}
/////////////////////////End of function/////////////////////////////
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -