[Tinyos-commits] CVS: tinyos-1.x/tos/platform/avrmote avrhardware.h, 1.15, 1.16

David Gay idgay at users.sourceforge.net
Mon Jun 20 15:07:47 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/platform/avrmote
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5369/avrmote

Modified Files:
	avrhardware.h 
Log Message:
replace TOSH_sleep with __nesc_atomic_sleep (enable intr+sleep in one go),
to fix deadlock


Index: avrhardware.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/avrmote/avrhardware.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** avrhardware.h	19 May 2005 17:27:40 -0000	1.15
--- avrhardware.h	20 Jun 2005 22:07:45 -0000	1.16
***************
*** 57,60 ****
--- 57,61 ----
  #include <avr/wdt.h>
  #include <avr/pgmspace.h>
+ #include <avr/eeprom.h>
  
  #ifndef sbi
***************
*** 152,163 ****
  }
  
- void TOSH_sleep()
- {
-     //sbi(MCUCR, 5);
-   sbi(MCUCR, SE);
-   asm volatile ("sleep");
- }
- 
- 
  // atomic statement runtime support
  
--- 153,156 ----
***************
*** 181,184 ****
--- 174,185 ----
  }
  
+ inline void __nesc_atomic_sleep()
+ {
+   /* Atomically enable interrupts and sleep */
+   sei();  // Make sure interrupts are on, so we can wake up!
+   asm volatile ("sleep");
+   TOSH_wait();
+ }
+ 
  #endif
  



More information about the Tinyos-commits mailing list