Convert to timecounters. Since sun2 lacks a separate timer for microsecond
interpolation, we just use the default clock interrupt timer. (100Hz)
This commit is contained in:
parent
77c903b90a
commit
d38176b5c8
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: types.h,v 1.5 2006/09/03 19:20:17 gdamore Exp $ */
|
||||
/* $NetBSD: types.h,v 1.6 2006/09/03 21:43:56 gdamore Exp $ */
|
||||
|
||||
#include <m68k/types.h>
|
||||
|
||||
#define __HAVE_GENERIC_SOFT_INTERRUPTS
|
||||
#define __HAVE_GENERIC_TODR
|
||||
#define __HAVE_TIMECOUNTER
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clock.c,v 1.10 2005/12/11 12:19:16 christos Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.11 2006/09/03 21:43:56 gdamore Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
|
@ -85,7 +85,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.10 2005/12/11 12:19:16 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2006/09/03 21:43:56 gdamore Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -308,37 +308,3 @@ clock_intr(struct clockframe cf)
|
|||
/* Call common clock interrupt handler. */
|
||||
hardclock(&cf);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return the best possible estimate of the time in the timeval
|
||||
* to which tvp points. We do this by returning the current time
|
||||
* plus the amount of time since the last clock interrupt.
|
||||
*
|
||||
* Check that this time is no less than any previously-reported time,
|
||||
* which could happen around the time of a clock adjustment. Just for
|
||||
* fun, we guarantee that the time will be greater than the value
|
||||
* obtained by a previous call.
|
||||
*/
|
||||
void
|
||||
microtime(struct timeval *tvp)
|
||||
{
|
||||
int s;
|
||||
static struct timeval lasttime;
|
||||
|
||||
s = splhigh();
|
||||
*tvp = time;
|
||||
tvp->tv_usec++; /* XXX */
|
||||
while (tvp->tv_usec >= 1000000) {
|
||||
tvp->tv_sec++;
|
||||
tvp->tv_usec -= 1000000;
|
||||
}
|
||||
if (tvp->tv_sec == lasttime.tv_sec &&
|
||||
tvp->tv_usec <= lasttime.tv_usec &&
|
||||
(tvp->tv_usec = lasttime.tv_usec + 1) >= 1000000) {
|
||||
tvp->tv_sec++;
|
||||
tvp->tv_usec -= 1000000;
|
||||
}
|
||||
lasttime = *tvp;
|
||||
splx(s);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue