#include "u.h"#include "../port/lib.h"#include "mem.h"#include "dat.h"#include "fns.h"#include "io.h"#include "ureg.h"/* * this is called both by the mp's clock interrupt and * by the clockintr0 for the i8253 */voidclockintr(Ureg* ureg, void*){ /* this has to get called every tick or the 8253 timer will overflow */ fastticks(nil); if(m->flushmmu){ if(up) flushmmu(); m->flushmmu = 0; } portclock(ureg);}voiddelay(int millisecs){ millisecs *= m->loopconst; if(millisecs <= 0) millisecs = 1; aamloop(millisecs);}voidmicrodelay(int microsecs){ microsecs *= m->loopconst; microsecs /= 1000; if(microsecs <= 0) microsecs = 1; aamloop(microsecs);}ulongTK2MS(ulong ticks){ uvlong t, hz; t = ticks; hz = HZ; t *= 1000L; t = t/hz; ticks = t; return ticks;}
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"
#include "ureg.h"
/*
* this is called both by the mp's clock interrupt and
* by the clockintr0 for the i8253
*/
void
clockintr(Ureg* ureg, void*)
{
/* this has to get called every tick or the 8253 timer will overflow */
fastticks(nil);
if(m->flushmmu){
if(up)
flushmmu();
m->flushmmu = 0;
}
portclock(ureg);
}
void
delay(int millisecs)
{
millisecs *= m->loopconst;
if(millisecs <= 0)
millisecs = 1;
aamloop(millisecs);
}
void
microdelay(int microsecs)
{
microsecs *= m->loopconst;
microsecs /= 1000;
if(microsecs <= 0)
microsecs = 1;
aamloop(microsecs);
}
ulong
TK2MS(ulong ticks)
{
uvlong t, hz;
t = ticks;
hz = HZ;
t *= 1000L;
t = t/hz;
ticks = t;
return ticks;
}