Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/iicbus/s35390a.c
Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | s390rtc_gettime(device_t dev, struct timespec *ts) | ||||
return (clock_bcd_to_ts(&bct, ts, false)); | return (clock_bcd_to_ts(&bct, ts, false)); | ||||
} | } | ||||
static int | static int | ||||
s390rtc_settime(device_t dev, struct timespec *ts) | s390rtc_settime(device_t dev, struct timespec *ts) | ||||
{ | { | ||||
uint8_t bcd[S390_RT1_NBYTES]; | uint8_t bcd[S390_RT1_NBYTES]; | ||||
struct bcd_clocktime bct; | struct bcd_clocktime bct; | ||||
int err; | |||||
clock_ts_to_bcd(ts, &bct, false); | err = clock_ts_to_bcd(ts, &bct, false); | ||||
if (err) | |||||
return (err); | |||||
clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); | clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); | ||||
/* | /* | ||||
* Convert our time representation into something the S-xx390 | * Convert our time representation into something the S-xx390 | ||||
* can understand. | * can understand. | ||||
*/ | */ | ||||
bcd[S390_RT1_SECOND] = bct.sec; | bcd[S390_RT1_SECOND] = bct.sec; | ||||
bcd[S390_RT1_MINUTE] = bct.min; | bcd[S390_RT1_MINUTE] = bct.min; | ||||
Show All 29 Lines |