| 283 | } |
| 284 | |
| 285 | static int |
| 286 | aw_rtc_gettime(device_t dev, struct timespec *ts) |
| 287 | { |
| 288 | struct aw_rtc_softc *sc = device_get_softc(dev); |
| 289 | struct clocktime ct; |
| 290 | uint32_t rdate, rtime; |
| 291 | |
| 292 | rdate = RTC_READ(sc, sc->conf->rtc_date); |
| 293 | rtime = RTC_READ(sc, sc->conf->rtc_time); |
| 294 | |
| 295 | if ((rtime & TIME_MASK) == 0) |
| 296 | rdate = RTC_READ(sc, sc->conf->rtc_date); |
| 297 | |
| 298 | ct.sec = GET_SEC_VALUE(rtime); |
| 299 | ct.min = GET_MIN_VALUE(rtime); |
| 300 | ct.hour = GET_HOUR_VALUE(rtime); |
| 301 | ct.day = GET_DAY_VALUE(rdate); |
| 302 | ct.mon = GET_MON_VALUE(rdate); |
| 303 | ct.year = GET_YEAR_VALUE(rdate) + YEAR_OFFSET; |
| 304 | ct.dow = -1; |
| 305 | /* RTC resolution is 1 sec */ |
| 306 | ct.nsec = 0; |
| 307 | |
| 308 | return (clock_ct_to_ts(&ct, ts)); |
| 309 | } |
| 310 | |
| 311 | static int |
| 312 | aw_rtc_settime(device_t dev, struct timespec *ts) |
nothing calls this directly
no test coverage detected