Date: Wed, 12 Jul 2006 22:30:31 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 101420 for review Message-ID: <200607122230.k6CMUV2D000286@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101420 Change 101420 by imp@imp_lighthouse on 2006/07/12 22:29:34 implement set_time Affected files ... .. //depot/projects/arm/src/sys/arm/at91/at91_rtc.c#5 edit .. //depot/projects/arm/src/sys/arm/at91/at91_rtcreg.h#5 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/at91_rtc.c#5 (text+ko) ==== @@ -223,9 +223,14 @@ static int at91_rtc_settime(device_t dev, struct timespec *ts) { - // XXX UGLY XXX - printf("SET TIME\n"); - return (EINVAL); + struct at91_rtc_softc *sc; + struct clocktime ct; + + sc = device_get_softc(dev); + clock_ts_to_ct(ts, &ct); + WR4(sc, RTC_TIMR, RTC_TIMR_MK(ct.hour, ct.min, ct.sec)); + WR4(sc, RTC_CALR, RTC_CALR_MK(ct.year, ct.mon, ct.day, ct.dow)); + return (0); } static device_method_t at91_rtc_methods[] = { ==== //depot/projects/arm/src/sys/arm/at91/at91_rtcreg.h#5 (text+ko) ==== @@ -74,7 +74,7 @@ #define RTC_CALR_DAY_S 24 #define RTC_CALR_DAY(x) FROMBCD(((x) & RTC_CALR_DAY_M) >> RTC_CALR_DAY_S) #define RTC_CALR_MK(yr, mon, day, dow) \ - ((TOBCD((yr) / 100 + 19) << RTC_CALR_CENTURY_S) | \ + ((TOBCD((yr) / 100 + 19) << RTC_CALR_CEN_S) | \ (TOBCD((yr) % 100) << RTC_CALR_YEAR_S) | \ (TOBCD(mon) << RTC_CALR_MON_S) | \ (TOBCD(dow) << RTC_CALR_DOW_S) | \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607122230.k6CMUV2D000286>