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 {
}
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,
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) {
}
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);
}
}
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 ) |
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);
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;