Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset f004318 in mainline


Ignore:
Timestamp:
2012-04-17T21:06:26Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
e5fbe06
Parents:
074324f1
Message:

rtc: some minor fixes

  • Fix a comment
  • return the sanity check result when reading the current time from the cmos
  • Force the 24h mode of operation only if it is not enabled yet.
  • Do not restore the 12h mode of operation at the end of time_set()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/time/cmos-rtc/cmos-rtc.c

    r074324f1 rf004318  
    317317                /* The RTC is working in 12h mode, check if it is AM or PM */
    318318                if (t->tm_hour & 0x80) {
    319                         /* PM flag is active, it must to be cleared
    320                          * or the BCD conversion will fail.
    321                          */
     319                        /* PM flag is active, it must be cleared */
    322320                        t->tm_hour &= ~0x80;
    323321                        pm_mode = true;
     
    357355
    358356        fibril_mutex_unlock(&rtc->mutex);
    359         return EOK;
     357
     358        return rtc_tm_sanity_check(t);
    360359}
    361360
     
    386385        reg_b = rtc_register_read(rtc, RTC_STATUS_B);
    387386
    388         /* Force 24h mode of operation */
    389         rtc_register_write(rtc, RTC_STATUS_B, reg_b | RTC_MASK_24H);
     387        if (!(reg_b & RTC_MASK_24H)) {
     388                /* Force 24h mode of operation */
     389                reg_b |= RTC_MASK_24H;
     390                rtc_register_write(rtc, RTC_STATUS_B, reg_b);
     391        }
    390392
    391393        if (rtc_register_read(rtc, RTC_YEAR) < 100) {
Note: See TracChangeset for help on using the changeset viewer.