static void mcclock_mace_set(struct device *dev, struct clock_ymdhms *dt) { struct mcclock_mace_softc *sc = (struct mcclock_mace_softc *)dev; ds1687_todregs regs; int s; memset(®s, 0, sizeof(regs)); regs[DS1687_SOFT_SEC] = TOBCD(dt->dt_sec); regs[DS1687_SOFT_MIN] = TOBCD(dt->dt_min); regs[DS1687_SOFT_HOUR] = TOBCD(dt->dt_hour); regs[DS1687_SOFT_DOW] = TOBCD(dt->dt_wday); regs[DS1687_SOFT_DOM] = TOBCD(dt->dt_day); regs[DS1687_SOFT_MONTH] = TOBCD(dt->dt_mon); regs[DS1687_SOFT_YEAR] = TOBCD(dt->dt_year % 100); regs[DS1687_SOFT_CENTURY] = TOBCD(dt->dt_year / 100); s = splhigh(); DS1687_PUTTOD(sc, ®s); splx(s); }
static int mcclock_mace_settime_ymdhms(todr_chip_handle_t todrch, struct clock_ymdhms *dt) { struct mcclock_mace_softc *sc = todrch->cookie; ds1687_todregs regs; int s; memset(®s, 0, sizeof(regs)); regs[DS1687_SOFT_SEC] = TOBCD(dt->dt_sec); regs[DS1687_SOFT_MIN] = TOBCD(dt->dt_min); regs[DS1687_SOFT_HOUR] = TOBCD(dt->dt_hour); regs[DS1687_SOFT_DOW] = TOBCD(dt->dt_wday); regs[DS1687_SOFT_DOM] = TOBCD(dt->dt_day); regs[DS1687_SOFT_MONTH] = TOBCD(dt->dt_mon); regs[DS1687_SOFT_YEAR] = TOBCD(dt->dt_year % 100); regs[DS1687_SOFT_CENTURY] = TOBCD(dt->dt_year / 100); s = splhigh(); DS1687_PUTTOD(sc, ®s); splx(s); return 0; }