]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
fix misuse of interface
authoridgay <idgay>
Mon, 23 Jun 2008 23:40:21 +0000 (23:40 +0000)
committeridgay <idgay>
Mon, 23 Jun 2008 23:40:21 +0000 (23:40 +0000)
tos/chips/cc2420/CC2420.h
tos/chips/cc2420/CC2420ActiveMessageP.nc
tos/chips/cc2420/csma/CC2420CsmaP.nc
tos/chips/cc2420/interfaces/PacketTimeSyncOffset.nc
tos/chips/cc2420/receive/CC2420ReceiveP.nc

index 2418c3f17de303cf115661e23520071975a6ace8..1d607b921763c87608ea2e6e4266c17359c25901 100644 (file)
@@ -138,6 +138,8 @@ enum {
   MAC_FOOTER_SIZE = sizeof( uint16_t ),
   // MDU
   MAC_PACKET_SIZE = MAC_HEADER_SIZE + TOSH_DATA_LENGTH + MAC_FOOTER_SIZE,
+
+  CC2420_SIZE = MAC_HEADER_SIZE + MAC_FOOTER_SIZE,
 };
 
 enum cc2420_enums {
index 6203e840f99d4481d10575a26925c7536bec39de..374f1dad32faa4e1e931f0dc7e9824bc78455b03 100644 (file)
@@ -57,10 +57,6 @@ module CC2420ActiveMessageP {
 }
 implementation {
 
-  enum {
-    CC2420_SIZE = MAC_HEADER_SIZE + MAC_FOOTER_SIZE,
-  };
-  
   /***************** AMSend Commands ****************/
   command error_t AMSend.send[am_id_t id](am_addr_t addr,
                                          message_t* msg,
@@ -73,7 +69,7 @@ implementation {
     
     signal SendNotifier.aboutToSend[id](addr, msg);
     
-    return call SubSend.send( msg, len + CC2420_SIZE );
+    return call SubSend.send( msg, len );
   }
 
   command error_t AMSend.cancel[am_id_t id](message_t* msg) {
@@ -179,10 +175,10 @@ implementation {
     }
     
     if (call AMPacket.isForMe(msg)) {
-      return signal Receive.receive[call AMPacket.type(msg)](msg, payload, len - CC2420_SIZE);
+      return signal Receive.receive[call AMPacket.type(msg)](msg, payload, len);
     }
     else {
-      return signal Snoop.receive[call AMPacket.type(msg)](msg, payload, len - CC2420_SIZE);
+      return signal Snoop.receive[call AMPacket.type(msg)](msg, payload, len);
     }
   }
   
index df6ffb25cec5260ef3d602d8ff3ff1d984085440..540982f13262d9714185357005c753c0e57e6350 100644 (file)
@@ -134,7 +134,7 @@ implementation {
       m_msg = p_msg;
     }
 
-    header->length = len;
+    header->length = len + CC2420_SIZE;
     header->fcf &= 1 << IEEE154_FCF_ACK_REQ;
     header->fcf |= ( ( IEEE154_TYPE_DATA << IEEE154_FCF_FRAME_TYPE ) |
                     ( 1 << IEEE154_FCF_INTRAPAN ) |
index 0295069b90355430dd463829d6578de70f1b18bb..8fbd2542aba1850168f8151f00a0f4dc37220545 100644 (file)
 interface PacketTimeSyncOffset
 {
     /**
+     * @param 'message_t *ONE msg' message to examine.
+     *
      * Returns TRUE if the value is set for this message.
      */
     async command bool isSet(message_t* msg);
 
     /**
+     * @param 'message_t *ONE msg' message to examine.
+     *
      * Returns the stored value of this field in the message. If the
      * value is not set, then the returned value is undefined.
      */
     async command uint8_t get(message_t* msg);
 
     /**
+     * @param 'message_t *ONE msg' message to modify.
+     *
      * Sets the isSet false to TRUE and the time stamp value to the
      * specified value.
      */
     async command void set(message_t* msg);
 
     /**
+     * @param 'message_t *ONE msg' message to modify.
+     *
      * Cancels any pending requests.
      */
     async command void cancel(message_t* msg);
index 876b1243656c637dad7f62a71728391e9dd9671c..d21f76fd61c830ee0992ba4cbe2f359cc5afa486 100644 (file)
@@ -326,16 +326,17 @@ implementation {
   task void receiveDone_task() {
     cc2420_metadata_t* metadata = call CC2420PacketBody.getMetadata( m_p_rx_buf );
     cc2420_header_t* header = call CC2420PacketBody.getHeader( m_p_rx_buf);
+    uint8_t length = header->length;
     uint8_t tmpLen __DEPUTY_UNUSED__ = sizeof(message_t) - (offsetof(message_t, data) - sizeof(cc2420_header_t));
     uint8_t* COUNT(tmpLen) buf = TCAST(uint8_t* COUNT(tmpLen), header);
     
-    metadata->crc = buf[ rxFrameLength ] >> 7;
-    metadata->lqi = buf[ rxFrameLength ] & 0x7f;
-    metadata->rssi = buf[ rxFrameLength - 1 ];
+    metadata->crc = buf[ length ] >> 7;
+    metadata->lqi = buf[ length ] & 0x7f;
+    metadata->rssi = buf[ length - 1 ];
     
     if(passesAddressCheck(m_p_rx_buf)) {
       m_p_rx_buf = signal Receive.receive( m_p_rx_buf, m_p_rx_buf->data, 
-          rxFrameLength );
+                                          length - CC2420_SIZE);
     }
     
     atomic receivingPacket = FALSE;