大家好,
小弟遇到了一个搞不懂的问题。向大家请教。
芯片是 S3C2440,wince5.0,每次系统启动好自后,去设置系统时间(OEMSetRealTime),然后系统就会不停的调用OEMGetRealTime,而且速度非常快的调用,还不停下来,造成整个系统都缓慢了。
BOOL
OEMGetRealTime(LPSYSTEMTIME lpst)
{
volatile RTCreg *s2440RTC;
s2440RTC = (RTCreg *)RTC_BASE;
RETAILMSG(1,(TEXT("[KQ_TEST] +OEMGetRealTime \r\n")));
s2440RTC->rRTCCON =0x1;
lpst->wMilliseconds=0;
lpst->wSecond= FROM_BCD(s2440RTC->rBCDSEC&0x7f);
lpst->wMinute= FROM_BCD(s2440RTC->rBCDMIN&0x7f);
lpst->wHour= FROM_BCD(s2440RTC->rBCDHOUR&0x3f);
lpst->wDayOfWeek=(s2440RTC->rBCDDATE-1);
lpst->wDay= FROM_BCD(s2440RTC->rBCDDAY&0x3f);
lpst->wMonth=FROM_BCD(s2440RTC->rBCDMON&0x1f);
//lpst->wYear=(2000+s2440RTC->rBCDYEAR);
lpst->wYear=FROM_BCD(s2440RTC->rBCDYEAR)+2000;
if (lpst->wSecond==0)
{
lpst->wSecond=FROM_BCD(s2440RTC->rBCDSEC&0x7f);
lpst->wMinute=FROM_BCD(s2440RTC->rBCDMIN&0x7f);
lpst->wHour=FROM_BCD(s2440RTC->rBCDHOUR&0x3f);
lpst->wDayOfWeek=(s2440RTC->rBCDDATE-1);
lpst->wDay=FROM_BCD(s2440RTC->rBCDDAY&0x3f);
lpst->wMonth=FROM_BCD(s2440RTC->rBCDMON&0x1f);
lpst->wYear=(2000+s2440RTC->rBCDYEAR);
}
//禁止RTC
s2440RTC->rRTCCON=0;
return TRUE;
}
BOOL
OEMSetRealTime(LPSYSTEMTIME lpst)
{
volatile RTCreg *s2440RTC = (RTCreg *)RTC_BASE;
static int firsttime = 0;
// enable RTC control
RETAILMSG(1,(TEXT("[KQ_TEST] +OEMSetRealTime \r\n")));
s2440RTC->rRTCCON = 0x1;
s2440RTC->rBCDSEC = (unsigned char)TO_BCD(lpst->wSecond );
s2440RTC->rBCDMIN = (unsigned char)TO_BCD(lpst->wMinute );
s2440RTC->rBCDHOUR = (unsigned char)TO_BCD(lpst->wHour );
s2440RTC->rBCDDATE = (unsigned char)(lpst->wDayOfWeek + 1);
s2440RTC->rBCDDAY = (unsigned char)TO_BCD(lpst->wDay );
s2440RTC->rBCDMON = (unsigned char)TO_BCD(lpst->wMonth );
s2440RTC->rBCDYEAR = (unsigned char)TO_BCD((lpst->wYear -2000));
// disable RTC control
s2440RTC->rRTCCON = 0; //&= ~0x1;
return TRUE;
}
大家帮忙看看吧,谢谢了