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

Changeset 3b79ba5 in mainline


Ignore:
Timestamp:
2012-04-03T09:37:56Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
9e06e9f
Parents:
f30ee571
Message:

rtc: add a function to read a generic register from the CMOS memory

File:
1 edited

Legend:

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

    rf30ee571 r3b79ba5  
    8080static void rtc_close(ddf_fun_t *fun);
    8181static bool rtc_update_in_progress(rtc_t *rtc);
     82static int  rtc_register_read(ioport8_t *port, int reg);
    8283
    8384
     
    222223}
    223224
     225/** Read a register from the CMOS memory
     226 *
     227 * @param port   The I/O port assigned to the device
     228 * @param reg    The index of the register to read
     229 *
     230 * @return       The value of the register
     231 */
     232static int
     233rtc_register_read(ioport8_t *port, int reg)
     234{
     235        pio_write_8(port, reg);
     236        return pio_read_8(port + 1);
     237}
     238
    224239/** Check if an update is in progress
    225240 *
     
    231246rtc_update_in_progress(rtc_t *rtc)
    232247{
    233         pio_write_8(rtc->port, RTC_UPDATE);
    234         return pio_read_8(rtc->port + 1) & RTC_MASK_UPDATE;
     248        return rtc_register_read(rtc->port, RTC_UPDATE) & RTC_MASK_UPDATE;
    235249}
    236250
Note: See TracChangeset for help on using the changeset viewer.