Annotation of sys/arch/alpha/stand/netboot/getsecs.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: getsecs.c,v 1.2 1996/11/27 19:54:55 niklas Exp $ */
2:
3: #include <sys/param.h>
4: #include "include/rpb.h"
5: #include "include/prom.h"
6:
7: int
8: getsecs()
9: {
10: static long tnsec;
11: static long lastpcc, wrapsecs;
12: long curpcc, pccdiff;
13:
14: if (tnsec == 0) {
15: tnsec = 1;
16: lastpcc = alpha_rpcc() & 0xffffffff;
17: wrapsecs = (0xffffffff /
18: ((struct rpb *)HWRPB_ADDR)->rpb_cc_freq) + 1;
19:
20: #if 0
21: printf("getsecs: cc freq = %d, time to wrap = %d\n",
22: ((struct rpb *)HWRPB_ADDR)->rpb_cc_freq, wrapsecs);
23: #endif
24: }
25:
26: curpcc = alpha_rpcc() & 0xffffffff;
27: if (curpcc < lastpcc)
28: curpcc += 0x100000000;
29:
30: tnsec += ((curpcc - lastpcc) * 1000000000) / ((struct rpb *)HWRPB_ADDR)->rpb_cc_freq;
31: lastpcc = curpcc;
32:
33: return (tnsec / 1000000000);
34: }
CVSweb