]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/rf2xx/rf230/RF230DriverLayerP.nc
changed displayed info for RF230Sniffer
[tinyos-2.x.git] / tos / chips / rf2xx / rf230 / RF230DriverLayerP.nc
index 6f74fb16c394beb2a6339ddd2bf559bd754605ff..7dbdb65717d03f3e19840650e272f255d6e65823 100644 (file)
@@ -24,7 +24,7 @@
 #include <RF230DriverLayer.h>
 #include <Tasklet.h>
 #include <RadioAssert.h>
-#include <GenericTimeSyncMessage.h>
+#include <TimeSyncMessageLayer.h>
 #include <RadioConfig.h>
 
 module RF230DriverLayerP
@@ -503,10 +503,8 @@ implementation
                if( timesync != 0 )
                        *(timesync_relative_t*)timesync = (*(timesync_absolute_t*)timesync) - time32;
 
-               do {
+               while( length-- != 0 )
                        call FastSpiByte.splitReadWrite(*(data++));
-               }
-               while( --length != 0 );
 
                // wait for the SPI transfer to finish
                call FastSpiByte.splitRead();
@@ -527,24 +525,25 @@ implementation
                // go back to RX_ON state when finished
                writeRegister(RF230_TRX_STATE, RF230_RX_ON);
 
+               if( timesync != 0 )
+                       *(timesync_absolute_t*)timesync = (*(timesync_relative_t*)timesync) + time32;
+
+               call PacketTimeStamp.set(msg, time32);
+
 #ifdef RADIO_DEBUG_MESSAGES
                if( call DiagMsg.record() )
                {
                        length = getHeader(msg)->length;
 
-                       call DiagMsg.str("tx");
-                       call DiagMsg.uint16(time);
-                       call DiagMsg.uint8(length);
+                       call DiagMsg.str("t");
+                       call DiagMsg.uint32(call PacketTimeStamp.isValid(rxMsg) ? call PacketTimeStamp.timestamp(rxMsg) : 0);
+                       call DiagMsg.uint16(call RadioAlarm.getNow());
+                       call DiagMsg.int8(length);
                        call DiagMsg.hex8s(getPayload(msg), length - 2);
                        call DiagMsg.send();
                }
 #endif
 
-               if( timesync != 0 )
-                       *(timesync_absolute_t*)timesync = (*(timesync_relative_t*)timesync) + time32;
-
-               call PacketTimeStamp.set(msg, time32);
-
                // wait for the TRX_END interrupt
                state = STATE_BUSY_TX_2_RX_ON;
                cmd = CMD_TRANSMIT;
@@ -639,11 +638,10 @@ implementation
                {
                        length = getHeader(rxMsg)->length;
 
-                       call DiagMsg.str("rx");
+                       call DiagMsg.str("r");
                        call DiagMsg.uint32(call PacketTimeStamp.isValid(rxMsg) ? call PacketTimeStamp.timestamp(rxMsg) : 0);
                        call DiagMsg.uint16(call RadioAlarm.getNow());
-                       call DiagMsg.uint8(crc != 0);
-                       call DiagMsg.uint8(length);
+                       call DiagMsg.int8(crc == 0 ? length : -length);
                        call DiagMsg.hex8s(getPayload(rxMsg), length - 2);
                        call DiagMsg.send();
                }