[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm1281 atm128hardware.h, 1.3, 1.4

Janos Sallai sallai at users.sourceforge.net
Mon Sep 22 09:02:07 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv31564

Modified Files:
	atm128hardware.h 
Log Message:
added NxFloat support

Index: atm128hardware.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/atm128hardware.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** atm128hardware.h	7 Jul 2008 19:52:52 -0000	1.3
--- atm128hardware.h	22 Sep 2008 16:02:02 -0000	1.4
***************
*** 189,192 ****
--- 189,210 ----
  } Atm128_XMCRB_t;
  
+ /* Floating-point network-type support.
+    These functions must convert to/from a 32-bit big-endian integer that follows
+    the layout of Java's java.lang.float.floatToRawIntBits method.
+    Conveniently, for the AVR family, this is a straight byte copy...
+ */
+ 
+ typedef float nx_float __attribute__((nx_base_be(afloat)));
+ 
+ inline float __nesc_ntoh_afloat(const void *COUNT(sizeof(float)) source) @safe() {
+   float f;
+   memcpy(&f, source, sizeof(float));
+   return f;
+ }
+ 
+ inline float __nesc_hton_afloat(void *COUNT(sizeof(float)) target, float value) @safe() {
+   memcpy(target, &value, sizeof(float));
+   return value;
+ }
  
  #endif //_H_atmega128hardware_H



More information about the Tinyos-2-commits mailing list