Index: sa11x0_ost.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/sa11x0/sa11x0_ost.c,v retrieving revision 1.18 diff -u -r1.18 sa11x0_ost.c --- sa11x0_ost.c 27 Jun 2006 13:58:08 -0000 1.18 +++ sa11x0_ost.c 17 Sep 2006 17:38:07 -0000 @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -61,7 +62,11 @@ static int saost_match(struct device *, struct cfdata *, void *); static void saost_attach(struct device *, struct device *, void *); -int gettick(void); +#ifdef __HAVE_TIMECOUNTER +static void saost_tc_init(void); +#endif /* __HAVE_TIMECOUNTER */ + +static uint32_t gettick(void); static int clockintr(void *); static int statintr(void *); void rtcinit(void); @@ -245,9 +250,35 @@ /* Zero the counter value */ bus_space_write_4(saost_sc->sc_iot, saost_sc->sc_ioh, SAOST_CR, 0); + +#ifdef __HAVE_TIMECOUNTER + saost_tc_init(); +#endif /* __HAVE_TIMECOUNTER */ +} + +#ifdef __HAVE_TIMECOUNTER +static u_int +saost_tc_get_timecount(struct timecounter *tc) +{ + return (u_int)gettick(); +} + +static void +saost_tc_init(void) +{ + static struct timecounter saost_tc = { + .tc_get_timecount = saost_tc_get_timecount, + .tc_frequency = TIMER_FREQUENCY, + .tc_counter_mask = ~0, + .tc_name = "saost_count", + .tc_quality = 100, + }; + + tc_init(&saost_tc); } +#endif /* __HAVE_TIMECOUNTER */ -int +static uint32_t gettick(void) { int counter; @@ -261,6 +292,7 @@ return counter; } +#ifndef __HAVE_TIMECOUNTER void microtime(struct timeval *tvp) { @@ -300,6 +332,7 @@ lasttime = *tvp; splx(s); } +#endif /* !__HAVE_TIMECOUNTER */ void delay(u_int usecs) @@ -334,15 +367,3 @@ otick = xtick; } } - -void -resettodr(void) -{ -} - -void -inittodr(time_t base) -{ - time.tv_sec = base; - time.tv_usec = 0; -}