diff options
Diffstat (limited to 'sys/dev/dec/mcclock.c')
-rw-r--r-- | sys/dev/dec/mcclock.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/dev/dec/mcclock.c b/sys/dev/dec/mcclock.c index 3aada8b..fc06f82 100644 --- a/sys/dev/dec/mcclock.c +++ b/sys/dev/dec/mcclock.c @@ -1,4 +1,4 @@ -/* $Id: mcclock.c,v 1.1 1998/06/10 10:56:23 dfr Exp $ */ +/* $Id: mcclock.c,v 1.2 1998/06/14 13:45:41 dfr Exp $ */ /* $NetBSD: mcclock.c,v 1.11 1998/04/19 07:50:25 jonathan Exp $ */ /* @@ -111,3 +111,29 @@ mcclock_set(device_t dev, struct clocktime *ct) MC146818_PUTTOD(dev, ®s); splx(s); } + +int +mcclock_getsecs(device_t dev, int *secp) +{ + int timeout = 100000000; + int sec; + int s; + + s = splclock(); + for (;;) { + if (!(MCCLOCK_READ(dev, MC_REGA) & MC_REGA_UIP)) { + sec = MCCLOCK_READ(dev, MC_SEC); + break; + } + if (--timeout == 0) + goto fail; + } + + splx(s); + *secp = sec; + return 0; + + fail: + splx(s); + return ETIMEDOUT; +} |