Rev 1956 | Rev 2107 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1956 | Rev 2018 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | */ |
37 | */ |
38 | 38 | ||
39 | #include <arch/types.h> |
39 | #include <arch/types.h> |
40 | #include <time/clock.h> |
40 | #include <time/clock.h> |
41 | #include <time/delay.h> |
41 | #include <time/delay.h> |
- | 42 | #include <arch/cycle.h> |
|
42 | #include <arch/interrupt.h> |
43 | #include <arch/interrupt.h> |
43 | #include <arch/drivers/i8259.h> |
44 | #include <arch/drivers/i8259.h> |
44 | #include <arch/drivers/i8254.h> |
45 | #include <arch/drivers/i8254.h> |
45 | #include <cpu.h> |
46 | #include <cpu.h> |
46 | #include <config.h> |
47 | #include <config.h> |
Line 135... | Line 136... | ||
135 | o2 = inb(CLK_PORT1); |
136 | o2 = inb(CLK_PORT1); |
136 | o2 |= inb(CLK_PORT1) << 8; |
137 | o2 |= inb(CLK_PORT1) << 8; |
137 | 138 | ||
138 | CPU->delay_loop_const = ((MAGIC_NUMBER*LOOPS)/1000) / ((t1-t2)-(o1-o2)) + (((MAGIC_NUMBER*LOOPS)/1000) % ((t1-t2)-(o1-o2)) ? 1 : 0); |
139 | CPU->delay_loop_const = ((MAGIC_NUMBER*LOOPS)/1000) / ((t1-t2)-(o1-o2)) + (((MAGIC_NUMBER*LOOPS)/1000) % ((t1-t2)-(o1-o2)) ? 1 : 0); |
139 | 140 | ||
140 | clk1 = rdtsc(); |
141 | clk1 = get_cycle(); |
141 | delay(1<<SHIFT); |
142 | delay(1 << SHIFT); |
142 | clk2 = rdtsc(); |
143 | clk2 = get_cycle(); |
143 | 144 | ||
144 | CPU->frequency_mhz = (clk2-clk1)>>SHIFT; |
145 | CPU->frequency_mhz = (clk2 - clk1) >> SHIFT; |
145 | 146 | ||
146 | return; |
147 | return; |
147 | } |
148 | } |
148 | 149 | ||
149 | /** @} |
150 | /** @} |