135u5 / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
1 stars 0 forks source link

TOSSIM serial bug #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In tos/lib/tossim/platform_message.h the message_t header is defined to be the 
union of the tossim_header_t and serial_header_t. 

In cases where sizeof(tossim_header_t)>sizeof(serial_header_t) a serial packet 
will not start from the beginning of the message_t data structure which is 
assumed in tos/lib/tossim/sf/sim/SerialActiveMessageC line 127.

Instead of passing the message_t pointer to be dispatched the header pointer 
should be passed.  See fix in diff below:

diff --git a/tos/lib/tossim/sf/sim/SerialActiveMessageC.nc 
b/tos/lib/tossim/sf/sim/SerialActiveMessageC.nc
index df7cb68..a50494a 100644
--- a/tos/lib/tossim/sf/sim/SerialActiveMessageC.nc
+++ b/tos/lib/tossim/sf/sim/SerialActiveMessageC.nc
@@ -127,7 +127,7 @@ implementation {

         dbg("Serial", "Sending serial message (%p) of type %hhu and length %hhu @ %s.\n",
             msg, call AMPacket.type(msg), len, sim_time_string());
-        sim_sf_dispatch_packet((void*)msg, len);
+        sim_sf_dispatch_packet((void*)getHeader(msg), len);

         post modelSendDone ();

Original issue reported on code.google.com by mortenthansen on 18 Nov 2010 at 4:54

GoogleCodeExporter commented 8 years ago
Applied and checked in.

Original comment by philip.l...@gmail.com on 19 Nov 2010 at 11:51