Commit 5a2f1098d81ad58b309e5e558d0492643166a799

Authored by Michal Simek
1 parent a476ca2ac2

[PATCH] Support time without timer

Showing 2 changed files with 15 additions and 0 deletions Side-by-side Diff

cpu/microblaze/timer.c
... ... @@ -33,10 +33,17 @@
33 33 timestamp = 0;
34 34 }
35 35  
  36 +#ifdef CFG_TIMER_0
36 37 ulong get_timer (ulong base)
37 38 {
38 39 return (timestamp - base);
39 40 }
  41 +#else
  42 +ulong get_timer (ulong base)
  43 +{
  44 + return (timestamp++ - base);
  45 +}
  46 +#endif
40 47  
41 48 void set_timer (ulong t)
42 49 {
lib_microblaze/time.c
... ... @@ -26,10 +26,18 @@
26 26  
27 27 #include <common.h>
28 28  
  29 +#ifdef CFG_TIMER_0
29 30 void udelay (unsigned long usec)
30 31 {
31 32 int i;
32 33 i = get_timer (0);
33 34 while ((get_timer (0) - i) < (usec / 1000)) ;
34 35 }
  36 +#else
  37 +void udelay (unsigned long usec)
  38 +{
  39 + unsigned int i;
  40 + for (i = 0; i < (usec * XILINX_CLOCK_FREQ / 10000000); i++);
  41 +}
  42 +#endif