/* * calculate multiplier */ void todsetfreq(vlong f) { ilock(&tod); tod.hz = f; /* calculate multiplier for time conversion */ tod.multiplier = mk64fract(TODFREQ, f); tod.divider = mk64fract(f, TODFREQ); iunlock(&tod); }
/* * calculate multiplier */ void todsetfreq(int64_t f) { ilock(&tod.Lock); tod.hz = f; /* calculate multiplier for time conversion */ tod.multiplier = mk64fract(TODFREQ, f); tod.divider = mk64fract(f, TODFREQ) + 1; tod.umultiplier = mk64fract(MicroFREQ, f); tod.udivider = mk64fract(f, MicroFREQ) + 1; iunlock(&tod.Lock); }
/* * calculate multiplier */ void todsetfreq(vlong f) { if (f <= 0) panic("todsetfreq: freq %lld <= 0", f); ilock(&tod); tod.hz = f; /* calculate multiplier for time conversion */ tod.multiplier = mk64fract(TODFREQ, f); tod.divider = mk64fract(f, TODFREQ) + 1; tod.umultiplier = mk64fract(MicroFREQ, f); tod.udivider = mk64fract(f, MicroFREQ) + 1; iunlock(&tod); }