|
在kernel\oal\init.c文件中发现这个函数,不理解是什么意思,有哪位能够讲解一下吗?这里的GPB和GPF用来控制什么啊?
#ifdef DVS_EN
void ChangeVoltage(int vtg)
{
volatile S3C2440A_IOPORT_REG *s2440IOP = (S3C2440A_IOPORT_REG *)OALPAtoVA(S3C2440A_BASE_REG_PA_IOPORT, FALSE);
UINT8 temp;
// port setting
// GPF4:D0, GPF5:D1, GPF6:D2, GPF7:D3, GPB7:D4, GPB8:Latch enable
CurrVoltage = vtg;
temp = s2440IOP->GPFDAT;
switch(vtg) {
case V090: // 0.9V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(1<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(0<<7)|(0<<6)|(1<<5)|(1<<4); //D3~0
break;
case V095: // 0.95V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(1<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(0<<7)|(0<<6)|(0<<5)|(1<<4); //D3~0
break;
case V0975: // 0.975V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(1<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(0<<7)|(0<<6)|(0<<5)|(0<<4); //D3~0
break;
case V100: // 1.0V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(1<<6)|(1<<5)|(1<<4); //D3~0
break;
case V105: // 1.05V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(1<<6)|(1<<5)|(0<<4); //D3~0
break;
case V110: // 1.1V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(1<<6)|(0<<5)|(1<<4); //D3~0
break;
case V115: // 1.15V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(1<<6)|(0<<5)|(0<<4); //D3~0
break;
case V120: // 1.2V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(0<<6)|(1<<5)|(1<<4); //D3~0
break;
case V125: // 1.25V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(0<<6)|(1<<5)|(0<<4); //D3~0
break;
case V130: // 1.3V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(0<<6)|(0<<5)|(1<<4); //D3~0
break;
case V135: // 1.35V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(1<<7)|(0<<6)|(0<<5)|(0<<4); //D3~0
break;
case V140: // 1.4V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(0<<7)|(1<<6)|(1<<5)|(1<<4); //D3~0
break;
case V145: // 1.45V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(0<<7)|(1<<6)|(1<<5)|(0<<4); //D3~0
break;
case V150: // 1.5V
s2440IOP->GPBDAT=(s2440IOP->GPBDAT&0x77f)|(0<<7); //D4
s2440IOP->GPFDAT=(s2440IOP->GPFDAT&0x0f)|(0<<7)|(1<<6)|(0<<5)|(1<<4); //D3~0
break;
default:
break;
}
// port setting
// GPF4:D0, GPF5:D1, GPF6:D2, GPF7:D3, GPB7:D4, GPB8:Latch enable, GPB10: OE
s2440IOP->GPBCON=(s2440IOP->GPBCON&0x3f3fff)|(1<<14); // GPB7: Output
RETAILMSG(1,(_T("GPBCON: 0X%x\r\n"),s2440IOP->GPBCON));
// s2440IOP->rGPBDN&=~(1<<7);
s2440IOP->GPFCON=(s2440IOP->GPFCON&0x00ff)|(0x5500); // GPF4~7: Output
// s2440IOP->rGPFDN&=~(0xf<<4);
RETAILMSG(1,(_T("GPFCON: 0X%x\r\n"),s2440IOP->GPFCON));
s2440IOP->GPBDAT&=~(1<<8); //Latch enable
s2440IOP->GPBCON=(s2440IOP->GPBCON&0x3cffff)|(1<<16); // GPB8: Output
s2440IOP->GPBDAT|=(1<<10); //Output enable
s2440IOP->GPBCON=(s2440IOP->GPBCON&0x0fffff)|(1<<20); // GPB10: Output
// s2440IOP->rGPBDN&=~(1<<8);
s2440IOP->GPBDAT|=(1<<8); //Latch disable
s2440IOP->GPFDAT = temp;
} |
|