Sfoglia il codice sorgente

[PATCH] Add support for design without interrupt controller
Polling timer

Michal Simek 17 anni fa
parent
commit
1c1100d2fc
2 ha cambiato i file con 15 aggiunte e 0 eliminazioni
  1. 7 0
      cpu/microblaze/timer.c
  2. 8 0
      lib_microblaze/time.c

+ 7 - 0
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)
 {

+ 8 - 0
lib_microblaze/time.c

@@ -26,9 +26,17 @@
 
 #include <common.h>
 
+#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 * CONFIG_XILINX_CLOCK_FREQ / 10000000); i++);
+}
+#endif