📄 init.c
字号:
/********************************************************************************/
/* */
/********************************************************************************/
#include "ccblkfn.h"
#include "sysreg.h"
#include <cdefBF533.h>
#include "cpld.h"
#include "Sys.h"
#include "Regdef.h"
PLLCTRL mypllctrl;
PLLDIV myplldiv;
/********************************************************************************/
/* */
/********************************************************************************/
void Delay(unsigned int Value)
{
unsigned int i=0;
for(i=0;i<Value;i++)
{;
}
}
void Init_Flags(void)
{
*pFIO_INEN = 0x0080;//flag input enable register, enable PF7
*pFIO_DIR = 0x0000;//flag direction register, all PFs are input
*pFIO_EDGE = 0x0000;//flag interrupt sentivity register, PF7 level
*pFIO_MASKA_D = 0x0080;
}
void Init_EBIU(void)
{
*pEBIU_AMBCTL0 = 0x7bb07bb0;
*pEBIU_AMBCTL1 = 0xffff7bb0;//use ARDY
// *pEBIU_AMBCTL1 = 0xfffc7bb0;//not use ARDY
*pEBIU_AMGCTL = 0x000f;
}
void Init_PLL(void)
{
int iIMASK_Value;
sysreg_write(reg_SYSCFG, 0x32); //Initialize System Configuration Register
// set VCO/CCLK = 1, and VCO/SCLK = 5 (take effect immediately)
*pPLL_DIV = 0x0007;
// prepare PLL changes (set CLKIN/VCO = 22; takes effect after PLL programming sequence)
*pPLL_LOCKCNT = 0x0200; // time for PLL to stabilize
*pPLL_CTL = 0x2c00; // set VCO/CLKIN = 22
// execute PLL programming sequence
*pSIC_IWR = 0x00000001; // enable only PLL wakeup interrupt
iIMASK_Value = cli(); // disable interrupts
idle(); // wait for PLL wakeup interrupt
sti(iIMASK_Value);
}//end Init_PLL
void Init_CtrlReg(void)
{
*pCtrlReg1_S = 0x41;
Delay(10000);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -