Changeset 78ca12b in mainline


Ignore:
Timestamp:
2012-09-04T20:11:22Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3ccba14
Parents:
ac31040
Message:

rtc: get rid of "port + 1" and use a preprocessor macro

File:
1 edited

Legend:

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

    rac31040 r78ca12b  
    5757
    5858#define REG_COUNT 2
     59
     60#define REG_SEL_PORT(port)  (port)
     61#define REG_RW_PORT(port)   ((port) + 1)
    5962
    6063typedef struct rtc {
     
    267270rtc_register_read(rtc_t *rtc, int reg)
    268271{
    269         pio_write_8(rtc->port, reg);
    270         return pio_read_8(rtc->port + 1);
     272        pio_write_8(REG_SEL_PORT(rtc->port), reg);
     273        return pio_read_8(REG_RW_PORT(rtc->port));
    271274}
    272275
     
    280283rtc_register_write(rtc_t *rtc, int reg, int data)
    281284{
    282         pio_write_8(rtc->port, reg);
    283         pio_write_8(rtc->port + 1, data);
     285        pio_write_8(REG_SEL_PORT(rtc->port), reg);
     286        pio_write_8(REG_RW_PORT(rtc->port), data);
    284287}
    285288
Note: See TracChangeset for help on using the changeset viewer.