示例#1
0
文件: clock.c 项目: MarginC/kame
void
startrtclock()
{

	findcpuspeed();		/* use the clock (while it's free)
					to find the cpu speed */
}
示例#2
0
startrtclock() {
	int s;

	findcpuspeed();		/* use the clock (while it's free)
					to find the cpu speed */
	/* initialize 8253 clock */
	outb(TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT);

	/* Correct rounding will buy us a better precision in timekeeping */
	outb (IO_TIMER1, (XTALSPEED+hz/2)/hz);
	outb (IO_TIMER1, ((XTALSPEED+hz/2)/hz)/256);

	/* initialize brain-dead battery powered clock */
	outb (IO_RTC, RTC_STATUSA);
	outb (IO_RTC+1, 0x26);
	outb (IO_RTC, RTC_STATUSB);
	outb (IO_RTC+1, 2);

	outb (IO_RTC, RTC_DIAG);
	if (s = inb (IO_RTC+1))
		printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
	outb (IO_RTC, RTC_DIAG);
	outb (IO_RTC+1, 0);
}
示例#3
0
void
startrtclock(void)
{

	findcpuspeed();		/* use the clock (while it's free) to
				   find the CPU speed */

	timer0count.lo = 0;
	timer0count.hi = 0;
	timer0_at_last_clockintr.lo = 0;
	timer0_at_last_clockintr.hi = 0;
	timer0last     = 0;

	/* initialize 8253 clock */
	outb(IO_TIMER1 + TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT);
	outb(IO_TIMER1 + TIMER_CNTR0, TIMER0_ROLLOVER % 256);
	outb(IO_TIMER1 + TIMER_CNTR0, TIMER0_ROLLOVER / 256);

#ifdef TESTHAT
	hatCount = timer_hz_to_count(HATHZ);
	hatCount2 = timer_hz_to_count(HATHZ2);
	printf("HAT test on @ %d Hz = %d ticks\n", HATHZ, hatCount);
#endif
}