- use the record scc_info to determine the cpu frequency
git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@368 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
91bdd4a38b
commit
b921da960a
1 changed files with 13 additions and 2 deletions
|
@ -21,7 +21,9 @@
|
|||
#include <metalsvm/stdio.h>
|
||||
#include <metalsvm/time.h>
|
||||
#include <metalsvm/processor.h>
|
||||
//#include <asm/io.h>
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/scc.h>
|
||||
#endif
|
||||
|
||||
static uint32_t cpu_freq = 0;
|
||||
|
||||
|
@ -31,10 +33,18 @@ void udelay(uint32_t usecs) __attribute__((optimize(0)));
|
|||
|
||||
uint32_t detect_cpu_frequency(void)
|
||||
{
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
if (cpu_freq > 0)
|
||||
return cpu_freq;
|
||||
|
||||
cpu_freq = scc_info.tile_frequency*1000000;
|
||||
|
||||
return cpu_freq;
|
||||
#else
|
||||
uint64_t start, end, diff;
|
||||
uint64_t ticks, old;
|
||||
|
||||
if (cpu_freq > 0)
|
||||
if (BUILTIN_EXPECT(cpu_freq > 0, 0))
|
||||
return cpu_freq;
|
||||
|
||||
old = get_clock_tick();
|
||||
|
@ -53,6 +63,7 @@ uint32_t detect_cpu_frequency(void)
|
|||
cpu_freq = (uint32_t) (diff / (uint64_t) 1000000);
|
||||
|
||||
return cpu_freq;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t get_cpu_frequency(void)
|
||||
|
|
Loading…
Add table
Reference in a new issue