[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX LocalTimeP.nc, 1.3, 1.4

akoepke andreaskoepke at users.sourceforge.net
Fri Dec 7 11:00:18 PST 2007


Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26426

Modified Files:
	LocalTimeP.nc 
Log Message:
hello compiler bug (looks like shifting by 32 bits inside a 64 bit type is
trouble), bye bye platform independence


Index: LocalTimeP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/LocalTimeP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** LocalTimeP.nc	6 Dec 2007 18:32:11 -0000	1.3
--- LocalTimeP.nc	7 Dec 2007 19:00:15 -0000	1.4
***************
*** 38,46 ****
  }
  implementation  {
!     uint16_t counter2sec = 40000U;
      int32_t dayCounter = 0;
      bool increaseDay = FALSE;
      async command uint32_t LocalTime32kHz.get() {
!         int64_t time;
          unsigned t;
          bool dirty1;
--- 38,55 ----
  }
  implementation  {
!     typedef union 
!     {
!         int64_t op;
!         struct {
!             uint32_t lo;
!             int32_t hi;
!         };
!     } i64parts_t;
!     
!     uint16_t counter2sec = 126;
      int32_t dayCounter = 0;
      bool increaseDay = FALSE;
      async command uint32_t LocalTime32kHz.get() {
!         uint32_t time;
          unsigned t;
          bool dirty1;
***************
*** 66,80 ****
  
      async command int64_t WideLocalTime.get() {
!         int64_t time;
          uint32_t t;
          atomic {
              t = call LocalTime32kHz.get();
!             time = dayCounter;
!             if(increaseDay) time++;
!             if(time < 0) time = 0;
!             time <<= 32;
!             time += t;
          }
!         return time;
      }
      
--- 75,88 ----
  
      async command int64_t WideLocalTime.get() {
!         i64parts_t time;
          uint32_t t;
          atomic {
              t = call LocalTime32kHz.get();
!             time.hi = dayCounter;
!             if(increaseDay) time.hi++;
!             if(time.hi < 0) time.hi = 0;
!             time.lo = t;
          }
!         return time.op;
      }
      



More information about the Tinyos-2-commits mailing list