From: Michal Simek Date: Fri, 13 Jul 2007 22:18:48 +0000 (+0200) Subject: [PATCH] Support time without timer X-Git-Tag: v1.3.0-rc3~5^2~22 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5a2f1098d81ad58b309e5e558d0492643166a799;p=u-boot [PATCH] Support time without timer --- diff --git a/cpu/microblaze/timer.c b/cpu/microblaze/timer.c index ab1cb12749..b350453443 100644 --- a/cpu/microblaze/timer.c +++ b/cpu/microblaze/timer.c @@ -33,10 +33,17 @@ void reset_timer (void) timestamp = 0; } +#ifdef CFG_TIMER_0 ulong get_timer (ulong base) { return (timestamp - base); } +#else +ulong get_timer (ulong base) +{ + return (timestamp++ - base); +} +#endif void set_timer (ulong t) { diff --git a/lib_microblaze/time.c b/lib_microblaze/time.c index 3fa1b11262..0fef834992 100644 --- a/lib_microblaze/time.c +++ b/lib_microblaze/time.c @@ -26,9 +26,17 @@ #include +#ifdef CFG_TIMER_0 void udelay (unsigned long usec) { int i; i = get_timer (0); while ((get_timer (0) - i) < (usec / 1000)) ; } +#else +void udelay (unsigned long usec) +{ + unsigned int i; + for (i = 0; i < (usec * XILINX_CLOCK_FREQ / 10000000); i++); +} +#endif