Skip to content
Snippets Groups Projects
Commit 5a2f1098 authored by Michal Simek's avatar Michal Simek
Browse files

[PATCH] Support time without timer

parent a476ca2a
No related branches found
No related tags found
No related merge requests found
...@@ -33,10 +33,17 @@ void reset_timer (void) ...@@ -33,10 +33,17 @@ void reset_timer (void)
timestamp = 0; timestamp = 0;
} }
#ifdef CFG_TIMER_0
ulong get_timer (ulong base) ulong get_timer (ulong base)
{ {
return (timestamp - base); return (timestamp - base);
} }
#else
ulong get_timer (ulong base)
{
return (timestamp++ - base);
}
#endif
void set_timer (ulong t) void set_timer (ulong t)
{ {
......
...@@ -26,9 +26,17 @@ ...@@ -26,9 +26,17 @@
#include <common.h> #include <common.h>
#ifdef CFG_TIMER_0
void udelay (unsigned long usec) void udelay (unsigned long usec)
{ {
int i; int i;
i = get_timer (0); i = get_timer (0);
while ((get_timer (0) - i) < (usec / 1000)) ; 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment