]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
add some debugging functionality
authormmaroti <mmaroti>
Wed, 7 May 2008 20:29:36 +0000 (20:29 +0000)
committermmaroti <mmaroti>
Wed, 7 May 2008 20:29:36 +0000 (20:29 +0000)
tos/chips/rf230/RF230LayerP.nc

index 4e2337bf545bfc379fc86ef08f28aa1eafc5f5eb..c9329698fd4f3cae32edb5967f9eda2024718349 100644 (file)
@@ -472,24 +472,22 @@ implementation
                 */
                if( (length & RF230_TRX_STATUS_MASK) != RF230_BUSY_TX )
                {
-#ifdef RF230_DEBUG
-                       if( call DiagMsg.record() )
-                       {
-                               call DiagMsg.str("assert tx");
-                               call DiagMsg.uint16(call RadioAlarm.getNow());
-                               call DiagMsg.hex8(readRegister(RF230_TRX_STATUS));
-                               call DiagMsg.hex8(readRegister(RF230_TRX_STATE));
-                               call DiagMsg.hex8(radioIrq);
-                               call DiagMsg.uint8(state);
-                               call DiagMsg.uint8(cmd);
-                               call DiagMsg.send();
-                       }
-#endif
                        ASSERT( (length & RF230_TRX_STATUS_MASK) == RF230_PLL_ON );
+
+                       call PacketTimeStamp.clear(msg);
                        return FAIL;
                }
 
-               call PacketTimeStamp.set(msg, time);
+#ifdef RF230_DEBUG_MESSAGES
+               if( call DiagMsg.record() )
+               {
+                       call DiagMsg.str("tx");
+                       call DiagMsg.uint16(time);
+                       call DiagMsg.uint8(length);
+                       call DiagMsg.hex8s(data, length - 2);
+                       call DiagMsg.send();
+               }
+#endif
 
                // wait for the TRX_END interrupt
                state = STATE_BUSY_TX_2_RX_ON;
@@ -499,6 +497,7 @@ implementation
        }
 
        default tasklet_async event void RadioSend.sendDone(error_t error) { }
+       default tasklet_async event void RadioSend.ready() { }
 
 /*----------------- CCA -----------------*/
 
@@ -578,6 +577,21 @@ implementation
 
                call SELN.set();
                state = STATE_RX_ON;
+
+#ifdef RF230_DEBUG_MESSAGES
+               if( call DiagMsg.record() )
+               {
+                       length = call RF230Config.getLength(rxMsg);
+                       call DiagMsg.str("rx");
+                       call DiagMsg.uint16(call PacketTimeStamp.isSet(rxMsg) ? call PacketTimeStamp.get(rxMsg) : 0);
+                       call DiagMsg.uint16(call RadioAlarm.getNow());
+                       call DiagMsg.uint8(length);
+                       call DiagMsg.uint8(crc != 0);
+                       call DiagMsg.hex8s(call RF230Config.getPayload(rxMsg), length - 2);
+                       call DiagMsg.send();
+               }
+#endif
+               
                cmd = CMD_NONE;
 
                // signal only if it has passed the CRC check