| 527 | } |
| 528 | |
| 529 | static int |
| 530 | atrtc_settime(device_t dev __unused, struct timespec *ts) |
| 531 | { |
| 532 | struct bcd_clocktime bct; |
| 533 | |
| 534 | clock_ts_to_bcd(ts, &bct, false); |
| 535 | clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); |
| 536 | |
| 537 | mtx_lock(&atrtc_time_lock); |
| 538 | mtx_lock_spin(&atrtc_lock); |
| 539 | |
| 540 | /* Disable RTC updates and interrupts. */ |
| 541 | rtcout_locked(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); |
| 542 | |
| 543 | /* Write all the time registers. */ |
| 544 | rtcout_locked(RTC_SEC, bct.sec); |
| 545 | rtcout_locked(RTC_MIN, bct.min); |
| 546 | rtcout_locked(RTC_HRS, bct.hour); |
| 547 | rtcout_locked(RTC_WDAY, bct.dow + 1); |
| 548 | rtcout_locked(RTC_DAY, bct.day); |
| 549 | rtcout_locked(RTC_MONTH, bct.mon); |
| 550 | rtcout_locked(RTC_YEAR, bct.year & 0xff); |
| 551 | #ifdef USE_RTC_CENTURY |
| 552 | rtcout_locked(RTC_CENTURY, bct.year >> 8); |
| 553 | #endif |
| 554 | |
| 555 | /* |
| 556 | * Re-enable RTC updates and interrupts. |
| 557 | */ |
| 558 | rtcout_locked(RTC_STATUSB, rtc_statusb); |
| 559 | rtcin_locked(RTC_INTR); |
| 560 | |
| 561 | mtx_unlock_spin(&atrtc_lock); |
| 562 | mtx_unlock(&atrtc_time_lock); |
| 563 | |
| 564 | return (0); |
| 565 | } |
| 566 | |
| 567 | static int |
| 568 | atrtc_gettime(device_t dev, struct timespec *ts) |
nothing calls this directly
no test coverage detected