3 #include <cpu/p6/msr.h>
4 #include <cpu/p6/apic.h>
8 /* Set the apic timer to no interrupts and periodic mode */
9 apic_write(APIC_LVTT, (1 << 17)|(1<< 16)|(0 << 12)|(0 << 0));
10 /* Set the divider to 1, no divider */
11 apic_write(APIC_TDCR, APIC_TDR_DIV_1);
12 /* Set the initial counter to 0xffffffff */
13 apic_write(APIC_TMICT, 0xffffffff);
16 void udelay(unsigned usecs)
18 uint32_t start, value, ticks;
19 /* Calculate the number of ticks to run, our FSB runs a 200Mhz */
21 start = apic_read(APIC_TMCCT);
23 value = apic_read(APIC_TMCCT);
24 } while((start - value) < ticks);