| plan 9 kernel history: overview | file list | diff list |
1999/0429/alphapc/clock.c (diff list | history)
| 1999/0415/sys/src/9/alphapc/clock.c:4,9 – 1999/0429/sys/src/9/alphapc/clock.c:4,10 (short | long | prev | next) | ||
| 1999/0415 | #include "dat.h" #include "fns.h" #include "io.h" | |
| 1999/0429 | #include "axp.h" | |
| 1999/0415 | #include "ureg.h" | |
| 1999/0415/sys/src/9/alphapc/clock.c:34,90 – 1999/0429/sys/src/9/alphapc/clock.c:35,103 | ||
| 1999/0415 | iunlock(&clock0lock); } | |
| 1999/0429 | clockinit(void) | |
| 1999/0415 | { | |
| 1999/0429 | } | |
| 1999/0415 |
| |
| 1999/0429 | uvlong cycletimer(void) { ulong pcc; pcc = rpcc(nil) & 0xFFFFFFFF; if(m->cpuhz == 0){ /* * pcclast is needed to detect wraparound of * the cycle timer which is only 32-bits. * m->cpuhz is set from the info passed from * the firmware. * This could be in clockinit if can * guarantee no wraparound between then and now. * * All the clock stuff needs work. */ m->cpuhz = hwrpb->cfreq; m->pcclast = pcc; } if(pcc < m->pcclast) m->fastclock += 0x100000000LL; m->fastclock += pcc; m->pcclast = pcc; return MACHP(0)->fastclock; | |
| 1999/0415 | } | |
| 1999/0429 | vlong fastticks(uvlong* hz) | |
| 1999/0415 | { | |
| 1999/0429 | uvlong ticks; int x; | |
| 1999/0415 |
| |
| 1999/0429 | x = splhi(); ticks = cycletimer(); splx(x); if(hz) *hz = m->cpuhz; return (vlong)ticks; | |
| 1999/0415 | } void | |
| 1999/0429 | microdelay(int us) | |
| 1999/0415 | { | |
| 1999/0429 | uvlong eot; | |
| 1999/0415 |
| |
| 1999/0429 | eot = cycletimer() + (m->cpuhz/1000000)*us; while(cycletimer() < eot) ; } | |
| 1999/0415 |
| |
| 1999/0429 | void /*milli*/delay(int ms) { microdelay(ms*1000); | |
| 1999/0415 | } void | |
| 1999/0415/sys/src/9/alphapc/clock.c:135,146 – 1999/0429/sys/src/9/alphapc/clock.c:148,151 | ||
| 1999/0415 | (*(ulong*)(USTKTOP-BY2WD)) += TK2MS(1); segclock(ur->pc); } | |