]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
bugfix: enable sleep when no alarms are set
authorsallai <sallai>
Fri, 14 Dec 2007 20:29:36 +0000 (20:29 +0000)
committersallai <sallai>
Fri, 14 Dec 2007 20:29:36 +0000 (20:29 +0000)
tos/chips/atm1281/McuSleepC.nc

index 4c11f49d3f0262b375adc4a88d8702e33c304c7c..e375c9c6862d5401475fadde09d3d3d95685f954 100644 (file)
@@ -86,19 +86,18 @@ implementation {
     (1 << SM1)};
     
   mcu_power_t getPowerState() {
-    // Note: we go to sleep even if timer 0, 1, 3, 4,  or 5's overflow interrupt
-    // is enabled - this allows using these timers as TinyOS "Alarm"s
-    // while still having power management.
+    // Note: we go to sleep even if timer 0, 1, 3, 4,  or 5's overflow
+    // interrupt is enabled - this allows using timers 0, 1 and 3 as TinyOS
+    // "Alarm"s while still having power management. (see TEP102 Appendix C)
+    // Input capture and output compare for timer 4 and 5 are not functional
+    // on the atm1281. 
 
-    // Are external timers running?  
+    // Are there any input capture or output compare interrupts enabled
+    // for timers 0, 1 or 3?  
     if (
-        TIMSK0 & (1 << OCIE0A | 1 << OCIE0B | 1 << TOIE0) ||
-        TIMSK1 & (1 << ICIE1  | 1 << OCIE1A | 1 << OCIE1B | 1 << OCIE1C | 1 << TOIE1) ||
-        TIMSK3 & (1 << ICIE3  | 1 << OCIE3A | 1 << OCIE3B | 1 << OCIE3C | 1 << TOIE3) ||
-        // input capture and output compare for timer 4 and 5 are
-        // not functional on atm1281
-        TIMSK4 & (1 << TOIE4) ||
-        TIMSK5 & (1 << TOIE5)
+        TIMSK0 & (1 << OCIE0A | 1 << OCIE0B ) ||
+        TIMSK1 & (1 << ICIE1  | 1 << OCIE1A | 1 << OCIE1B | 1 << OCIE1C) ||
+        TIMSK3 & (1 << ICIE3  | 1 << OCIE3A | 1 << OCIE3B | 1 << OCIE3C)
     ) {
       return ATM128_POWER_IDLE;
     }