diff options
author | silby <silby@FreeBSD.org> | 2004-02-24 23:07:48 +0000 |
---|---|---|
committer | silby <silby@FreeBSD.org> | 2004-02-24 23:07:48 +0000 |
commit | 921d162f27d2d05003eabe78c74fcd136c68bc4c (patch) | |
tree | a4572b14a21ac6359252223d8733779c8b666a60 /emulators/rtc | |
parent | 5161f8b318f5186e1fcc1287dbc621f1590e35cb (diff) | |
download | FreeBSD-ports-921d162f27d2d05003eabe78c74fcd136c68bc4c.zip FreeBSD-ports-921d162f27d2d05003eabe78c74fcd136c68bc4c.tar.gz |
Update the rtc driver once again. As of this revision, I believe that
the linux rtc device is being emulated as accurately as possible,
at least in terms of its behavior. Further improvements to its
accuracy will require much more precise measurement.
Device cloning is not yet implemented.
Diffstat (limited to 'emulators/rtc')
-rw-r--r-- | emulators/rtc/Makefile | 2 | ||||
-rw-r--r-- | emulators/rtc/files/rtc.c | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/emulators/rtc/Makefile b/emulators/rtc/Makefile index 571f4f8..980da69 100644 --- a/emulators/rtc/Makefile +++ b/emulators/rtc/Makefile @@ -6,7 +6,7 @@ # PORTNAME= rtc -PORTVERSION= 2003.01.28.1 +PORTVERSION= 2004.02.24.1 PORTREVISION= 1 CATEGORIES= emulators linux MASTER_SITES= # none diff --git a/emulators/rtc/files/rtc.c b/emulators/rtc/files/rtc.c index 5bf3cd9..9b22c63 100644 --- a/emulators/rtc/files/rtc.c +++ b/emulators/rtc/files/rtc.c @@ -283,7 +283,6 @@ rtc_poll(dev_t dev, int events, struct proc *p) if (events) { DLog(Linfo, "Delay for %d usec", delay); if (sc->var.woken) { - sc->var.woken = 0; revents = events; } else { selrecord(p, &sc->var.sip); @@ -296,7 +295,7 @@ int rtc_read(dev_t dev, struct uio *uio, int flags __unused) { struct rtc_softc *sc = (struct rtc_softc *) dev->si_drv1; - int error; + int error = 0; if (!sc->var.flags.enabled) return 0; @@ -305,9 +304,18 @@ rtc_read(dev_t dev, struct uio *uio, int flags __unused) return EAGAIN; DLog(Linfo, "Delay for %d usec", delay); - error = tsleep(&sc->var.rtc_ident, PCATCH, "rtc rd", hz * 10); + if (sc->var.woken == 0) + tsleep(&sc->var.rtc_ident, PCATCH, "rtc rd", hz * 10); +#if 0 + if (sc->var.woken > 1) + printf("woken: %d\n", sc->var.woken); +#endif + + if (uio->uio_resid == sizeof(int)) { + error = uiomove(&sc->var.woken, sizeof(int), uio); + } sc->var.woken = 0; - return 0; + return error; } /* -=-=-=-=-=-=-=-=-= module load/unload stuff -=-=-=-=-=-=-=-=-= */ @@ -380,7 +388,7 @@ rtc_callback(void *xtp) if (callout_pending(&sc->var.rtc_handle) || !callout_active(&sc->var.rtc_handle)) return; /* Wakeup sleepers */ - sc->var.woken = 1; + sc->var.woken++; selwakeup(&sc->var.sip); wakeup(&sc->var.rtc_ident); |