- now, get_cpu_frequency returns MHz instead of Hz

- more suitable for future architecture


git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@266 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
stefan 2010-11-24 18:58:42 +00:00
parent a0acab9861
commit d741ef36c8
2 changed files with 4 additions and 4 deletions

View file

@ -162,7 +162,7 @@ int main(void)
system_calibration();
kprintf("Processor frequency: %u MHz\n", get_cpu_frequency()/1000000);
kprintf("Processor frequency: %u MHz\n", get_cpu_frequency());
kprintf("Total memory: %u MBytes\n", atomic_int32_read(&total_pages)/((1024*1024)/PAGE_SIZE));
kprintf("Current allocated memory: %u KBytes\n", atomic_int32_read(&total_allocated_pages)*(PAGE_SIZE/1024));
kprintf("Current available memory: %u MBytes\n", atomic_int32_read(&total_available_pages)/((1024*1024)/PAGE_SIZE));

View file

@ -36,12 +36,12 @@ uint32_t detect_cpu_frequency(void)
;
start = rdtsc();
/* wait 5 time slices to determine the frequency */
/* wait a second to determine the frequency */
while(get_clock_tick() - ticks < TIMER_FREQ)
;
end = rdtsc();
cpu_freq = (uint32_t) (end - start);
cpu_freq = (uint32_t) ((end - start) / (uint64_t) 1000000);
return cpu_freq;
}
@ -57,7 +57,7 @@ uint32_t get_cpu_frequency(void)
void udelay(unsigned int usecs)
{
uint64_t start = rdtsc();
uint64_t deadline = (get_cpu_frequency()*usecs)/1000000;
uint64_t deadline = get_cpu_frequency() * usecs;
while(rdtsc() - start < deadline)
;