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 30ccce60bdc57ba2dd6a05c3d58a9e7466562e92..b486aefbc30313c6775cbe5da338985134c2d874 100644 (file)
 static void
 ao_panic_delay(uint8_t n)
 {
 static void
 ao_panic_delay(uint8_t n)
 {
-       uint8_t i = 0;
+       uint8_t i = 0, j = 0;
 
        while (n--)
 
        while (n--)
-               while (--i)
-                       _asm nop _endasm;
+               while (--j)
+                       while (--i)
+                               _asm nop _endasm;
 }
 
 void
 }
 
 void
@@ -32,7 +33,7 @@ ao_panic(uint8_t reason)
 {
        uint8_t n;
        
 {
        uint8_t n;
        
-       for (;;) {
+       __critical for (;;) {
                ao_led_on(AO_LED_RED);
                ao_beep(AO_BEEP_MID);
                ao_panic_delay(2);
                ao_led_on(AO_LED_RED);
                ao_beep(AO_BEEP_MID);
                ao_panic_delay(2);