|
static BOOL OALIoCtlHalInitRTC(
UINT32 code, VOID *pInpBuffer, UINT32 inpSize,
VOID *pOutBuffer, UINT32 outSize, UINT32 *pOutSize)
{
BOOL bRet = FALSE;
LPSYSTEMTIME lpst1; //2008--9--20 xqh_add
//2008--9--20 XQH 改变传的值,不使用传进来的RTC的值,而是转去读RTC的硬件------这样才能对上实时时钟了!!!
// SYSTEMTIME *pTime = (SYSTEMTIME*)pInpBuffer;
OALMSG(1,(TEXT("++++1111::OALIoCtlHalInitRTC()----\r\n")));
if(OEMGetRealTime(&lpst1) )
OALMSG(1,(TEXT("++++OEMGetRealTime()----in success\r\n")));
else
OALMSG(1,(TEXT("++++OEMGetRealTime()----in failure\r\n")));
OALMSG(1,(TEXT("++++1111::OALIoCtlHalInitRTC()----the year is 0x%x,the month is 0x%x,the day is 0x%x\r\n"),lpst1->wYear,lpst1->wMonth,lpst1->wDay));
//OALMSG(1,(TEXT("++++1111::OALIoCtlHalInitRTC()----the year is 0x%x,the month is 0x%x,the day is 0x%x\r\n"),pTime->wYear,pTime->wMonth,pTime->wDay));
OALMSG(OAL_IOCTL&&OAL_FUNC, (TEXT("++OALIoCtlHalInitRTC()\r\n")));
//if ((pInpBuffer == NULL) || (inpSize < sizeof(SYSTEMTIME)))
if ((pInpBuffer == NULL) || (inpSize < sizeof(SYSTEMTIME))||(lpst1 == NULL) )
{
OALMSG(OAL_ERROR, (TEXT("[OAL:ERR] OALIoCtlHalInitRTC() : Invalid Input Parameter\r\n")));
OALMSG(1,(TEXT("++++1111-0::OALIoCtlHalInitRTC()----\r\n")));
return FALSE;
}
else
{
OALMSG(1,(TEXT("++++1111-1::OALIoCtlHalInitRTC()----\r\n")));
// Add static mapping for RTC alarm
OALIntrStaticTranslate(SYSINTR_RTC_ALARM, IRQ_RTC_ALARM);
//-------------------------------
OALMSG(1,(TEXT("++++1111-1-0::OALIoCtlHalInitRTC()----\r\n")));
// Set time
// bRet = OEMSetRealTime(pTime);//2008--9--20 XQH-XG
bRet=OEMSetRealTime( lpst1 );
//----------------------------------
OALMSG(1,(TEXT("++++1111-2::OALIoCtlHalInitRTC()----\r\n")));
}
OALMSG(OAL_IOCTL&&OAL_FUNC, (TEXT("++OALIoCtlHalInitRTC() = %d\r\n"), bRet));
OALMSG(1,(TEXT("++++2222::OALIoCtlHalInitRTC()----\r\n")));
return bRet;
} |
|