ARM9中计算MPLL的方法:
i = 2 ;//dont use 100M!
switch ( i ) {
case 0://200
key = 12;
mpll_val = (92<12)|(4<4)|(1);
break;
case 1://300
key = 13;
mpll_val = (67<12)|(1<4)|(1);
break;
case 2://400
key = 14;
mpll_val = (92<12)|(1<4)|(1);
break;
case 3://440!!!
key = 14;
mpll_val = (102<12)|(1<4)|(1);
break;
default:
key = 14;
mpll_val = (92<12)|(1<4)|(1);
break;
}
//init FCLK=400M, so change MPLL first
ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);
逐行计算:
1、mpll_val = (92<12)|(1<4)|(1);
算得mpll_val的二进制值为:0101 1100 0000 0001 0001
注意上式中92为十进制92,其十六进制为:0x5C;
2、代入ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);
得ChangeMPllValue(0x5C,1,1);
3、ChangeMPllValue()函数原型为:
void ChangeMPllValue(int mdiv,int pdiv,int sdiv)
{
rMPLLCON = (mdiv<12) | (pdiv<4) | sdiv;
}
将值代入得rMPLLCON二进制值为:0101 1100 0000 0001 0001.
4、S3C2440的Datasheet:
PLLCON Bit Description Initial State
Mdiv [19:12] Main divider control 0x96 / 0x4d
Pdiv[9:4]Pre-divider control 0x03 / 0x03
Sdiv[1:0] Post divider control0x0 / 0x0
根据上表得到Mdiv=92 Pdiv=1 Sdiv=1
Datasheet:
MPLL Control Register
Mpll = (2 * m * Fin) / (p * 2S)
m = (Mdiv + 8), p = (Pdiv + 2), s = Sdiv
所以:m = 92+8=100, p = 1+2 = 3 , s = 1 , Fin为默认输入的时钟频率12MHz.
Mpll = (2*100*12M)/(3*2) = 400M.
ARM9中计算MPL 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)