]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
fixed bug in accessing timesync offset
authorkusy <kusy>
Fri, 11 Jul 2008 19:21:23 +0000 (19:21 +0000)
committerkusy <kusy>
Fri, 11 Jul 2008 19:21:23 +0000 (19:21 +0000)
tos/chips/cc2420/transmit/CC2420TransmitP.nc

index 49aa130ea3e31fc2a00afec3bbfdda20eff18a6b..1b6cd48f5e0b5dd0b816d2db0c192e17c262fd2d 100644 (file)
@@ -268,7 +268,8 @@ implementation {
         call CaptureSFD.captureFallingEdge();
         call PacketTimeStamp.set(m_msg, time32);
         if (call PacketTimeSyncOffset.isSet(m_msg)) {
-           timesync_radio_t *timesync = (timesync_radio_t*)((void*)m_msg + call PacketTimeSyncOffset.get(m_msg));
+           nx_uint8_t *taddr = m_msg->data + (call PacketTimeSyncOffset.get(m_msg) - sizeof(cc2420_header_t));
+           timesync_radio_t *timesync = (timesync_radio_t*)taddr;
            // set timesync event time as the offset between the event time and the SFD interrupt time (TEP  133)
            *timesync  -= time32;
            call CSN.clr();