Beispiel #1
0
/*
 * @implemented
 */
BOOLEAN
NTAPI
HalSetRealTimeClock(IN PTIME_FIELDS Time)
{
    /* FIXME: Acquire CMOS Lock */

    /* Loop while update is in progress */
    while ((HalpReadCmos(RTC_REGISTER_A)) & RTC_REG_A_UIP);

    /* Write time fields to CMOS RTC */
    HalpWriteCmos(0, INT_BCD(Time->Second));
    HalpWriteCmos(2, INT_BCD(Time->Minute));
    HalpWriteCmos(4, INT_BCD(Time->Hour));
    HalpWriteCmos(6, INT_BCD(Time->Weekday));
    HalpWriteCmos(7, INT_BCD(Time->Day));
    HalpWriteCmos(8, INT_BCD(Time->Month));
    HalpWriteCmos(9, INT_BCD(Time->Year % 100));

    /* FIXME: Set the century byte */

    /* FIXME: Release the CMOS Lock */

    /* Always return TRUE */
    return TRUE;
}
Beispiel #2
0
//====================
// Get RTC Data
//====================
void Get_RTC_Data(sGPSRTC *psGPSRTC)
{
    psGPSRTC->bRTC_year = INT_BCD(RTC_Read_Reg(RTC_YEARS));
    psGPSRTC->bRTC_mon  = INT_BCD(RTC_Read_Reg(RTC_C_MONTHS) & 0x1f);
    psGPSRTC->bRTC_day  = INT_BCD(RTC_Read_Reg(RTC_DAYS) & 0x3f);
    psGPSRTC->bRTC_week = RTC_Read_Reg(RTC_WEEKDAYS) & 0x07;
    psGPSRTC->bRTC_hour = INT_BCD(RTC_Read_Reg(RTC_HOURS) & 0x3f);
    psGPSRTC->bRTC_min  = INT_BCD(RTC_Read_Reg(RTC_MINUTES) & 0x7f);
    psGPSRTC->bRTC_sec  = INT_BCD(RTC_Read_Reg(RTC_SECONDS) & 0x7f);
}