made timer more generic

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1051 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Greg Watson 2003-07-28 21:16:49 +00:00
parent 008c127074
commit cc6b6c4c83
1 changed files with 9 additions and 9 deletions

View File

@ -2,29 +2,29 @@
/* This code is distributed without warranty under the GPL v2 (see COPYING) */
#include <timer.h>
#include <bsp.h>
#include <ppc.h>
unsigned get_hz(void)
unsigned long get_hz(void)
{
return bsp_clock_speed();
return get_clock_speed();
}
unsigned ticks_since_boot(void)
unsigned long ticks_since_boot(void)
{
extern unsigned long long _timebase(void);
return (unsigned) (_timebase());
extern unsigned long _timebase(void);
return _timebase();
}
void sleep_ticks(unsigned ticks)
void sleep_ticks(unsigned long ticks)
{
unsigned then = ticks + ticks_since_boot();
unsigned long then = ticks + ticks_since_boot();
while(ticks_since_boot() < then)
;
}
void udelay(int usecs)
{
unsigned ticksperusec = get_hz() / 1000000;
unsigned long ticksperusec = get_hz() / 1000000;
sleep_ticks(ticksperusec * usecs);
}