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

Changeset 6a3808e in mainline


Ignore:
Timestamp:
2012-04-25T11:11:46Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
fa18523
Parents:
7719958
Message:

rtc: rename the registers bit-masks to make the code more readable

Location:
uspace/drv/time/cmos-rtc
Files:
2 edited

Legend:

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

    r7719958 r6a3808e  
    3838
    3939#define RTC_STATUS_B      0x0B
    40 #define RTC_MASK_24H      0x02 /* 24h mode */
    41 #define RTC_MASK_BCD      0x04 /* BCD mode */
    42 #define RTC_MASK_INH      0x80 /* Inhibit updates */
     40#define RTC_B_24H         0x02 /* 24h mode */
     41#define RTC_B_BCD         0x04 /* BCD mode */
     42#define RTC_B_INH         0x80 /* Inhibit updates */
    4343
    4444#define RTC_STATUS_D      0x0D
    45 #define RTC_BATTERY_OK    0x80 /* Battery status */
     45#define RTC_D_BATTERY_OK  0x80 /* Battery status */
    4646
    4747#define RTC_STATUS_A      0x0A
    48 #define RTC_MASK_UPDATE   0x80 /* Update in progress */
    49 #define RTC_MASK_CLK_STOP 0x70 /* Stop the clock */
     48#define RTC_A_UPDATE      0x80 /* Update in progress */
     49#define RTC_A_CLK_STOP    0x70 /* Stop the clock */
    5050
    5151#endif
  • uspace/drv/time/cmos-rtc/cmos-rtc.c

    r7719958 r6a3808e  
    272272rtc_update_in_progress(rtc_t *rtc)
    273273{
    274         return rtc_register_read(rtc, RTC_STATUS_A) & RTC_MASK_UPDATE;
     274        return rtc_register_read(rtc, RTC_STATUS_A) & RTC_A_UPDATE;
    275275}
    276276
     
    313313        /* Check if the RTC is working in 12h mode */
    314314        bool _12h_mode = !(rtc_register_read(rtc, RTC_STATUS_B) &
    315             RTC_MASK_24H);
     315            RTC_B_24H);
    316316
    317317        if (_12h_mode) {
     
    325325
    326326        /* Check if the RTC is working in BCD mode */
    327         bcd_mode = !(rtc_register_read(rtc, RTC_STATUS_B) & RTC_MASK_BCD);
     327        bcd_mode = !(rtc_register_read(rtc, RTC_STATUS_B) & RTC_B_BCD);
    328328
    329329        if (bcd_mode) {
     
    396396        reg_b = rtc_register_read(rtc, RTC_STATUS_B);
    397397
    398         if (!(reg_b & RTC_MASK_24H)) {
     398        if (!(reg_b & RTC_B_24H)) {
    399399                /* Force 24h mode of operation */
    400                 reg_b |= RTC_MASK_24H;
     400                reg_b |= RTC_B_24H;
    401401                rtc_register_write(rtc, RTC_STATUS_B, reg_b);
    402402        }
     
    410410
    411411        /* Check if the rtc is working in bcd mode */
    412         bcd_mode = !(reg_b & RTC_MASK_BCD);
     412        bcd_mode = !(reg_b & RTC_B_BCD);
    413413        if (bcd_mode) {
    414414                /* Convert the tm struct fields in BCD mode */
     
    422422
    423423        /* Inhibit updates */
    424         rtc_register_write(rtc, RTC_STATUS_B, reg_b | RTC_MASK_INH);
     424        rtc_register_write(rtc, RTC_STATUS_B, reg_b | RTC_B_INH);
    425425
    426426        /* Write current time to RTC */
     
    434434        /* Stop the clock */
    435435        reg_a = rtc_register_read(rtc, RTC_STATUS_A);
    436         rtc_register_write(rtc, RTC_STATUS_A, RTC_MASK_CLK_STOP | reg_a);
     436        rtc_register_write(rtc, RTC_STATUS_A, RTC_A_CLK_STOP | reg_a);
    437437       
    438438        /* Enable updates */
     
    618618        case CLOCK_GET_BATTERY_STATUS:
    619619                batt_ok = rtc_register_read(rtc, RTC_STATUS_D) &
    620                     RTC_BATTERY_OK;
     620                    RTC_D_BATTERY_OK;
    621621                async_answer_1(callid, EOK, batt_ok);
    622622                break;
Note: See TracChangeset for help on using the changeset viewer.