Changeset fc7d28e in mainline


Ignore:
Timestamp:
2012-04-03T19:07:05Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
aa04e81
Parents:
a408d5f
Message:

rtc: driver improvements

  • Fix bcd mode detection
  • Check if the year field in the rtc starts from 2000 instead of 1900
File:
1 edited

Legend:

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

    ra408d5f rfc7d28e  
    285285
    286286        /* Check if the RTC is working in BCD mode */
    287         bcd_mode = rtc_register_read(rtc, RTC_STATUS_B) & RTC_MASK_BCD;
    288 
    289         if (1 || bcd_mode) {
     287        bcd_mode = !(rtc_register_read(rtc, RTC_STATUS_B) & RTC_MASK_BCD);
     288
     289        if (bcd_mode) {
    290290                t->tm_sec  = bcd2dec(t->tm_sec);
    291291                t->tm_min  = bcd2dec(t->tm_min);
     
    299299        t->tm_mon--;
    300300
     301        if (t->tm_year < 100) {
     302                /* tm_year is the number of years since 1900, it is not
     303                 * possible it is < 100.
     304                 */
     305                t->tm_year += 100;
     306        }
     307
    301308        fibril_mutex_unlock(&rtc->mutex);
    302309        return EOK;
Note: See TracChangeset for help on using the changeset viewer.