All pastes #379203 Raw Edit

Anonymous

public text v1 · immutable
#379203 ·published 2007-03-03 01:10 UTC
rendered paste body
Index: firmware/export/system.h
===================================================================
--- firmware/export/system.h    (revision 12552)
+++ firmware/export/system.h    (working copy)
@@ -40,7 +40,15 @@
 static inline void udelay(unsigned usecs)
 {
     unsigned start = USEC_TIMER;
-    while ((USEC_TIMER - start) < usecs);
+    while ((USEC_TIMER - start) < usecs)
+    {
+       /* Deal with wrapping */
+       if (USEC_TIMER < start)
+       {
+               usecs += ((UINT_MAX - start);
+               start = 0;
+       }
+    }
 }