[Tinyos-commits] CVS: tinyos-1.x/tos/lib/VM/languages/motlle/mate/rep-16 MotlleRepM.nc, 1.4, 1.5

David Gay idgay at users.sourceforge.net
Wed Nov 23 15:16:25 PST 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/rep-16
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22964/rep-16

Modified Files:
	MotlleRepM.nc 
Log Message:
telosb support - better handling of alignment issues


Index: MotlleRepM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/rep-16/MotlleRepM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MotlleRepM.nc	1 Nov 2005 02:28:11 -0000	1.4
--- MotlleRepM.nc	23 Nov 2005 23:16:23 -0000	1.5
***************
*** 27,35 ****
--- 27,54 ----
  
    command mvalue V.read(svalue *location) {
+ #ifdef PLATFORM_LITTLE_ENDIAN
      return (mvalue)*location;
+ #else
+     return call V.read_unaligned(location);
+ #endif
+   }
+ 
+   command mvalue V.read_unaligned(svalue *location) {
+ #if defined(PLATFORM_REQUIRES_ALIGNMENT) || !defined(PLATFORM_LITTLE_ENDIAN)
+     uint8_t *loc = (uint8_t *)location;
+     return (mvalue)(loc[0] | loc[1] << 8);
+ #else
+     return call V.read(location);
+ #endif
    }
  
    command void V.write(svalue *location, mvalue x) {
+ #ifdef PLATFORM_LITTLE_ENDIAN
      *location = (svalue)x;
+ #else
+     uint8_t *loc = (uint8_t *)location;
+     loc[0] = x;
+     loc[1] = x >> 8;
+ #endif
    }
  



More information about the Tinyos-commits mailing list