Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/footbridge Fix thinko from this morning, delay ...



details:   https://anonhg.NetBSD.org/src/rev/41624bf81359
branches:  trunk
changeset: 538068:41624bf81359
user:      chris <chris%NetBSD.org@localhost>
date:      Thu Oct 10 23:19:13 2002 +0000

description:
Fix thinko from this morning, delay is reentrant, so resetting the timer
to 0 on entry will confuse any already running delay.

diffstat:

 sys/arch/arm/footbridge/footbridge_clock.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r ec0984c75d4d -r 41624bf81359 sys/arch/arm/footbridge/footbridge_clock.c
--- a/sys/arch/arm/footbridge/footbridge_clock.c        Thu Oct 10 23:04:33 2002 +0000
+++ b/sys/arch/arm/footbridge/footbridge_clock.c        Thu Oct 10 23:19:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: footbridge_clock.c,v 1.12 2002/10/10 10:12:27 chris Exp $      */
+/*     $NetBSD: footbridge_clock.c,v 1.13 2002/10/10 23:19:13 chris Exp $      */
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -427,12 +427,13 @@
            }
            return;     
        }
-       last = delay_clock_count;
+
+       /* 
+        * read the current value (do not reset it as delay is reentrant)
+        */
+       last = bus_space_read_4(clock_sc->sc_iot, clock_sc->sc_ioh,
+                   TIMER_3_VALUE);
         
-       /* reset timer */
-       bus_space_write_4(clock_sc->sc_iot, clock_sc->sc_ioh,
-                       TIMER_3_CLEAR, 0);
-
        delta = usecs = 0;
 
        while (n > usecs)
@@ -447,7 +448,11 @@
            
            if (cur == 0)
            {
-               /* reset the timer */
+               /*
+                * reset the timer, note that if something blocks us for more
+                * than 1/100s we may delay for too long, but I believe that
+                * is fairly unlikely.
+                */
                bus_space_write_4(clock_sc->sc_iot, clock_sc->sc_ioh,
                        TIMER_3_CLEAR, 0);
            }



Home | Main Index | Thread Index | Old Index