Anton wrote:
> Hello,
> 
> in the file
> 
>    
> http://tinyos.cvs.sourceforge.net/tinyos/tinyos-2.x/tos/chips/cc2420/CC2420TimeSyncMessageP.nc?revision=1.1&view=markup
>  
> 
> 
> from the line 96 it is clear that the usual packet data payload is 
> increased by 4 bytes (where event_time is placed). But in the file
> 
>    
> http://tinyos.cvs.sourceforge.net/tinyos/tinyos-2.x/tos/chips/cc2420/transmit/CC2420TransmitP.nc?revision=1.9&view=markup
>  
> 
> 
> from line 271 it is clear that those 4 bytes intended for the event_time 
> value are actually included in the usual packet data payload.
> 
> 
> May be I don't understand something, but I rely on the following reasoning:
> 
> 1) The length byte contains the number of bytes in MAC header (which is 
> less by 1 than cc2420_header) + data + footer. Therefore the function 
> PacketTimeSyncOffset.get() should return the value equal to
> 
>    MAC header + data + footer - 1 - 4   =   MAC header + data + footer - 5.
> 
> 2) In the file CC2420TransmitP.nc (line 271) the place is reserved for 
> the event_time value. The size of cc2420_header is subtracted from the 
> PacketTimeSyncOffset.get():
> 
>    MAC header + data + footer - 5 - cc2420_header   =   MAC header + 
> data + footer - 5 - (MAC header + 1) = data + footer - 6
> 
> and this result is considered as an offset (from the first data payload 
> byte) using which the event_time value will be put in the packet. Footer 
> is 2 bytes, therefore the event_time value will be in the last 4 bytes 
> of the usual data payload. So, it looks like as if the event_time will 
> overwrite those last 4 bytes instead of being appended after them.
PacketTimeSyncOffset.get() function calls
        (call CC2420PacketBody.getHeader(msg))->length
which you correctly defined in 1). the length of the "data" part here is 
actually the length of the payload plus the timestamp size (line 96 in 
CC2420TimeSyncMessageP). therefore (data + footer - 6 = data - 4) will 
not overwrite last 4 bytes of the payload, it will append the 4 byte 
timestamp after the payload.

brano
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to