Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/iicbus/nxprtc.c
Show First 20 Lines • Show All 831 Lines • ▼ Show 20 Lines | nxprtc_settime(device_t dev, struct timespec *ts) | ||||
cs1 |= PCF85xx_B_CS1_STOP; | cs1 |= PCF85xx_B_CS1_STOP; | ||||
if ((err = write_reg(sc, PCF85xx_R_CS1, cs1)) != 0) | if ((err = write_reg(sc, PCF85xx_R_CS1, cs1)) != 0) | ||||
goto errout; | goto errout; | ||||
/* Grab a fresh post-sleep idea of what time it is. */ | /* Grab a fresh post-sleep idea of what time it is. */ | ||||
getnanotime(ts); | getnanotime(ts); | ||||
ts->tv_sec -= utc_offset(); | ts->tv_sec -= utc_offset(); | ||||
ts->tv_nsec = 0; | ts->tv_nsec = 0; | ||||
clock_ts_to_bcd(ts, &bct, sc->use_ampm); | err = clock_ts_to_bcd(ts, &bct, sc->use_ampm); | ||||
if (err) | |||||
return (err); | |||||
clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); | clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); | ||||
/* On 8563 set the century based on the polarity seen when reading. */ | /* On 8563 set the century based on the polarity seen when reading. */ | ||||
cflag = 0; | cflag = 0; | ||||
if (sc->chiptype == TYPE_PCF8563) { | if (sc->chiptype == TYPE_PCF8563) { | ||||
if ((sc->flags & SC_F_CPOL) != 0) { | if ((sc->flags & SC_F_CPOL) != 0) { | ||||
if (bct.year >= 0x2000) | if (bct.year >= 0x2000) | ||||
cflag = PCF8563_B_MONTH_C; | cflag = PCF8563_B_MONTH_C; | ||||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |