Exemple #1
0
static void
mcclock_mace_get(struct device *dev, struct clock_ymdhms *dt)
{
	struct mcclock_mace_softc *sc = (struct mcclock_mace_softc *)dev;
	ds1687_todregs regs;
	int s;

	s = splhigh();
	DS1687_GETTOD(sc, &regs);
	splx(s);

	dt->dt_sec = FROMBCD(regs[DS1687_SOFT_SEC]);
	dt->dt_min = FROMBCD(regs[DS1687_SOFT_MIN]);
	dt->dt_hour = FROMBCD(regs[DS1687_SOFT_HOUR]);
	dt->dt_wday = FROMBCD(regs[DS1687_SOFT_DOW]);
	dt->dt_day = FROMBCD(regs[DS1687_SOFT_DOM]);
	dt->dt_mon = FROMBCD(regs[DS1687_SOFT_MONTH]);
	dt->dt_year = FROMBCD(regs[DS1687_SOFT_YEAR]) +
	    (100 * FROMBCD(regs[DS1687_SOFT_CENTURY]));
}
Exemple #2
0
static int
mcclock_mace_gettime_ymdhms(todr_chip_handle_t todrch, struct clock_ymdhms *dt)
{
	struct mcclock_mace_softc *sc = todrch->cookie;
	ds1687_todregs regs;
	int s;

	s = splhigh();
	DS1687_GETTOD(sc, &regs);
	splx(s);

	dt->dt_sec = FROMBCD(regs[DS1687_SOFT_SEC]);
	dt->dt_min = FROMBCD(regs[DS1687_SOFT_MIN]);
	dt->dt_hour = FROMBCD(regs[DS1687_SOFT_HOUR]);
	dt->dt_wday = FROMBCD(regs[DS1687_SOFT_DOW]);
	dt->dt_day = FROMBCD(regs[DS1687_SOFT_DOM]);
	dt->dt_mon = FROMBCD(regs[DS1687_SOFT_MONTH]);
	dt->dt_year = FROMBCD(regs[DS1687_SOFT_YEAR]) +
	    (100 * FROMBCD(regs[DS1687_SOFT_CENTURY]));

	return 0;
}