Slow down panic code, disable interrupts
authorKeith Packard <keithp@keithp.com>
Wed, 15 Apr 2009 04:25:15 +0000 (21:25 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 15 Apr 2009 04:25:15 +0000 (21:25 -0700)
ao_panic.c

index 30ccce6..b486aef 100644 (file)
 static void
 ao_panic_delay(uint8_t n)
 {
-       uint8_t i = 0;
+       uint8_t i = 0, j = 0;
 
        while (n--)
-               while (--i)
-                       _asm nop _endasm;
+               while (--j)
+                       while (--i)
+                               _asm nop _endasm;
 }
 
 void
@@ -32,7 +33,7 @@ ao_panic(uint8_t reason)
 {
        uint8_t n;
        
-       for (;;) {
+       __critical for (;;) {
                ao_led_on(AO_LED_RED);
                ao_beep(AO_BEEP_MID);
                ao_panic_delay(2);